Skill

Debug Trace

debuggingloggingagentic

Save the file as ~/.claude/skills/debug-trace/SKILL.md (user-level, available everywhere) or .claude/skills/debug-trace/SKILL.md (project-level). Claude Code loads it automatically when its trigger condition matches.

Debug Trace Skill: Instrument, Then Clean Up

Debugging by adding random console.log everywhere is how you end up shipping console.log("WHY") to production. This skill is two-phase: instrument the suspect path with 3–6 tagged logs, then strip every one of them back out once the bug is found.

Full Prompt
An installable debug-trace skill. Adds 3-6 tagged log lines at the boundary between known-correct and unknown state, then cleans every one of them up when you're done.

What It Does

  • Logs at boundaries — function entry/exit, branch decisions, just before throws
  • Tags every line[DBG-modal-save] so you can grep them all back out
  • Stops at 3–6 lines — more than 10 logs is noise, not signal
  • Hard cleanup passgit grep "DBG-" must come back empty before you ship

Install in 30 Seconds

Pick your tool above and download:

  • Claude Code: ~/.claude/skills/debug-trace/SKILL.md
  • OpenAI Codex CLI: append to AGENTS.md
  • Cursor: append to .cursorrules

Describe the symptom in one sentence, run the repro, paste the logs back, and ask for cleanup.

Why Two Phases Beat One

The single-phase version of this — "just sprinkle some logs" — ends with debug noise lingering in the repo for weeks. Tagged logs plus a guaranteed cleanup pass turn debugging into a closed loop: instrument, learn, remove, ship. No console.log("HERE") left behind.

Install once, debug without leaking artifacts.