Debugging Habit Reset
Move from trace-by-instinct to hypothesis-driven debugging with AI.
Classic debugging often starts with "where should I put the next log?" or "where should I set a breakpoint?" AI-assisted debugging starts with a different question: "Why would this symptom occur?"
The Old Loop
| Tool | Strength | Limit |
|---|---|---|
console.log | Simple and universal | You must guess where to look |
| Debugger | Precise state and call stack | You still choose the path by instinct |
| Manual reading | Builds deep understanding | Slow when the search space is large |
These tools remain useful. The problem is direction. They tell you what happened at a point; they do not rank where to look first.
Hypothesis-Driven Debugging
Debugging Context Template
### Symptom
- Exact error message
- Expected vs actual behavior
### Reproduction
- Environment
- Steps
- Frequency
### Already checked
- Facts confirmed
- Hypotheses ruled out
### Suspected area
- Recent changes
- Related modules
- What feels unusualBad request:
Fix this error:
TypeError: Cannot read property 'map' of undefinedBetter request:
Symptom: User list page throws "Cannot read property 'map' of undefined" only on first load.
Reproduction: after login, direct navigation to /users. Sidebar navigation does not reproduce it.
Checked: users state initializes as [], API returns 200 with array data.
Suspected area: SSR/CSR hydration timing or useEffect ordering.
Relevant files: app/users/page.tsx, hooks/useUsers.ts.
Return likely causes ranked by probability and one verification step for each.What AI Is Good At
- Ranking likely causes from error type and framework patterns.
- Noticing mismatches between server and client assumptions.
- Suggesting quick verification steps.
- Explaining why a symptom appears only under certain conditions.
- Producing a minimal fix after the cause is confirmed.
What Humans Still Own
- Reproducing the bug.
- Confirming facts instead of accepting plausible explanations.
- Choosing the safest fix for the system.
- Adding regression tests.
- Writing the postmortem or runbook when the bug matters.
Debugging Review Checklist
| Check | Question |
|---|---|
| Symptom captured | Is the exact error and expected behavior recorded? |
| Reproduction known | Can another person or agent reproduce it? |
| Hypotheses ranked | Are we checking the most likely cause first? |
| Regression test added | Will this failure be caught next time? |
| Root cause documented | Did we record why the bug happened, not only the patch? |
Next
Read Context Management to improve the quality of the information you give AI.