By the end of this lesson every change your agent makes will follow one loop: tests before, one change, tests after, commit only when green. Your rules file will enforce it, and you will spot an agent that cheats on tests.
You need: your project with unit tests (Lesson 3) and end-to-end tests (Lesson 4), Git save points (Never lose your work), your coding agent · Time: 8 minutes
Tests only protect you if they run every time. Use the same loop for every feature and every fix, however small:
- Tests before: run them. All green means you start from a safe place.
- One change: the agent adds one small feature or one fix.
- Tests after: run them again, and paste the output.
- Red? Fix the code, never the test, and run again. Green? Commit a save point.
Before, change, after, commit. Red means fix the code; green means save. Why?If tests were already red before the change, you cannot tell which failures are new. If you change five things at once, you cannot tell which one broke the test. The loop keeps both questions easy.
Log in free to read the rest of this lesson
Every lesson is free. A free account unlocks all of them and saves your progress.
Still to come in this lesson:
- Put the rule in AGENTS.md
- Ask for evidence, not promises
- Spot an agent that cheats
- Every bug becomes a test
- Recap