Install any skill in seconds. Free to start, no credit card required.
Get Started Free →4-phase root cause debugging: understand bugs before fixing.
.claude/skills/hezaohezao-systematic-debugging/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 909% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 160% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 83% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 70% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 28% | 0% |
Random fixes waste time and create new bugs. Quick patches mask underlying issues.
Core principle: ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRSTIf you haven't completed Phase 1, you cannot propose fixes.
The feedback loop is the debugging work. Before reading code to build a theory, create or identify a tight command that can go red on the user's exact symptom and green when the bug is fixed. A tight loop is fast, deterministic, agent-runnable, and specific enough to catch this bug — not merely "doesn't crash".
When a clean repro is hard, spend disproportionate effort building the loop.
Use for ANY technical issue: test failures, bugs in production, unexpected behavior, performance problems, build failures, integration issues.
Use ESPECIALLY when:
You MUST complete each phase before proceeding to the next.
BEFORE attempting ANY fix:
Action: Use read_file on the relevant source files. Use bash with grep to find the error string in the codebase.
Ways to construct a loop — try in roughly this order:
git bisect run.Tighten the loop once it exists: make it faster, make the signal sharper (assert the exact symptom), make it more deterministic (pin time, seed randomness, isolate filesystem).
For non-deterministic bugs, the immediate goal is a higher reproduction rate, not perfection. Run the trigger 100x, parallelize, add stress, narrow timing windows. A 50% flake is debuggable; a 1% flake usually is not.
Action: Use bash to run the tight loop:
bash# Run a specific failing test pytest tests/test_module.py::test_name -v # Or run a scripted repro python scripts/repro_bug.py # Or run a high-repetition flaky repro for i in {1..100}; do pytest tests/test_flake.py::test_name -q || break; done
Action:
bashgit log --oneline -10 git diff git log -p --follow src/problematic_file.py | head -100
WHEN system has multiple components (API → service → database, CI → build → deploy):
For EACH component boundary:
Run once to gather evidence showing WHERE it breaks. THEN analyze. THEN investigate that specific component.
WHEN error is deep in the call stack:
Action: Use bash with grep to trace references:
bash# Find where the function is called grep -rn "function_name(" src/ --include="*.py" # Find where the variable is set grep -rnE "variable_name\s*=" src/ --include="*.py"
STOP: Do not proceed to Phase 2 until you understand WHY it's happening.
Find the pattern before fixing:
Once the loop is red, shrink the repro to the smallest scenario that still goes red. Cut inputs, callers, config, data, and steps one at a time, re-running the loop after each cut. Keep only what is load-bearing for the failure.
A minimal repro narrows the hypothesis space and often becomes the cleanest regression test.
Action: Use bash with grep:
bashgrep -rn "similar_pattern" src/ --include="*.py"
Scientific method:
or observing Y should make Z happen."
If the user is present, show the ranked list before testing. They may have domain knowledge that instantly re-ranks it.
[DEBUG-a4f2] so cleanup is a single search.
Fix the root cause, not the symptom:
test-driven-development skillbash# Run the specific regression test pytest tests/test_module.py::test_regression -v # Run full suite — no regressions pytest tests/ -q
Pattern indicating an architectural problem:
STOP and question fundamentals:
Discuss with the user before attempting more fixes.
If you catch yourself thinking:
ALL of these mean: STOP. Return to Phase 1.
| Excuse | Reality | |--------|---------| | "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. | | "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. | | "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. | | "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. | | "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. | | "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. | | "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question the pattern. |
| Phase | Key Activities | Success Criteria | |-------|---------------|------------------| | 1. Root Cause | Read errors, reproduce, check changes, gather evidence, trace data flow | Understand WHAT and WHY | | 2. Pattern | Find working examples, compare, identify differences | Know what's different | | 3. Hypothesis | Form theory, test minimally, one variable at a time | Confirmed or new hypothesis | | 4. Implementation | Create regression test, fix root cause, verify | Bug resolved, all tests pass |
No shortcuts. No guessing. Systematic always wins.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 8,850 | 10,304 | +16% | 1 | 1 | 0% | 313 | 3,159 | +909% | 0 | 0 | — |
case-02 | fail→fail | 46,036 | 40,527 | -12% | 1 | 1 | 0% | 6,936 | 8,734 | +26% | 0 | 0 | — |
case-03 | fail→fail | 76,374 | 70,981 | -7% | 1 | 1 | 0% | 8,250 | 2,886 | -65% | 0 | 0 | — |
case-04 | fail→fail | 19,368 | 106,223 | +448% | 1 | 1 | 0% | 2,171 | 2,917 | +34% | 0 | 0 | — |
case-05 | fail→fail | 3,244 | 5,673 | +75% | 1 | 1 | 0% | 273 | 2,918 | +969% | 0 | 0 | — |
case-06 | fail→pass | 10,237 | 8,073 | -21% | 1 | 1 | 0% | 1,445 | 3,762 | +160% | 0 | 0 | — |
case-07 | pass→pass | 18,415 | 10,040 | -45% | 1 | 1 | 0% | 2,672 | 4,103 | +54% | 0 | 0 | — |
case-08 | fail→pass | 15,280 | 24,703 | +62% | 1 | 1 | 0% | 2,460 | 4,506 | +83% | 0 | 0 | — |
case-09 | fail→fail | 13,505 | 10,034 | -26% | 1 | 1 | 0% | 2,083 | 3,327 | +60% | 0 | 0 | — |
case-10 | fail→fail | 9,128 | 10,222 | +12% | 1 | 1 | 0% | 1,611 | 4,027 | +150% | 0 | 0 | — |
case-11 | fail→pass | 14,537 | 8,714 | -40% | 1 | 1 | 0% | 2,311 | 3,921 | +70% | 0 | 0 | — |
case-12 | pass→pass | 17,285 | 12,618 | -27% | 1 | 1 | 0% | 2,463 | 4,611 | +87% | 0 | 0 | — |
case-13 | pass→pass | 11,873 | 9,164 | -23% | 1 | 1 | 0% | 1,673 | 3,998 | +139% | 0 | 0 | — |
case-14 | fail→pass | 17,669 | 14,830 | -16% | 1 | 1 | 0% | 3,075 | 3,930 | +28% | 0 | 0 | — |
case-15 | pass→pass | 10,870 | 6,417 | -41% | 1 | 1 | 0% | 1,749 | 3,699 | +111% | 0 | 0 | — |
case-16 | pass→fail | 13,443 | 9,095 | -32% | 1 | 1 | 0% | 1,869 | 4,084 | +119% | 0 | 0 | — |
case-17 | fail→fail | 24,474 | 5,373 | -78% | 1 | 1 | 0% | 1,980 | 3,469 | +75% | 0 | 0 | — |
case-18 | fail→fail | 9,947 | 9,834 | -1% | 1 | 1 | 0% | 1,471 | 3,926 | +167% | 0 | 0 | — |
case-19 | fail→pass | 12,487 | 8,310 | -33% | 1 | 1 | 0% | 1,678 | 3,727 | +122% | 0 | 0 | — |
case-20 | fail→fail | 13,387 | 9,848 | -26% | 1 | 1 | 0% | 2,007 | 4,011 | +100% | 0 | 0 | — |
case-21 | pass→pass | 13,207 | 10,452 | -21% | 1 | 1 | 0% | 1,972 | 4,160 | +111% | 0 | 0 | — |
case-22 | fail→pass | 12,193 | 10,254 | -16% | 1 | 1 | 0% | 1,811 | 4,100 | +126% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 17 counted toward the lift figure. The other 5 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +27 percentage points is the difference between those two pass rates over the 17 comparable cases. 4 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.