← ClaudeAtlas

tdd-patternslisted

Guide test-driven development through the mandatory Red-Green-Refactor cycle (failing test before code), enforce test quality (one behavior per test, real code over mocks, no implementation-detail testing), and enforce test runner discipline (run mode, no watch mode). Use when implementing features or fixing bugs (with `testing.tddMode='enforce'` blocking implementation without a failing test). This skill MUST be consulted because test-first is the primary quality enforcement point; tests that pass on first write are suspect (likely testing the wrong thing).
synaptiai/synapti-marketplace · ★ 5 · Testing & QA · score 70
Install: claude install-skill synaptiai/synapti-marketplace
# TDD Patterns Domain skill for test-driven development: Red-Green-Refactor cycle, test quality, and runner discipline. ## Iron Law **IF YOU DIDN'T WATCH THE TEST FAIL, YOU DON'T KNOW IF IT TESTS THE RIGHT THING.** A test that has never failed might pass for the wrong reason. The RED phase exists to prove the test is valid. ## Red-Green-Refactor Cycle For each feature or fix, track the TDD cycle with tasks: ``` TaskCreate("RED: Write failing test for {behavior}", "Minimal test describing desired behavior. MUST fail on first run.") TaskCreate("GREEN: Implement {behavior}", "Simplest code to make the test pass. No cleverness.") TaskCreate("REFACTOR: Clean up {behavior}", "Improve quality. All tests must still pass after each step.") ``` ### RED: Write a Failing Test TaskUpdate(RED task, status: "in_progress") 1. Write the **minimal** test that describes the desired behavior 2. Run it — it MUST fail 3. Verify it fails for the **right reason** (not a syntax error, not wrong import) TaskUpdate(RED task, status: "completed") ### GREEN: Make It Pass TaskUpdate(GREEN task, status: "in_progress") 1. Write the **simplest** code that makes the test pass 2. No cleverness. No optimization. No "while I'm here" improvements. 3. Run the test — it MUST pass now TaskUpdate(GREEN task, status: "completed") ### REFACTOR: Clean Up TaskUpdate(REFACTOR task, status: "in_progress") 1. Improve code quality (naming, structure, duplication) 2. Run ALL tests after each refactor step —