Debug
Now debug: FULL, COMPREHENSIVE, GRANULAR code audit line by line — verify all intended functionality.
Loop until the end product would satisfy a skeptical Claude Code user who thinks it's impossible to debug with prompting.
Process
- •Read every line of the code under investigation. Do not skim. Do not assume.
- •State what each section does in plain language. If you can't, that's a bug candidate.
- •Trace the actual data flow — inputs, transforms, outputs. Follow the values, not the names.
- •Compare intended vs actual behavior for every branch, edge case, and error path.
- •Check the boundaries: off-by-one, null/empty, type coercion, encoding, concurrency.
- •Verify assumptions: does that API actually return what you think? Does that config actually load? Does that variable actually have scope here?
- •Run it — if you can execute tests or the code itself, do so. Read the actual output. Don't guess.
- •Fix and verify — after each fix, re-run to confirm. One fix at a time.
- •Loop — go back to step 1 on the changed code. Repeat until clean.
Rules
- •Never say "this looks correct" without tracing the actual values.
- •Never assume a function works because its name sounds right.
- •If you're not sure, add a print/log and run it.
- •If tests exist, run them. If they don't, write one for the bug.
- •When you find the bug, explain WHY it happened, not just what to change.