Coding with AI tools

Stage 5 · Lesson 1 of 6

Tests as the specification

Tests first, so AI output is checked

A test written before the code is a specification you can run. It says exactly what the code must do, in a form that cannot be argued with: it passes or it fails. With an AI tool, that changes everything.

Instead of "done" meaning the tool stopped, done means the tests pass. The tool can run them itself and keep going until they do, and you review evidence instead of claims. Tests written after the code by the same tool tend to describe whatever the code happens to do, including its bugs, which is why the order matters. Start with the behaviour you care about most, written as one clear test.

Common trapasking the tool to write the code and its tests in one go, so both share the same misunderstanding.

A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it

Resources for this stage

Start with· follow one of these

Practise

  • Every exercise ships with tests: practise reading them first, then writing your own extras

Keep handy

Also worth your time

Mark this stage as not done?