← Back to Skill Library
💻 Software Dev

Test-Driven Development

★★★★★v1.3.0★ Featured

Red-Green-Refactor TDD cycle. Write tests before code, make them pass, then refactor. Enforces test-first discipline.

skill_view("test-driven-development")

📖 Guide

Load with skill_view("test-driven-development"). Strict RED-GREEN-REFACTOR cycle: write failing test first → implement minimal code to pass → refactor while keeping tests green.

🔧 How To

RED: write a test that captures the desired behavior (will fail). GREEN: write just enough code to pass. REFACTOR: clean up while tests stay green. Repeat for each feature increment.

⚠️ Pitfalls

Harder for UI/visual components. Tests for trivial code add maintenance burden. Mock external dependencies to avoid flaky tests.

Related Skills

More skills in Software Dev