Debug
Use when facing a bug, test failure, or unexpected behavior that isn't immediately obviousFrom its SKILL.md
npx -y skills add josephneumann/claude-corps --skill debugAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 1 command, including `git log --oneline -10 -- <file>`.
SKILL.md
5.4 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
Systematic Debugging
Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
Phase 1: Reproduce & Isolate
- Reproduce the failure reliably before anything else
- Isolate the smallest failing case
- If you can't reproduce it, you can't fix it
- Record the exact command, input, and output that demonstrates the failure
Phase 2: Gather Evidence
Before forming hypotheses, collect facts:
- Read the actual code path from input to failure point. Don't guess from memory.
- Check recent changes:
git log --oneline -10 -- <file> - Add temporary logging or assertions at key points to trace data flow
- Collect the full error message, stack trace, and relevant log output
- If a stack trace exists, trace backward through the call chain to the origin
Known bug patterns — check these first:
| Pattern | Signature |
|---|---|
| Race condition | Intermittent failure, timing-dependent, works in debugger |
| Nil/null propagation | undefined is not a function, NoMethodError, NoneType |
| State corruption | Works first time, fails on second; stale data after mutation |
| Integration failure | Works in isolation, fails with real dependency (DB, API, queue) |
| Configuration drift | Works locally, fails in CI/staging; env var mismatch |
| Stale cache | Old behavior persists after code change; hard refresh fixes it |
| Off-by-one / boundary | Fails at 0, 1, max, or empty input; pagination edge cases |
If the bug matches a known pattern, state which one and focus investigation there.
Phase 3: Hypothesize & Test
- Form a specific hypothesis: "The root cause is X because evidence Y"
- Predict the outcome BEFORE running each test
- Test one variable at a time
- If your prediction is wrong, update your mental model — don't just try the next thing
"5 Whys" drill-down — when the cause isn't obvious, ask why iteratively:
- Why did the request fail? → The handler returned null
- Why did it return null? → The query returned no rows
- Why did the query return no rows? → The ID was from a different tenant
- Why was the ID from a different tenant? → The session wasn't scoped to tenant
- Why wasn't the session scoped? → Root cause: middleware ordering
Keep asking why until you reach something you can fix directly.
Phase 4: Fix & Verify
- Write a regression test that fails without the fix and passes with it. This is not optional.
- Fix the root cause, not the symptom
- Keep the diff minimal — only change what's needed to fix the bug
- Run the original failing test to confirm the fix
- Run the full test suite to check for regressions
Three-Strikes Rule
If 3 hypotheses have failed, STOP. You are likely wrong about the root cause.
- Go back to Phase 2 and re-read the code path from scratch
- Question your assumptions about the architecture
- Use AskUserQuestion to escalate: describe what you've tried, what you've ruled out, and where you're stuck
- Optionally WebSearch for the error message or pattern — someone may have hit this before
Escalation is not failure. Bad work is worse than no work. Stop guessing.
Red Flags
If you catch yourself thinking any of these, STOP:
- "Let me just try..." — You're guessing, not tracing.
- "Maybe if I..." — Form a hypothesis and predict the outcome first.
- "This might work..." — Why would it work? What's your evidence?
- "It's probably this..." — Probably based on what? State the evidence.
Anti-Rationalization Table
| Excuse | Reality |
|---|---|
| "Let me try a quick fix first" | Quick fixes without root cause analysis create new bugs. |
| "I know what the problem is" | Then state your hypothesis and predict the test outcome. |
| "It works now after my change" | Correlation is not causation. Verify your fix addresses the root cause. |
| "The test is flaky, not my code" | Reproduce it 3 times. If it fails 2/3, it's your code. |
| "I'll add better error handling" | Error handling hides bugs. Fix the cause, not the symptom. |
Debug Report
After resolution, output a structured report:
═══════════════════════════════════════════
DEBUG REPORT
═══════════════════════════════════════════
Status: DONE / DONE_WITH_CONCERNS / BLOCKED
Symptom: [what was observed]
Root Cause: [what was actually wrong]
Pattern: [known pattern match, if any]
Fix: [what was changed and why]
Regression Test: [test name and what it verifies]
Evidence: [how you confirmed the fix addresses the root cause]
Hypotheses Tested: N (list failed ones if >1)
═══════════════════════════════════════════
- DONE — Root cause identified, fix applied, regression test passes, full suite green
- DONE_WITH_CONCERNS — Fixed, but related issues discovered. Note them for follow-up.
- BLOCKED — Cannot resolve. Document what was tried and what's needed to proceed.
If the root cause was non-obvious, save debugging insights to auto-memory.
Evolved from obra/superpowers systematic-debugging skill with patterns from garrytan/gstack and community best practices.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 2 of the 12 instructions most debug triage skills give in ~1.2k tokens
Counted across 1,020 of the 1,639 authors here whose files we hold, read 2026-09-06
- Find root cause before attempting any fixin 134 of 1020, across 118 files
- Create a failing test case before implementing a fixin 109 of 1020, across 95 files
- Read error messages and stack traces completelyin 102 of 1020, across 88 files
- Reproduce the issue consistently before investigatingin 90 of 1020, across 77 files
- Make the smallest possible change to test a hypothesisin 90 of 1020, across 76 files
- Trace data flow backward to find the sourcein 84 of 1020, across 70 files
- Form a single hypothesis before testinghere, and in 78 of 1020, across 64 files
- Implement only one fix at a timein 76 of 1020, across 63 files
- Question the architecture if three fixes failin 73 of 1020, across 59 files
- Add diagnostic instrumentation at component boundariesin 68 of 1020, across 56 files
- Compare broken code against working examplesin 68 of 1020, across 57 files
- Write a regression test before applying the fixhere, and in 62 of 1020, across 55 files
Said here and by no other author read
- Read the actual code path from input to failure
- Keep the diff minimal
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.