
Tdd Workflow
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-codeInstalls 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
- Write production code only to make a failing test pass
- Write only enough test to demonstrate failure
- Write only enough code to make the test pass
3. RED Phase Principles
What to Write
| Focus | Example |
|---|---|
| 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
| Principle | Meaning |
|---|---|
| YAGNI | You Aren't Gonna Need It |
| Simplest thing | Write the minimum to pass |
| No optimization | Just 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- Get Available Resources289
- Gwas Database289
- Pubchem Database288
- Railway Status288
- Signup Flow Cro288
- Pyvene Interventions287
- Paywall Upgrade Cro286
- Viral Generator Builder285
- Loki Mode284
- Meeting Insights Analyzer284
- Railway Docs284
- Railway New284
- Onboarding Cro283
- Bioservices282
- Command Creator282
- Hqq Quantization282
- Railway Environment282
- Railway Projects282
- Railway Service282
- Anndata281
- Cocoindex281
- Pdb Database281
- Finishing A Development Branch280
- Railway Templates280