Debug Investigate
Scientific method debugging with a persistent eliminated-hypotheses log. Prevents the #1 AI debugging failure: re-testing disproven theories across context resets.
How It Works
- Why is this failing?: A bug or failure to root-cause; --continue resumes
- Init persistent debug file: .debug/{slug}.md — immutable symptoms, append-only Eliminated log
- Gather evidence first: Full error · codebase search · git log · tests — before any hypothesis
- Form falsifiable hypotheses: Specific + testable; anti-bias check (confirmation · anchoring · sunk cost)
- Test one hypothesis at a time: One experiment each; never re-test the Eliminated section
- Fix, verify, post-mortem: Targeted test + full suite, mark resolved, write lessons.md entry
- Resolved + elimination log: Root cause recorded; dead ends survive context resets
Invocation Triggers
/debug-investigatedebuginvestigateroot causewhy is this failingUse Cases
- Investigate a production bug with a structured methodology
- Resume a debugging session across context resets without repeating dead ends
- Debug a failing CI test with systematic hypothesis elimination
The Problem
The #1 AI debugging failure isn't wrong hypotheses — it's re-testing the ones you already eliminated. Context resets, long sessions, multiple agents: without a log, you circle the same dead ends indefinitely. The scientific method works. The problem is that nothing enforces it. This skill creates a persistent debug file that makes eliminated hypotheses append-only and session-proof.
What It Does
- 1Initialize the debug file
Creates `.debug/{slug}.md` in the project root with immutable Symptoms, a Current Focus field (overwritten before every action), an append-only Eliminated section, and an Evidence Log. If `--continue` is passed, reads the existing file instead.
- 2Gather evidence before forming hypotheses
Reads the full error, searches the codebase for the exact message, reads the full function (not just the line), checks git log for recent changes, runs tests. All findings go into the Evidence Log before any hypothesis is formed.
- 3Form falsifiable hypotheses
Each hypothesis must be specific and falsifiable — "the auth token expires because the refresh logic uses < instead of <= for the expiry check", not "something is wrong with auth". Anti-bias checklist enforced: confirmation bias, anchoring, sunk cost, recency.
- 4Test one hypothesis at a time
Updates Current Focus before every action. Runs one experiment per hypothesis. CONFIRMED → fix. ELIMINATED → appended to the Eliminated section with evidence reference, then next hypothesis. Never re-tests anything in Eliminated.
- 5Fix, verify, post-mortem
Implements the fix, runs the failing test, runs the full suite. Updates the debug file to resolved. Writes a lessons.md entry with root cause, detection latency, and alerting gap. Checks if a regression test is needed.
What You Get / What It Doesn't Do
- A `.debug/{slug}.md` file that survives context resets and agent handoffs
- Append-only Eliminated section — dead-end hypotheses never get re-tested
- Evidence Log with timestamped action/result pairs
- A post-mortem entry in lessons.md with root cause and alerting gap
- Regression test recommendation if the bug can recur
- Guarantee the bug is found — it structures the search, not the outcome
- Replace logs, metrics, or observability tooling
- Work without symptoms — you need a reproducible failure or error message to start
- Auto-fix — it diagnoses and fixes after confirmation, not speculatively
Tips
Start a new session on the same bug with `/debug-investigate --continue`. It reads the Eliminated section first — that's the whole point. Starting fresh means repeating dead ends.
If the bug is in a multi-step pipeline, test the midpoint. Healthy → bug is downstream. Unhealthy → upstream. Repeat until isolated. Faster than sequential hypothesis testing.
When stuck, write out your Current Focus as a full narrative sentence. "I believe X is happening because Y, and I'm about to test Z." The act of writing it usually surfaces the gap.
Get the Skill
Debug Investigate
The full SKILL.md — copy it into ~/.claude/skills/ and trigger it by name.
Commonly Used With
29 more production skills ready to install.