← Brakes: coding with AI agents

Brakes: coding with AI agents · Part 3

Don't prompt it. Show it a failing test.

· by Tony Tang

Prompt "add discount codes" and the agent writes eighty lines; the only way to know if it handles a discount bigger than the total is to read all eighty. Flip it: write the question as a test first, total never below zero, and prompt "make it pass". The agent tries seven times, you read one test. A month later another agent's refactor drops a check and the same test goes red in thirty seconds. A test is a prompt that never expires.

Comment below: Do you write the test or the prompt first?

Brakes: a series on the checks that let an AI coding agent go fast without shipping bugs. Every best practice shortens the time between writing a bug and finding it. Brakes are why race cars go fast. All code is real TypeScript on Node 24, typechecked and tested before it went on screen.

More from this series