tdd-workflow

Featured

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

AI & Automation 39,350 stars 6386 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/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
sickn33
Repository
sickn33/antigravity-awesome-skills
Created
4 months ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category