← ClaudeAtlas

tddlisted

Enforce Red-Green-Refactor cycle for a feature. Write the failing test first, then minimal implementation, then refactor with tests green.
joymin5655/Agent · ★ 1 · Testing & QA · score 77
Install: claude install-skill joymin5655/Agent
# /tdd ## Goal Force the discipline of writing the test before the code. Three phases: Red (failing test) → Green (minimal impl) → Refactor (with tests green). ## Phase 1 — Red 1. **Understand the feature/bug.** - One observable behavior, named. - Acceptance criteria from `rules/policy/strong-goal-template.md`. 2. **Write the failing test.** - One test per observable behavior. Don't pack multiple assertions into one test unless they're the same behavior. - AAA pattern: Arrange, Act, Assert. - Name the test so it documents the intent (`when_input_is_empty__should_return_error`). 3. **Run the test. Confirm it fails for the expected reason.** - Failure message must match what the spec demands (e.g., `AssertionError: expected ValueError`, not `ModuleNotFoundError: foo`). - If the failure is unrelated (import error, syntax error), fix that first and re-run before moving on. ## Phase 2 — Green 1. **Write the minimum code that makes the test pass.** - No extra features. No optimisation. No abstraction. - "Make it work, then make it right." 2. **Run the test. Confirm green.** - If still red, the impl is wrong. Don't change the test to match. 3. **Run the full test suite for that module.** - Make sure you didn't break anything else. ## Phase 3 — Refactor 1. **With tests green, refactor for clarity / dedup / structure.** - Each refactor step: small change, run tests, confirm green. - If a refactor breaks tests, the