agentleFS
WeaverseWeaverse/.agents/skills/debug-logs/SKILL.md

debug-logs

Skill0 starsChanged 6 days agoMITView on GitHub

Collect a bounded browser-only reproduction timeline in window.__debug_logs instead of console output. Use when temporary client-side instrumentation is needed; use production-debugging for server, edge or database failures.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the team's temporary window.__debug_logs technique when console output is noisy or a reproduction must be handed back as JSON.

    line 9
  2. Distinctive:

    Keep initialization out of the render path so a re-render does not erase the capture.

    line 18
  3. Distinctive:

    Before a fresh reproduction, clear the array explicitly once.

    line 44
  4. Very specific:

    Verify .debug/ at the project root is Git-ignored before writing a capture.

    line 45
  5. Distinctive:

    Read the timeline against the actual code.

    line 49
  6. Very specific:

    Remove all marked instrumentation and global declarations after the investigation.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Browser debug timeline

Use the team's temporary window.__debug_logs technique when console output is noisy or a reproduction must be handed back as JSON. Browser access still follows the current task's permission rules.

Instrument

  1. Choose only the decision points that distinguish the competing explanations. Use code-owned stage names, counts, booleans and bounded status categories. No customer data, identifiers, tokens, full URLs, form values, raw errors, props or response bodies belong in window.__debug_logs.
  2. Wrap every added helper, call and type declaration in DEBUG START / DEBUG END markers. Keep initialization out of the render path so a re-render does not erase the capture.
  3. Adapt this bounded example to the repository's style; do not spread arbitrary objects into an entry:

    // DEBUG START
    type DebugStage = 'load' | 'submit' | 'result';
    interface DebugEntry {
      timestamp: number;
      stage: DebugStage;
      count: number;
      ok: boolean;
    }
    declare global {
      interface Window { __debug_logs?: DebugEntry[]; }
    }
    function debugLog(stage: DebugStage, count: number, ok: boolean) {
      if (typeof window === 'undefined') return;
      window.__debug_logs ??= [];
      if (window.__debug_logs.length >= 1000) window.__debug_logs.shift();
      window.__debug_logs.push({timestamp: Date.now(), stage, count, ok});
    }
    // DEBUG END

Capture and remove

  • Before a fresh reproduction, clear the array explicitly once. Do not clear it on every mount or render.
  • Verify .debug/ at the project root is Git-ignored before writing a capture. Do not put logs in a spec.
  • In an approved browser session, reproduce and export with copy(JSON.stringify(window.__debug_logs ?? [], null, 2)); this DevTools helper is browser-specific. Save a reviewed capture as .debug/logs-1.json (choose the next unused index).
  • Read the timeline against the actual code. Missing stages prove absence only if the capture window, initialization and capacity limit cover them. Distinguish a bounded buffer eviction from a missing event.
  • Remove all marked instrumentation and global declarations after the investigation. Search for both markers and __debug_logs, then run the relevant tests/build. Do not ship a dormant payload collector.

Report the captured stages, last proven boundary, resulting fix and cleanup status. If the failure is outside the browser, switch to production-debugging rather than extending this array into a retained logging system.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.