TDD Cycle
Red-green-refactor test-driven development workflow
CLAUDE.md
When developing with TDD:
- Write a small, focused test that describes the next piece of behavior. Run it — it should fail (red).
- Write the minimum code to make the test pass. Don’t over-engineer — just make it green.
- Run all tests to confirm the new test passes and nothing else broke (green).
- Refactor the implementation for clarity, removing duplication. Keep tests passing throughout.
- Repeat: pick the next behavior, write a failing test, make it pass, refactor.
Do not write implementation code without a failing test first. Do not refactor while tests are red.
Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.