CtrlK
BlogDocsLog inGet started
Tessl Logo

1k-debug-logging

Add or clean temporary OneKey debug console logs with consistent prefixes and safe stringify. Excludes analytics and permanent server logs.

68

Quality

83%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

OneKey Debug Logging

Use this skill for temporary local debug logs. Keep the convention to one filterable prefix and one safe stringify helper.

Pattern

Create one local helper near the debug area. Rename the prefix and exported helper for the domain:

const LOG_PREFIX = '[MKT-TAB]';

function stringifyLogValue(value: unknown) {
  try {
    return JSON.stringify(value);
  } catch (error) {
    return JSON.stringify({
      stringifyError: error instanceof Error ? error.message : String(error),
    });
  }
}

export function debugMarketTabsLog(label: string, value?: unknown) {
  if (process.env.NODE_ENV === 'production') {
    return;
  }

  const valueText = value === undefined ? '' : ` ${stringifyLogValue(value)}`;
  // eslint-disable-next-line no-console
  console.log(`${LOG_PREFIX} ${label}${valueText}`);
}

Use the helper at call sites instead of raw console.log:

debugMarketTabsLog('tab-change', {
  activeTab,
  itemCount: items.length,
});

Rules

  • Do not scatter raw console.log; keep it inside the helper.
  • Keep the helper no-op in production.
  • Keep labels short and stable so logs can be filtered.
  • Prefer counts, IDs already visible in the UI, booleans, and small scalar state over dumping objects.
  • Do not log secrets, private keys, mnemonics, wallet identifiers, full arrays, full watchlists, or full request payloads.
  • Remove temporary debug helpers and call sites before shipping unless the user explicitly asks to keep them.

Related Skills

  • /1k-analytics - Use for server analytics and permanent business metrics instead of temporary debug logs.
  • /1k-code-quality - Use when lint or type checks are part of the cleanup.
Repository
OneKeyHQ/app-monorepo
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.