test-driven-development

Enforce red-green-refactor workflow with failing tests before implementation.

2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/Clay-HHK/claude-config --skill test-driven-development-clay-hhk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Clay-HHK/claude-config/tree/main/skills/superpowers/test-driven-development
Command: npx skills add https://github.com/Clay-HHK/claude-config --skill test-driven-development-clay-hhk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Test-Driven Development (TDD) prevents untested production code by forcing developers to specify behavior with failing tests before writing implementation, reducing regressions and design drift.

Core Features & Use Cases

  • Red-Green-Refactor Workflow: Write a minimal failing test, implement the smallest change to pass, then refactor while keeping tests green.
  • Verification Checklist: Ensure each new function has a test, watch tests fail for the expected reason, minimize mocks, and confirm all tests pass cleanly after each change.
  • Use Case: Adding a new feature or fixing a bug where you need confidence the behavior is specified, reproducible, and protected from future regressions.

Quick Start

Write a failing unit test that demonstrates the desired behavior, run it to confirm it fails for the expected reason, implement the minimal code to make it pass, and then refactor while keeping tests green.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
What is test-driven development and how does the red-green-refactor workflow work?

Test-driven development enforces writing a minimal failing test before implementation. The red-green-refactor workflow involves writing a failing test, implementing the smallest code change to pass it, then refactoring while keeping tests green to prevent regressions.

How do I start writing unit tests first for a new feature or bug fix?

To start test-first development, write a failing unit test demonstrating the desired behavior, run it to confirm it fails for the expected reason, implement minimal code to pass, and refactor while keeping tests green.

When should I use test-driven development for refactoring existing code?

Use test-driven development during refactors, feature additions, and behavior changes when you need confidence that behavior is specified, reproducible, and protected from future regressions by automated tests driving implementation.

Do I need to minimize mocking when writing failing tests before implementation?

Yes, test-driven development requires tests that exercise real code with minimal mocking. You must verify each failing test fails for the expected reason before coding to ensure behavior-driven development.

What's the difference between test-first development and writing tests after implementation?

Test-first development forces you to specify behavior with failing tests before writing implementation, reducing design drift and preventing untested production code. Writing tests after implementation lacks the iterative verification that drives behavior-driven development.