Chapter 4: Reading and debugging

Debugging has the same shape every time, and it starts before anyone looks at the code.

Reproduction

Also called Repro, Steps to reproduce

A set of steps that makes the bug happen, ideally every time. Without one, you can't tell if a change fixed the bug or if it just didn't happen this time. A bug you can't reproduce isn't fixed, only quiet.

Agents like to jump straight to a fix, and an agent that never saw the failure can report success with nothing behind it. Make it produce the failure first, and show you. The best form of this is a failing test.

Say it to your agent

“Reproduce this before you touch the code. Write a failing test in tests/checkout.test.ts using this exact input, run it, and paste the red output. Then fix it and paste the green output.”

The workshop

Name a word, or describe what you mean in everyday language.