Coding with AI tools

Stage 5 of 10 · 6 lessons · ~2 weeks

Tests first, so AI output is checked

Use tests as the specification and the judge: write the first test yourself, recognise tests that cannot fail, list edge cases, and give the agent a check it must pass and show you.

Start: Tests as the specification

Lessons· one lesson for each topic, in this order

  1. 1Tests as the specification
  2. 2Red, green, refactor with an AI tool
  3. 3Writing the first test yourself
  4. 4Recognising tests that cannot fail
  5. 5Listing edge cases up front
  6. 6Making the agent prove it

Do this

  • Write one feature test-first, watching the first test fail before any code exists.
  • Ask your tool for more test cases and keep only the ones that test real behaviour.
  • Break the code on purpose and confirm at least one test fails.
  • Add the "never edit tests to pass" rule to your instructions file.
  • Make the agent run your checks and paste the output on every task for a week.
  • Try a mutation testing tool on one module and fix one surviving mutant.

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

Before moving on: A feature built test-first with your tool: your own first test, a reviewed set of extra cases, a deliberate break that the suite catches, and agent runs where you saw every test command and its output.

Tauseef's advice
Tests are how you stay in charge of an agent. Without them you are the only check, and you will get tired before it does. Write the first test yourself every time: it is where you decide what the code should do, and it keeps your testing muscles working.

Mark this stage as not done?