Workflow Development

TDD Cycle

Red-green-refactor test-driven development workflow

tddtestingdevelopment
CLAUDE.md

When developing with TDD:

  1. Write a small, focused test that describes the next piece of behavior. Run it — it should fail (red).
  2. Write the minimum code to make the test pass. Don’t over-engineer — just make it green.
  3. Run all tests to confirm the new test passes and nothing else broke (green).
  4. Refactor the implementation for clarity, removing duplication. Keep tests passing throughout.
  5. 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.

get crystl