Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when encountering any bug, test failure, or unexpected behavior. 4-phase root cause investigation — NO fixes without understanding the problem first.
.claude/skills/graniet-systematic-debugging/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-12 | ✗→✓ | ▲ Improved | 82% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 91% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 123% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 87% | 0% |
| case-20 | ✗→✓ | ▲ Improved | 64% | 0% |
This skill is repo-local and stays inactive until explicitly activated.
When the original instructions refer to legacy tool names, use these Kheish mappings:
terminal => bashweb_extract => web_fetch, plus web_search when discovery is neededsearch_files => grep_search and glob_searchbrowser_* tools require a browser-capable surfaced tool or MCP; if none is available, use the closest available surface and say so explicitlyWhen the instructions mention local helper files, resolve them from ${KHEISH_SKILL_DIR}.
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.
Violating the letter of this process is violating the spirit of debugging.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRSTIf you haven't completed Phase 1, you cannot propose fixes.
Use for ANY technical issue:
Use this ESPECIALLY when:
Don't skip 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 search_files to find the error string in the codebase.
Action: Use the terminal tool to run the failing test or trigger the bug:
bash# Run specific failing test pytest tests/test_module.py::test_name -v # Run with verbose output pytest tests/test_module.py -v --tb=long
Action:
bash# Recent commits git log --oneline -10 # Uncommitted changes git diff # Changes in specific file git log -p --follow src/problematic_file.py | head -100
WHEN system has multiple components (API → service → database, CI → build → deploy):
BEFORE proposing fixes, add diagnostic instrumentation:
For EACH component boundary:
Run once to gather evidence showing WHERE it breaks. THEN analyze evidence to identify the failing component. THEN investigate that specific component.
WHEN error is deep in the call stack:
Action: Use search_files to trace references:
python# Find where the function is called search_files("function_name(", path="src/", file_glob="*.py") # Find where the variable is set search_files("variable_name\\s*=", path="src/", file_glob="*.py")
STOP: Do not proceed to Phase 2 until you understand WHY it's happening.
Find the pattern before fixing:
Action: Use search_files to find comparable patterns:
pythonsearch_files("similar_pattern", path="src/", file_glob="*.py")
Scientific method:
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.
This is NOT a failed hypothesis — this is a wrong architecture.
If you catch yourself thinking:
ALL of these mean: STOP. Return to Phase 1.
If 3+ fixes failed: Question the architecture (Phase 4 step 5).
| 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. | | "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. | | "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, don't fix again. |
| 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 |
Use these Kheish tools during Phase 1:
search_files — Find error strings, trace function calls, locate patternsread_file — Read source code with line numbers for precise analysisterminal — Run tests, check git history, reproduce bugsweb_search/web_extract — Research error messages, library docsFor complex multi-component debugging, dispatch investigation subagents:
pythondelegate_task( goal="Investigate why [specific test/behavior] fails", context=""" Follow systematic-debugging skill: 1. Read the error message carefully 2. Reproduce the issue 3. Trace the data flow to find root cause 4. Report findings — do NOT fix yet Error: [paste full error] File: [path to failing code] Test command: [exact command] """, toolsets=['terminal', 'file'] )
When fixing bugs:
From debugging sessions:
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→fail | 4,008 | 5,846 | +46% | 1 | 1 | 0% | 253 | 3,019 | +1093% | 0 | 0 | — |
case-06 | pass→fail | 17,823 | 3,666 | -79% | 1 | 1 | 0% | 4,049 | 2,963 | -27% | 0 | 0 | — |
case-07 | pass→pass | 12,288 | 6,831 | -44% | 1 | 1 | 0% | 1,916 | 3,797 | +98% | 0 | 0 | — |
case-08 | pass→pass | 11,808 | 8,646 | -27% | 1 | 1 | 0% | 2,001 | 4,165 | +108% | 0 | 0 | — |
case-09 | pass→pass | 16,215 | 13,550 | -16% | 1 | 1 | 0% | 2,632 | 4,884 | +86% | 0 | 0 | — |
case-02 | pass→fail | 28,147 | 4,157 | -85% | 1 | 1 | 0% | 5,536 | 2,889 | -48% | 0 | 0 | — |
case-03 | fail→fail | 3,570 | 5,491 | +54% | 1 | 1 | 0% | 242 | 3,020 | +1148% | 0 | 0 | — |
case-04 | pass→pass | 22,853 | 24,568 | +8% | 1 | 1 | 0% | 4,793 | 8,073 | +68% | 0 | 0 | — |
case-05 | fail→fail | 2,356 | 22,801 | +868% | 1 | 1 | 0% | 384 | 2,954 | +669% | 0 | 0 | — |
case-10 | pass→pass | 10,180 | 10,755 | +6% | 1 | 1 | 0% | 1,971 | 4,653 | +136% | 0 | 0 | — |
case-11 | pass→pass | 15,640 | 8,999 | -42% | 1 | 1 | 0% | 2,491 | 4,029 | +62% | 0 | 0 | — |
case-12 | fail→pass | 13,909 | 11,181 | -20% | 1 | 1 | 0% | 2,512 | 4,567 | +82% | 0 | 0 | — |
case-13 | fail→pass | 12,339 | 5,514 | -55% | 1 | 1 | 0% | 1,868 | 3,573 | +91% | 0 | 0 | — |
case-14 | pass→pass | 9,736 | 5,581 | -43% | 1 | 1 | 0% | 1,505 | 3,552 | +136% | 0 | 0 | — |
case-15 | pass→pass | 12,583 | 9,101 | -28% | 1 | 1 | 0% | 2,090 | 4,168 | +99% | 0 | 0 | — |
case-16 | pass→pass | 10,245 | 4,511 | -56% | 1 | 1 | 0% | 1,594 | 3,436 | +116% | 0 | 0 | — |
case-17 | fail→fail | 13,675 | 6,893 | -50% | 1 | 1 | 0% | 2,031 | 3,929 | +93% | 0 | 0 | — |
case-18 | fail→pass | 8,181 | 3,345 | -59% | 1 | 1 | 0% | 1,459 | 3,254 | +123% | 0 | 0 | — |
case-19 | fail→pass | 12,707 | 7,505 | -41% | 1 | 1 | 0% | 2,097 | 3,931 | +87% | 0 | 0 | — |
case-20 | fail→pass | 14,944 | 7,811 | -48% | 1 | 1 | 0% | 2,472 | 4,062 | +64% | 0 | 0 | — |
case-21 | fail→pass | 9,929 | 3,592 | -64% | 1 | 1 | 0% | 1,608 | 3,291 | +105% | 0 | 0 | — |
case-22 | pass→pass | 6,963 | 7,090 | +2% | 1 | 1 | 0% | 1,292 | 3,762 | +191% | 0 | 0 | — |
case-23 | pass→pass | 13,306 | 5,073 | -62% | 1 | 1 | 0% | 1,944 | 3,517 | +81% | 0 | 0 | — |
case-24 | fail→pass | 9,920 | 5,935 | -40% | 1 | 1 | 0% | 1,732 | 3,633 | +110% | 0 | 0 | — |
case-25 | pass→pass | 12,710 | 7,815 | -39% | 1 | 1 | 0% | 1,967 | 4,044 | +106% | 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. 25 cases were attempted, and 20 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 +20 percentage points is the difference between those two pass rates over the 20 comparable cases. 3 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.