Engineering disciplineClaude Code and other supported coding agents

Jesse Vincent (obra) / test-driven-development

Why does test driven development work better with an agent than without one?

Because the failing test is the only thing that proves the agent understood the request.

What to remember

  1. A failing test is a specification the agent cannot talk its way around.
  2. Watch the test fail. An agent that skips to green has usually written a test that cannot fail.
  3. Small cycles are the point. Large ones give the same false confidence as no tests.
  4. It is one skill inside a wider methodology, and works best with writing-plans alongside it.

01What it changes in practice

The hardest problem in agent assisted coding is not capability, it is verification. The agent believes it succeeded, the diff looks reasonable, and nobody has checked anything. A failing test converts belief into a mechanical fact.

It also front loads misunderstandings. If the agent writes a test that asserts the wrong behaviour, you find out in the first minute rather than after a large implementation is built on the misunderstanding.

02Where it disappoints

Tests that assert what the implementation happens to do are worse than no tests, because they lock a defect in place. Read the test, not just the result.

It is also poorly suited to exploration. When you do not yet know what correct looks like, writing the assertion first is guessing with extra steps.

Install and first run

  1. Install superpowers from obra/superpowers, published under MIT.
  2. Insist on seeing the test fail before any implementation is written.
  3. Keep each cycle to one small behaviour, because a large cycle hides which part actually failed.

Questions people actually ask

Why insist on seeing the test fail?
A test that passes before the implementation exists is not testing anything. Watching it fail is the cheapest check available.
Does this slow the agent down?
Per change, yes. Across a week it is usually faster, because it removes the rework caused by unverified changes.
Is it separate from the rest of superpowers?
It is one skill in a larger methodology. It works alone, and works better next to writing-plans and verification-before-completion.

Sources

  1. obra/superpowers on GitHubrepository
  2. Agent skills directory listingdirectory

Machine readable versions of this page