From Dev Workflows
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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dev-workflows:debug-mantraThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Four-step discipline for any debug session. Recite verbatim, then apply in order.
Four-step discipline for any debug session. Recite verbatim, then apply in order.
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; then production telemetry (ask first).
- Question your hypothesis. What would disprove it?
- Every run is a breadcrumb. Cross-reference all of them.
Then, in that same first response, emit this process diagram verbatim inside a fenced code block — it is fixed text, part of the recital; do not re-author, paraphrase, or reflow it:
DEBUG MANTRA — four steps, strictly in order
─────────────────────────────────────────────
① REPRODUCE
│ reliable repro? · flaky → raise the rate
│ no repro at all → ■ STOP (don't hypothesise)
│ got repro? → what changed? git diff / blame / bisect
▼
② FAIL PATH (escalate only when the prior fails)
│ 1. attach a debugger
│ 2. source trace + knob enumeration
│ 3. in-code instrumentation
│ 4. production telemetry / logs - ask the user first
▼
③ FALSIFY
│ 3–5 ranked hypotheses · run the DISPROOF first
▼
④ BREADCRUMBS
│ ledger every run · cross-reference all of them
│
└─▶ contradiction with a past run? ── back to ③
Then begin work.
Build a runnable repro before anything else.
Target: a fast (1–5 s), deterministic pass/fail signal. Pin time, seed the RNG, freeze network, isolate filesystem.
Once a reliable repro exists, ask what changed. Most bugs are regressions — git log / diff / blame the suspect area, and if the repro is scriptable, git bisect it against that pass/fail signal to pin the exact commit. The offending diff is often the whole answer.
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:
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.
Production telemetry / log stores — ask first. For a deployed system that emits telemetry (Application Insights / Log Analytics, centralised logs, an error tracker, APM traces), captured exceptions, failed dependencies, and request/result-code history are strong fail-path evidence — and often a reproduction substitute for intermittent or slow ("after an hour", "only in prod") bugs. But do NOT jump straight to it or silently query external log stores: run the normal tactics above first, then ask the user whether to go look at the logs — it is their system, their cost, their call. Query only once they say yes.
When a candidate root cause surfaces, scrutinise it before testing it.
Maintain a running ledger of every experiment in this session. Each entry: what changed, what happened, what it ruled in or out.
This skill follows the terminal-diagram convention — canonical wording in
${CLAUDE_PLUGIN_ROOT}/references/diagram-convention.md.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
npx claudepluginhub thodsaphonsonthiphin/workflow-daily-work --plugin dev-workflows