debug-mode
Skill120 starsChanged 19 days agoMITView on GitHub
Interactive debugging mode that generates hypotheses, instruments code with runtime logs, and iteratively fixes bugs via autonomous reproduce-analyze loops, with human help only as a fallback. Only for hard-to-diagnose bugs; in those cases, remind the user that debug-mode is available, and never proactively activate this skill.
8 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- whoaskedssselery/claude-workspacetheir own version, first seen Oct 20, 2026
- liush2yuxjtu/pi-debug-modetheir own version, first seen Oct 17, 2026
- wangnan0916/runtime-debug-toolkittheir own version, first seen Oct 15, 2026
- kaushik912/my-claude-skillsedited, first seen Sep 28, 2026
- heiets/universal-debug-mode-skilltheir own version, first seen Sep 14, 2026
- vanenshi/skillstheir own version, first seen Aug 5, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- kaushik912/my-claude-skills★ 187% same
Wrote their own version · 7
- liush2yuxjtu/pi-debug-mode★ 4same name
- vanenshi/skills★ 2same name
- duniecdawid/ultra-claude★ 0same name
- heiets/universal-debug-mode-skill★ 0same name
- khanashes/claude-skills★ 0same name
- wangnan0916/runtime-debug-toolkit★ 0same name
- whoaskedssselery/claude-workspace★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 10 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Ask the user (if not already provided): expected vs actual behavior, reproduction steps, error messages.
- Distinctive: line 16
Read the relevant source code.
- Very specific: line 38
Write to {project_root}/.agents/debug.log using an absolute path by default.
- Very specific: line 42
Before each reproduction: create .agents/ if needed.
- Distinctive: line 48
Restricted/remote/mobile runtimes: If the code runs on mobile, embedded, or remote environments that cannot write to the project root, …
- Distinctive: line 49
Intermittent bugs: If the bug cannot be triggered immediately, keep instrumentation in place and let the user report back with logs …
- Distinctive: line 53
ALL instrumentation MUST be wrapped in region blocks for clean removal:
- Very specific: line 68
NEVER use
console.log、printor any stdout/stderr output: All debug output MUST go to debug.log — server-side via file-append, … - Distinctive: line 73
After instrumenting, reproduce the bug yourself when the environment allows (run the failing command, tests, or endpoint).
- Distinctive: line 77
When the bug has been reproduced (by you or the user):
- Distinctive: line 93
If inconclusive: new hypotheses → more instrumentation → archive & reset log → reproduce again yourself.
- Distinctive: line 97
Write a fix. Keep debug instrumentation in place.
- Very specific: line 103
If fixed: Remove all #region DEBUG blocks and contents (use Grep to find them), delete all .agents/debug*.log files (including archived …
- Distinctive: line 105
If NOT fixed: Read the new logs; ask the user what they observed only if they were the one who reproduced.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Debug Mode
You are in Debug Mode — a hypothesis-driven debugging workflow. Do NOT jump to fixes. Follow each phase in order.
Phase 1: Understand the Bug
Ask the user (if not already provided): expected vs actual behavior, reproduction steps, error messages.
Read the relevant source code. Understand the call chain and data flow.
Phase 2: Generate Hypotheses
Generate testable hypotheses as a numbered list:
Based on my analysis, here are my hypotheses:
1. **[Title]** — [What might be wrong and why]
2. **[Title]** — [Explanation]
3. **[Title]** — [Explanation]Include both obvious and non-obvious causes (race conditions, off-by-one, stale closures, type coercion, etc.).
Manual reproduction fatigues users—especially after 3+ rounds without finding the root cause. Include sufficiently detailed and reasonable debug information upfront to minimize reproduction cycles.
Phase 3: Instrument the Code
Log file & Evidence Collection
Write to {project_root}/.agents/debug.log using an absolute path by default.
project_root = hardcoded constant string inferred from context (file paths in the conversation). PROHIBITED: import.meta.dir, __dirname, process.cwd(), Deno.cwd(), path.resolve() or any runtime detection. Exception: remote/CI environments or non-writable local filesystem — use /tmp/.agents/debug.log instead.
Before each reproduction: create .agents/ if needed. If .agents/debug.log exists and is non-empty, archive it first (rename to debug-1.log, debug-2.log, etc., incrementing sequentially) before resetting debug.log to empty, preserving historical logs.
Server-side: file-append API (fs.appendFileSync, open("a"), etc.). Browser-side: fetch POST to a debug API route. Must work in all environments (dev/release).
Adapt for non-standard environments & intermittent bugs (Evidence over Ritual):
- Restricted/remote/mobile runtimes: If the code runs on mobile, embedded, or remote environments that cannot write to the project root, adapt the log destination (e.g. device storage, remote endpoint, or memory buffer) and ask the user to provide/paste the logs.
- Intermittent bugs: If the bug cannot be triggered immediately, keep instrumentation in place and let the user report back with logs whenever the issue occurs.
Region markers
ALL instrumentation MUST be wrapped in region blocks for clean removal:
// #region DEBUG (JS/TS/Java/C#/Go/Rust/C/C++)
# #region DEBUG (Python/Ruby/Shell/YAML)
<!-- #region DEBUG --> (HTML/Vue/Svelte)
-- #region DEBUG (Lua)
...instrumentation...
// #endregion DEBUG (matching closer)Logging rules
- NEVER use
console.log、printor any stdout/stderr output. All debug output MUST go todebug.log— server-side via file-append, browser-side viafetchto a debug API endpoint. - Log messages include hypothesis number:
[DEBUG H1],[DEBUG H2], etc. - Log variable states, execution paths, timing, decision points
- Be minimal — only what's needed to confirm/rule out each hypothesis
After instrumenting, reproduce the bug yourself when the environment allows (run the failing command, tests, or endpoint). Only if you cannot reproduce it, tell the user how to reproduce, then STOP and wait.
Phase 4: Analyze Logs & Diagnose
When the bug has been reproduced (by you or the user):
- Check log file size first (e.g.
wc -lorls -lh). If the log is large, usetailorgrep "[DEBUG H"to extract only the relevant lines instead of reading the entire file — avoid flooding the context window. - Map logs to hypotheses — determine which are confirmed vs ruled out
- Present diagnosis with evidence:
## Diagnosis
**Root cause**: [Explanation backed by log evidence]
Evidence:
- [H1] Ruled out — [why]
- [H2] Confirmed — [log evidence]If inconclusive: new hypotheses → more instrumentation → archive & reset log → reproduce again yourself; ask the user only when you cannot.
Phase 5: Generate a Fix
Write a fix. Keep debug instrumentation in place.
Archive and reset .agents/debug.log, then reproduce again yourself to verify the fix. If you cannot reproduce it yourself, ask the user to verify, then STOP and wait.
Phase 6: Verify & Clean Up
If fixed: Remove all #region DEBUG blocks and contents (use Grep to find them), delete all .agents/debug*.log files (including archived logs), summarize.
If NOT fixed: Read the new logs; ask the user what they observed only if they were the one who reproduced. Return to Phase 2 and iterate.
Rules
- Never skip phases. Instrument and verify even if you think you know the answer.
- Never remove instrumentation until the fix is verified (by you, or by the user when you cannot reproduce it yourself).
- Never use
console.log、printetc. Route all debug output to{project_root}/.agents/debug.log(or adapt the transport if runtime constraints require it). - Always archive existing logs and reset
debug.logbefore each reproduction. - Always wrap instrumentation in
#region DEBUGblocks.
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
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.

