Test-Driven Development (TDD)

Guide red-green-refactor TDD cycles for public interface behavior.

13|8|Updated May 8, 2026
One-click install
npx skills add https://github.com/ishandutta2007/Awesome-Claude-Skills --skill test-driven-development-tdd-ishandutta2007
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Test-Driven Development (TDD)
Source: https://github.com/ishandutta2007/Awesome-Claude-Skills/tree/main/skills/tdd
Command: npx skills add https://github.com/ishandutta2007/Awesome-Claude-Skills --skill test-driven-development-tdd-ishandutta2007

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TDD helps you implement features and fix bugs reliably by driving development through behavior-focused tests and a disciplined red-green-refactor workflow.

Core Features & Use Cases

  • Behavior-driven testing: Write tests that verify observable behavior through public interfaces rather than internal implementation details.
  • Red-green incremental loop: Use a one-test-to-one-implementation cycle to reach GREEN before any refactoring.
  • Minimal, safe iteration: Add only the code required to pass the current failing test, then refactor only after tests pass.
  • Vertical slicing approach: Implement and validate behaviors one at a time to avoid building everything at once.

Quick Start

Use this skill to turn a failing test scenario into a clear TDD plan and step-by-step red-green-refactor implementation focused on public behavior.

Frequently Asked Questions about Test-Driven Development (TDD)

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

FAQPage Schema
How do I start test-driven development with a red-green-refactor loop?

Test-driven development starts by writing a failing unit test for a specific behavior, adding the minimal code required to pass it, and refactoring only after achieving GREEN. This incremental cycle ensures safe vertical slices of functionality.

How do I write unit tests that survive internal refactoring?

Unit tests survive internal refactoring by verifying observable behavior through public APIs rather than testing internal implementation details. This behavior-driven approach keeps tests resilient to code structure changes.

What's the best way to implement new features incrementally without breaking existing behavior?

Implementing features incrementally uses a vertical slicing approach to validate behaviors one at a time. A one-test-to-one-minimal-change cycle ensures you add only the code required to pass the current failing test.

When should I refactor code during the TDD workflow?

Refactoring during TDD happens only after tests pass and reach GREEN. You must first satisfy the failing test with minimal implementation, then refactor safely while keeping tests resilient to internal changes.

Does behavior-driven testing work for fixing bugs as well as new features?

Behavior-driven testing works for both fixing bugs and implementing new features. It targets behavior-first development for public interfaces by driving troubleshooting and incremental functionality through the red-green-refactor workflow.