Workflow · Build
Bug to fix
Start with
A bug you can make happen, and what you expected instead.
The steps
- Write down the exact steps that make the bug happen, what you expected and what happened.
- Make a branch, then ask the assistant or coding agent to explain likely causes before changing anything.
- Ask for a test that fails because of the bug, and run it to see it fail.
- Have it make the smallest fix that makes that test pass.
- Run all the tests, try the original steps again, and read the diff yourself.
- Keep the new test so the bug can’t sneak back.
A prompt to start from
Here's a bug. Steps: {steps to make it happen}. Expected: {what should happen}. Actual: {what happens}. Relevant code: {paste code or name the files}. First list the two or three most likely causes and how to check each. Then write a test that fails because of this bug, and only after that suggest the smallest fix.
Fill in the {blanks} with your own words, then send it.
Done when
A test that used to fail now passes, the other tests still pass, and the original steps no longer show the bug.
Works best for
Bugs you can reproduce, in code you’re allowed to change.
Watch out for
A fix that silences the error without a failing test first may just hide the bug somewhere else.