A debugging checklist
Work through these in order. Skipping straight to "fix it" is what sends the AI in circles.
- Reproduce it reliably. Find the exact steps that make the bug happen every time. A bug you can't reproduce is one you can't confirm you fixed — you'll only ever be guessing whether it's gone. If it happens intermittently, hunt for the variable that flips it: a specific input, a logged-in versus logged-out state, a slow network.
- Read the actual error. Don't skim. The error message and the top of the stack trace usually name the file and line where things went wrong. Beginners often scroll past the most useful sentence on the screen because it looks intimidating.
- Gather the context. Collect the error text, the stack trace, the relevant code, and a one-line description of what you expected.
- Hand the AI the full picture. Paste all of the above in one message. Let it form a hypothesis.
- Form a hypothesis, not a fix. Ask "what could cause this?" before "fix this." A wrong fix on a wrong theory wastes time — and sometimes adds a second bug on top of the first.
- Add logging to test the hypothesis. Confirm what the code is actually doing before changing it.
- Binary-search the problem. Narrow down where it breaks by cutting the suspect area in half repeatedly.
- Fix the root cause, not the symptom. Make sure the fix addresses why it broke, not just the visible glitch.
- Verify the fix and check for regressions. Re-run the reproduction steps. Then make sure nearby features still work — a regression is when a fix quietly breaks something that used to work, like patching one leak and bursting a pipe next to it.
That checklist is really one loop you ride until the bug is gone. Each box hands evidence to the next, and a failed verify just sends you back around with what you learned:
┌──────────────┐
│ REPRODUCE │ make it happen every time
└──────┬───────┘
▼
┌──────────────┐
│ READ ERROR + │ what does it actually say?
│ GATHER │ collect trace + code + context
└──────┬───────┘
▼
┌──────────────┐
│ HYPOTHESIS │ "what could cause this?"
└──────┬───────┘
▼
┌──────────────┐
│ CONFIRM w/ │ add a log, get evidence
│ LOGGING │
└──────┬───────┘
wrong│ correct
┌──────┘ guess ▼
│ ┌──────────────┐
│ (new │ FIX root │ not the symptom
│ theory) │ cause │
│ └──────┬───────┘
│ ▼
│ ┌──────────────┐ fails / regression
└────────────┤ VERIFY │──────────┐
│ + regressions│ │
└──────┬───────┘ │
│ passes │
▼ ◀───────┘
✔ DONE (loop back around)
The order is not arbitrary. Each step produces the evidence the next step needs. Reproduce gives you something to read; reading gives you context to gather; context gives the AI something to hypothesize about. Skip a step and you're feeding the next one a hole.