tdd

Execute test-first development with RED-GREEN-REFACTOR cycles to prevent regressions.

1|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/yknothing/prodcraft --skill tdd-yknothing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/yknothing/prodcraft/tree/main/skills/04-implementation/tdd
Command: npx skills add https://github.com/yknothing/prodcraft --skill tdd-yknothing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing and maintaining robust software requires a safety net that prevents unnoticed regressions. Test-Driven Development (TDD) enforces a process where tests drive the design, ensuring code is written only to satisfy failing, explicit specifications.

Core Features & Use Cases

  • Failing-First cycles: Write a failing test to specify the desired behavior before coding.
  • RED-GREEN-REFACTOR discipline: Iterate from a minimal implementation to a cleaner design with confidence.
  • Regression protection: Maintain a living specification to guard against future changes.

Quick Start

Start by drafting a failing test that captures the next planned task slice, then implement the simplest code that makes the test pass.

Frequently Asked Questions about tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is test-driven development and how does it protect against regressions?

Test-driven development is a workflow requiring a failing test before implementation. It shields code from regressions by treating tests as living specifications, ensuring code is written only to satisfy explicit, failing specifications.

How do I start writing code using the RED-GREEN-REFACTOR cycle?

Start the RED-GREEN-REFACTOR cycle by drafting a failing test that captures the next planned task slice. Then, implement the simplest code that makes the test pass before refactoring to a cleaner design.

Can I apply test-first development to existing brownfield codebases?

Yes, test-first development is widely applicable to both greenfield and brownfield work. It proves contract behavior, safety checks, and coexistence boundaries across discovery through integration phases.

When should I use unit testing to drive software design instead of writing tests after implementation?

Use unit testing to drive design when you need deterministic, traceable quality gates and living specifications. Writing tests first enforces the RED-GREEN-REFACTOR discipline to maintain regression protection.