Coding with AI tools

Stage 6 of 10 · 6 lessons · ~2 weeks

Debugging with AI

Use AI to find causes rather than hide symptoms: reproduce first, shrink the problem, give full evidence, test hypotheses, fix the root cause with a regression test and keep using the real debugger.

Start: Reproduce, then shrink the problem

Lessons· one lesson for each topic, in this order

  1. 1Reproduce, then shrink the problem
  2. 2Giving the tool full evidence
  3. 3Hypotheses before fixes
  4. 4Symptom patches versus root causes
  5. 5Using the real debugger
  6. 6Learning from every bugOptional

Do this

  • Reproduce a bug reliably before asking for help.
  • Shrink one bug to a minimal example.
  • Ask for ranked hypotheses and test at least two before changing code.
  • Reject one symptom patch and find the root cause instead.
  • Fix a bug using breakpoints in your editor's debugger.
  • Keep a regression test and a two-line note for every bug you fix.

Start with

Keep handy

Also worth your time

Before moving on: Three real bugs fixed with your tool where you reproduced first, tested hypotheses, found the root cause with evidence, used the debugger at least once, and left a regression test and a short note for each.

Tauseef's advice
Try Debug mode on a bug you can reproduce but cannot explain: it forms hypotheses, instruments the code and asks you to reproduce, which is exactly the method this stage teaches. Read its hypotheses before its fix, and check it removed every log line afterwards.

Mark this stage as not done?