4-phase root cause debugging: understand bugs before fixing.
npx skills add https://github.com/HezaoHezao/poirot --skill systematic-debugging
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 FIRST
If 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:
# 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:
git 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:
# 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:
grep -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 skill# 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.
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Use when implementing any feature or bugfix, before writing implementation code
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.
Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental validation including binding assays, expression testing, thermostability measurements, enzyme activity assays, or protein sequence optimization. Also use for submitting experiments via API, tracking experiment status, downloading results, optimizing protein sequences for better expression using computational tools (NetSolP, SoluProt, SolubleMPNN, ESM), or managing protein design workflows with wet-lab validation.
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.
Take hezaohezao/systematic-debugging from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.