A straightforward reference for keeping TDD honest. It walks you through the RED-GREEN-REFACTOR cycle with the three laws, the AAA pattern for structuring tests, and clear rules for each phase (write failing test, minimal passing code, then refactor). The tables are dense with practical reminders like prioritizing happy path over edge cases and avoiding implementation testing. The anti-patterns section is the most useful part, calling out common mistakes like skipping the RED phase or writing tests after code. There's an interesting multi-agent pattern at the end for AI-assisted development. This works best as a quick lookup when you're tempted to cut corners or forget why you're writing tests first.

skills.sh installs
290
GitHub stars
33.2K
last updated
Aug 21, 2026

Install

$ npx -y skills add davila7/claude-code-templates --skill tdd-workflow --agent claude-code

Installs into .claude/skills of the current project.

Files

TDD Workflow

Write tests first, code second.


1. The TDD Cycle

πŸ”΄ RED β†’ Write failing test
    ↓
🟒 GREEN β†’ Write minimal code to pass
    ↓
πŸ”΅ REFACTOR β†’ Improve code quality
    ↓
   Repeat...

2. The Three Laws of TDD

  1. Write production code only to make a failing test pass
  2. Write only enough test to demonstrate failure
  3. Write only enough code to make the test pass

3. RED Phase Principles

What to Write

FocusExample
Behavior"should add two numbers"
Edge cases"should handle empty input"
Error states"should throw for invalid data"

RED Phase Rules

  • Test must fail first
  • Test name describes expected behavior
  • One assertion per test (ideally)

4. GREEN Phase Principles

Minimum Code

PrincipleMeaning
YAGNIYou Aren't Gonna Need It
Simplest thingWrite the minimum to pass
No optimizationJust make it work

GREEN Phase Rules

  • Don't write unneeded code
  • Don't optimize yet
  • Pass the test, nothing more

5. REFACTOR Phase Principles

What to Improve

Sponsors

Details

Repository
github.com/davila7/claude-code-templates
Categories
Testing & QA, Code Review & Quality, Automation & Workflows
First seen
Jun 3, 2026

More from davila7/claude-code-templates

All 618
1dhruvanbhalara avatarflutter-testingdhruvanbhalara/skillsDefine testing strategy, test pyramid, and pattern-based conventions (Golden Variants, State Matrix, Interaction Contracts). Use when establishing test architec283skills.sh installs
2dubzzz avatarjavascript-testing-expertdubzzz/fast-checkExpert-level JavaScript testing skill focused on writing high-quality tests that find bugs, serve as documentation, and prevent regressions. Advocates for prope269skills.sh installs
3patricio0312rev avatarintegration-test-builderpatricio0312rev/skillsCreates integration tests for API endpoints with database flows, including test harness setup, fixtures, setup/teardown, database seeding, and CI-friendly strat263skills.sh installs
4patricio0312rev avatarcoverage-strategistpatricio0312rev/skillsDefines ROI-based coverage targets with critical path identification, layer-specific targets, and explicit "don't test this" guidelines. Use for "test coverage"259skills.sh installs
5aiskillstore avatarwebapp-testingaiskillstore/marketplaceToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing br235skills.sh installs
6jezweb avatartesting-libraryjezweb/claude-skillsTest React components with Testing Library patterns. Covers queries (getBy/findBy/queryBy), user-event interactions, async testing (findBy vs waitFor), accessib203skills.sh installs