tdd

Enforce red-green-refactor loops with behavior-focused integration tests.

Updated May 28, 2026
One-click install
npx skills add https://github.com/kyo0221/claude-config --skill tdd-kyo0221
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/kyo0221/claude-config/tree/main/skills/tdd
Command: npx skills add https://github.com/kyo0221/claude-config --skill tdd-kyo0221

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the problem of writing fragile, implementation-coupled tests that break during code refactors, and helps developers build reliable, behavior-focused features using test-driven development.

Core Features & Use Cases

  • Red-Green-Refactor Workflow: Guides you through the core TDD loop of writing a failing test first, implementing minimal code to pass it, then refactoring safely.
  • Behavior-Focused Testing: Teaches you to write integration-style tests that verify public interface behavior, so they survive internal code changes and refactors.
  • Anti-Pattern Avoidance: Explicitly warns against the horizontal slicing anti-pattern of writing all tests first then all implementation, which leads to low-quality, behavior-agnostic tests.
  • Use Case: For example, when adding a new user profile update feature to a web app, use this skill to write a test for the profile update behavior first, implement the minimal code to pass the test, then refactor the code without breaking existing functionality.

Quick Start

Use the tdd skill to implement the new user password reset feature by first writing a test for successful password reset with a valid token, then building the minimal code to pass that test.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I write tests that don't break during code refactoring?

To write tests that survive code refactoring, use test-driven development to write integration-style tests that verify public interface behavior rather than internal implementation details. This behavior-focused approach prevents fragile, implementation-coupled tests.

What is the red-green-refactor loop in test-driven development?

The red-green-refactor loop in test-driven development is a workflow where you write a failing test first, implement the minimal code required to pass that test, and then safely refactor the code without breaking existing functionality.

Why do my test-driven development tests break when I change internal implementation?

Your tests break during changes because they are implementation-coupled rather than behavior-focused. Test-driven development should verify public interface behavior through integration tests, ensuring internal code changes and refactors do not cause test failures.

Should I write all tests first before starting implementation in test-driven development?

No, writing all tests first then all implementation is a horizontal slicing anti-pattern in test-driven development. This leads to low-quality, behavior-agnostic tests instead of reliable tests built through the red-green-refactor loop.

How do I use test-driven development to add a new feature like a password reset?

To add a new feature like a password reset using test-driven development, first write a test for the successful behavior with a valid token, then build the minimal code to pass that test, and finally refactor the implementation safely.

Can test-driven development be used for fixing bugs and writing integration tests?

Yes, test-driven development applies to software engineering workflows for building new features, fixing bugs, and writing integration tests. It enforces practices that verify public interface behavior and eliminate implementation-coupled tests.