Drop in for a virtual coffee, Wednesdays at 5:30pm

Test first

Write the tests, or have AI write them, then let AI iterate until they pass. Good when you can pin the behaviour down up front and want a safety net as you go.

yesnoagainYour testsAI implementsTests pass?Share the failuresDone
This is the Test first box from the diagram at the top, opened up. You write the tests first, the AI implements against them, and every failure goes back until they pass. Then you are done.

Doing this with Claude Code: Test first

Write the test that checks what the user expects of the outcome, and write it first, before the code exists, so the target is set up front. It builds straight on your examples, the 'then' in a Given/When/Then becomes the thing the test checks. Once it exists the test is a rule Claude has to meet, not a suggestion. It runs, it fails, you hand the failures back and Claude keeps trying until it passes. The catch is that it meets exactly what you wrote down and not what you meant, so keep each test concrete and focused or it passes while still being wrong. Drive the coverage yourself, because the happy path is not enough. Ask for the edge cases and the slow paths too, the null, the empty, the huge input, or it tests the obvious case and stops. The suite checks the change now and becomes the net that catches it later when a new change breaks something old.

Test first works when you can pin the behaviour down: set the target up front, make it a rule, drive the coverage, keep each test concrete and let the suite become the net.

The target up front. Write the test before the code so the behaviour is set, the then in a Given, When, Then becomes what the test checks.

A rule, not a suggestion. Once it exists Claude has to meet it, it runs, it fails, you hand back the failures until it passes.

Drive the coverage. The happy path is not enough, ask for the edge cases too, the null, the empty, the huge input.

Keep each test concrete. It meets exactly what you wrote and not what you meant, so a vague test passes while still being wrong.

It becomes the net. The suite checks the change now and catches it later when something new breaks it.

Part of Ways to build it with AI.