Debug
Systematic 7-step debugging. Don't guess — trace.
Steps
- Reproduce — get a minimal, reliable reproduction
- Locate — find the exact file, line, and call path where it breaks
- Hypothesize — list 2-3 competing explanations
- Evidence — for each hypothesis: what would confirm or rule it out
- Test — run the fastest confirming/ruling test first
- Fix — change exactly what the evidence points to
- Verify — confirm fix resolves the issue, run full test suite
Rules
- Never change code before you know the root cause
- Read the actual error message — don't skim it
- Check assumptions: is the value what you think it is? Add a log
- Distinguish "symptom" from "cause" — fix the cause
- If stuck after 3 hypotheses, add instrumentation before guessing more
Output
Root cause: <one sentence>
Location: <file>:<line>
Fix: <what to change and why>