tdd-workflow

Solid

Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.

AI & Automation 27,705 stars 2858 forks Updated today MIT

Install

View on GitHub

Quality Score: 96/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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 | 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 | Area | Action | |------|--------| | Duplication | Extract common code | | Naming | Make intent clear | | Structure | Improve organization | | Complexity | Simplify logic | ### REFACTOR Rules - All tests must stay green - Small incremental changes - Commit after each refactor --- ## 6. AAA Pattern Every test follows: | Step | Purpose ...

Details

Author
davila7
Repository
davila7/claude-code-templates
Created
11 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content โ€” not just same category