debug-mantra
thananon/9arm-skills
Four-step debugging discipline: reproduce reliably, trace the fail path, falsify hypotheses, cross-reference all observations.
What is debug-mantra?
A structured debugging methodology that enforces reproducibility, systematic path tracing, hypothesis falsification, and experimental ledger-keeping. Use this whenever debugging starts—when a user reports a bug, something is broken, or a stack trace appears.
- Recite a four-part mantra at the start of each debug session to anchor discipline
- Enforce reproducible failure before any diagnosis (reject flaky or unreproducible bugs)
- Escalate fail-path discovery systematically: debugger → source trace + knob enumeration → instrumentation
- Require disproof-first hypothesis testing with 3–5 ranked candidates, not single-hypothesis anchoring
- Maintain a running ledger of every experiment to cross-reference against all prior observations
How to install debug-mantra
npx skills add https://github.com/thananon/9arm-skills --skill debug-mantraHow to use debug-mantra
- 1.Trigger the skill by saying /debug-mantra or by reporting a bug/error/failure
- 2.Recite the four-part mantra verbatim in your first response (reproducibility, fail path, falsify hypothesis, cross-reference breadcrumbs)
- 3.Build a reliable, fast (1–5 s) reproducible case before proceeding—reject flaky or unreproducible bugs
- 4.Trace the fail path in order: attach debugger → enumerate knobs and conditions → add instrumentation if needed
- 5.Generate 3–5 ranked hypotheses and run the disproof first for each candidate
- 6.Maintain a ledger entry after every experiment: what changed, what happened, what it ruled in or out
- 7.Walk the ledger when a new hypothesis surfaces to ensure it holds for every prior observation
- 8.Design the single experiment whose outcome makes the answer certain, then run it next
Use cases
- A user reports a bug and you need to isolate root cause before proposing a fix
- A stack trace or error log appears and you must trace the exact code path that breaks
- A flaky test or intermittent failure requires raising reproducibility rate before debugging
- A hypothesis surfaces but you need to design the single experiment that would disprove it
- Multiple prior runs contradict a new hypothesis and you must walk the ledger to refine or discard
- Developers debugging production issues or test failures
- QA engineers isolating intermittent or hard-to-reproduce bugs
- Code reviewers or maintainers investigating reported defects
- Anyone needing systematic, disciplined root-cause analysis before committing to a fix
debug-mantra FAQ
Once per debug session, in your first response. Never re-recite mid-session. If the user says 'skip the mantra,' skip the recital but still apply the four steps silently.
Stop immediately. Say so explicitly. Do not hypothesize. Ask the user for environment access, captured artifacts (HAR, logs, core dumps), or permission to instrument. A 1% flake rate is not debuggable; aim for 50%+ reproducibility first.
No. Scrutinize it first: does it explain the symptom end-to-end? What would disprove it? Run the disproof first. If it survives, the hypothesis is real. If it dies, you saved time chasing a phantom.
The hypothesis is wrong or incomplete. Walk the ledger, refine or discard it, and generate new candidates. Never commit to a hypothesis that fails any prior breadcrumb.
No. Do not propose a fix before step 1 (reliable repro exists), do not test hypotheses before step 2 (fail path narrowed), do not commit to a hypothesis before step 3 (disproof attempted), and do not declare it correct before step 4 (ledger confirms it).
Full instructions (SKILL.md)
Source of truth, from thananon/9arm-skills.
name: debug-mantra description: Four-mantra debugging discipline — reproduce, trace the fail path, falsify the hypothesis, cross-reference every breadcrumb. Recite the mantra block verbatim at the start of any debugging session, then apply the four steps in order before proposing any fix. Trigger on /debug-mantra and proactively whenever debugging starts — user reports a bug, says something is broken/throwing/failing, asks to debug/diagnose/investigate an issue, or pastes a stack trace or error log.
Debug Mantra
Four-step discipline for any debug session. Recite verbatim, then apply in order.
Recite this — verbatim, as the first thing in your first response
Mantra:
- First is reproducibility. Can the issue be reproduced reliably?
- Know the fail path. Debugger first; then source trace + knob enumeration; then in-code instrumentation.
- Question your hypothesis. What would disprove it?
- Every run is a breadcrumb. Cross-reference all of them.
Then begin work.
1. Reproduce reliably
Build a runnable repro before anything else.
- Reliable repro → capture the exact steps, inputs, and environment as a runnable artifact: failing test, curl script, CLI invocation, replay harness.
- Flaky repro → the bug is not yet debuggable. Raise the rate first: loop the trigger, parallelise, add stress, narrow timing windows, inject sleeps. 50% flake is debuggable; 1% is not.
- No repro at all → stop. Say so explicitly. Ask the user for env access, captured artifacts (HAR, log dump, core), or permission to instrument. Do not proceed to hypothesise.
Target: a fast (1–5 s), deterministic pass/fail signal. Pin time, seed the RNG, freeze network, isolate filesystem.
2. Know the fail path
Once reproducible, find where the code breaks and what stops it from breaking. The differential narrows the search. Try in this order — escalate only when the prior tactic fails.
- Attach a debugger. If the env supports it, attach and step to the failure site. One breakpoint beats ten logs. Do this before turning any knobs.
- Source trace + knob enumeration. If no debugger (or it can't reach the bug), trace the code path end-to-end and list every knob that can influence the outcome:
- config flags, env vars, feature toggles
- branch conditions, input shape
- timing, concurrency, build options Each knob is a candidate axis to flip in the differential. Flip one at a time.
- In-code instrumentation. If outside knobs can't move the failure, go inside:
printf/ log statements at the suspected fail site, dump the relevant internal state. Tag every probe with a unique prefix (e.g.[DBG-a4f2]) so cleanup is a single grep. Let the trace show where reality diverges from your model.
3. Falsify the hypothesis
When a candidate root cause surfaces, scrutinise it before testing it.
- Does it actually explain the symptom end-to-end? Walk it through.
- What is the simplest proof? What is the cleanest disproof?
- Run the disproof first. If the hypothesis survives, it's real. If it dies, you saved yourself from chasing a phantom.
- Generate 3–5 ranked hypotheses, not one. Single-hypothesis thinking anchors on the first plausible idea.
4. Every run is a breadcrumb
Maintain a running ledger of every experiment in this session. Each entry: what changed, what happened, what it ruled in or out.
- When a new hypothesis surfaces, walk the ledger. Does it hold for every prior observation, not just the most recent?
- If any past run contradicts it, the hypothesis is wrong or incomplete — refine or discard.
- When in doubt, design the single experiment whose outcome makes it certain. Run that next, instead of churning on adjacent runs.
- Update the ledger after every run. It is your memory across the session.
Operating rules
- Recite the mantra block once per debug session, in your first response. Do not re-recite mid-session.
- Recite verbatim. Never paraphrase, shorten, or skip lines of the recital.
- If the user says "skip the mantra" → skip the recital but still apply the four steps silently.
- Apply the four steps in order:
- Do not propose a fix before #1 is satisfied (reliable repro exists).
- Do not start testing hypotheses before #2 has narrowed the fail path.
- Do not commit to a hypothesis before #3 has tried to disprove it.
- Do not declare a hypothesis correct until #4 confirms it against every prior breadcrumb.
- If you catch yourself proposing a fix without a reliable repro, stop and return to step 1.
- The mantra is a constraint you carry through the session — not advice to deliver back to the user.
Related skills
More from thananon/9arm-skills and the wider catalog.

management-talk
Rewrite engineering updates for leadership—shaped for JIRA, Slack, email, standup, or meetings.

post-mortem
Write the canonical engineering record of a fixed bug: root cause, mechanism, fix, validation, and how it slipped through.

qwen-agent
Delegate menial, well-scoped coding tasks to a cheap Qwen-backed subagent via the `claude-9arm` command instead of burning Claude tokens/quota. Use when the work is mechanical and low-risk — bulk renames, formatting, boilerplate, find-replace, grep-style search & summarization, reading/condensing logs or files, test/docstring/comment scaffolding, or running builds/linters/tests and reporting pass-fail. Also use when the user says "use qwen", "delegate this", "send it to 9arm/qwen", or "do this cheaply". Do NOT use for architecture, design, debugging judgment, security-sensitive edits, or anything needing this conversation's context.

qwenchance
Keeps a long Claude Code task on-track — breaks out of looping/circular thinking, watches the context budget, bounds internal reasoning, and triggers a clean handoff before the window fills. Use when the model is repeating steps, re-reading the same files, second-guessing in circles, stuck or spinning, or running a long multi-step task at risk of exhausting context. Also use when the user says it is "looping", "going in circles", "stuck", "repeating itself", or asks for a handoff before running out of context.

scrutinize
Outsider-perspective end-to-end review of plans, PRs, and code changes—questions intent, traces actual execution paths, and verifies claims.

openclaw-backup
Encrypted backup and restore for OpenClaw Agent workspace files with AES-256-CBC encryption.