Test-driven development is older than coding agents by decades. Martin Fowler describes it as a technique Kent Beck developed in the late 1990s as part of Extreme Programming, built on three steps repeated in a loop: write a test for the next bit of functionality, write code until the test passes, then refactor both old and new code (Martin Fowler). The steps are often called red, green, refactor.
The technique fits agents unusually well. An agent works best when it can check its own progress, and a failing test is a check it can run on its own as many times as it needs. Steve Kinney puts it simply in his course material: an agent "is strongest when the definition of done is executable" (Steve Kinney).
Fowler names two benefits of writing the test first, and both carry over. The first is self-testing code, because functional code only exists in response to a test. The second is that writing the test first "forces us to think about the interface to the code first." With an agent, that second benefit moves to the human. When you write or approve the tests, you decide the interface and the behavior, and the agent fills in the implementation.
There is also a cost argument. The traditional complaint about TDD is the time spent writing tests up front, as Builder.io's guide notes (Builder.io). An agent writes test code quickly, so most of that cost goes away. What remains is the thinking about which cases matter, and that is the part worth a human's time.



