Systematic Debugging
Overview
When LLMs hit failures, they tend to guess at fixes — changing code, re-running, changing more code. This thrashing wastes context and often makes things worse. This skill enforces a four-phase protocol that requires understanding before action. Systematic debugging resolves issues in 15-30 minutes; guess-and-fix typically takes 2-3 hours with a 40% first-attempt success rate vs 95% systematic.
Iron Law
Find root cause before attempting fixes. Symptom fixes are failure. No fixes without root cause investigation first.
Constraints
- Do not change code until you have a root cause hypothesis
- Do not apply more than one fix at a time
- Do not skip the reproduction step — a bug you can't reproduce is a bug you can't verify as fixed
- Do not guess. Investigate.
- After 3+ failed fix attempts, question the architecture — stop patching
The Four Phases
Phase 1: Reproduce
Goal: See the failure with your own eyes (tool output).
- Run the failing test or trigger the error condition
- Read error messages thoroughly — don't skim. Stack traces contain line numbers, file paths, and often the solution.
- Identify the minimal reproduction — strip away everything unrelated
- Determine if the issue is consistent or intermittent
- Gate: paste the reproduction output. If you can't reproduce it, gather more data — don't speculate.
Phase 2: Investigate & Pattern Analysis
Goal: Gather facts and find working reference points.
Investigate (use as many techniques as needed):
- Read the error: Parse the stack trace. What file, line, and function? What's the actual error type?
- Trace the data flow: Follow the input from entry point to failure point. Where does the actual value diverge from the expected value?
- Graph-assisted tracing: prefer CodeGraph/Repowise over hand-walking the codebase to trace the call path from symptom to source — see