Systematic debugging that applies the scientific method to failures. Use when the user says "debug this", "why is this failing", "help me find the bug", or is stuck on a problem and thrashing without progress.
72
—
Does it follow best practices?
Impact
—
No eval scenarios have been run
Passed
No known issues
Apply the scientific method to software failures. Observe before theorizing. Form hypotheses, design experiments, narrow the cause. Refuse to jump to fixes until the cause is isolated.
Never skip from Observe to Fix. The loop exists because human intuition about bug causes is wrong more often than right.
For a hard bug, this is the skill, everything else is mechanical. Before you hypothesize, build a tight, red-capable feedback loop: one command that drives the actual bug path and goes red on this bug, green once fixed. With it, bisection, hypothesis-testing, and instrumentation all just consume it. Without it, no amount of staring at code will save you. Spend disproportionate effort here, be aggressive, be creative, refuse to give up. See references/feedback-loops.md for the ten ways to construct one, how to tighten it, and what to do with non-deterministic bugs.
Completion criterion, a loop that goes red. Do not proceed to hypotheses until you can name one command you have already run at least once (paste the invocation and its output) that is:
If you catch yourself reading code to build a theory before this command exists, stop, jumping straight to a hypothesis is the exact failure this guards against. Then minimise: shrink the repro to the smallest scenario that still goes red, cutting one element at a time, so Phase 3's hypothesis space is small and the result becomes a clean regression test.
Apply these rules in order. Most debugging failures trace to violating one of the first three.
See references/nine-rules.md for detailed application of each rule.
Before forming any hypothesis:
- What is the exact error message or unexpected behavior?
- When did it start? What changed?
- Does it reproduce consistently?
- What is the smallest reproduction case?List every plausible cause. Rank by:
Start with the most testable, not the most likely. Fast elimination beats slow confirmation.
Each experiment should:
When the cause lives in a large change:
## Bug
[What happened vs what was expected]
## Root Cause
[The specific defect and why it produced this symptom]
## Evidence
[What experiments confirmed this, what was ruled out]
## Fix
[The change and why it addresses the root cause]
## Prevention
[What would catch this earlier next time]Shotgun debugging, Changing multiple things at once hoping something works. You'll never know what fixed it, or if it's actually fixed.
Debugging by coincidence, "It works now" without understanding why. The bug is still there.
The usual suspects, Blaming the framework, the OS, the compiler. It's almost always your code.
Rubber ducking without listening, Explaining the problem but not hearing your own assumptions. Slow down at the part that feels obvious.
Fix and forget, Fixing the symptom without asking why the system allowed this failure in the first place.
A good diagnosis:
/testing: Test failures trigger debugging; debugging reveals missing tests/performance: Performance regressions are bugs; profiling is debugging for speed/review: Reviews catch bugs before they need debugging/improve-codebase-architecture: when the post-mortem shows the bug had no good test seam or was enabled by tangled coupling, hand off the specificsskills/FRAMEWORKS.md: Full framework indexRECIPE.md: Agent recipe for parallel decomposition (2 workers)436824a
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.