| name | systematic-debugging |
| description | Structured methodology for finding root causes before writing fixes |
Methodology from obra/superpowers (MIT)
Systematic Debugging
Core rule: find the root cause before writing any fix.
Phase 1 -- Root Cause Investigation
- Reproduce the bug with the simplest possible input.
- Read the actual error message / stack trace. Do NOT guess.
- Trace the data flow backwards from the failure site to the origin.
- Identify the earliest point where observed behavior diverges from expected.
Phase 2 -- Pattern Analysis
- Search the codebase for similar patterns (same API, same data path).
- Check recent changes (git log, git blame) near the failure site.
- Look for related open issues or past fixes for the same component.
- Note if the bug is deterministic or intermittent -- intermittent implies concurrency, timing, or external state.
Phase 3 -- Hypothesis Testing
- Form exactly one hypothesis at a time.
- Design a minimal experiment that can confirm or refute it.
- Run the experiment. Read the output fully.
- If refuted, discard the hypothesis and return to Phase 1 or 2. Do NOT patch and hope.
Phase 4 -- Implementation
- Write a failing test that demonstrates the root cause.
- Apply the smallest change that makes the test pass.
- Run the full test suite to check for regressions.
- Verify the original reproduction case is resolved.
- Document why the bug happened, not just what you changed.
Anti-patterns to Avoid
- Shotgun debugging: making multiple changes at once.
- Fixing symptoms instead of root causes.
- Claiming "fixed" without re-running the reproduction case.
- Skipping the hypothesis step and jumping straight to code changes.