tdd

Apply test-driven development through red-green-refactor cycles with behavior-focused integration tests.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TDD helps you reduce regressions and increase confidence by forcing you to specify desired behavior as tests before (and alongside) implementing features or fixes.

Core Features & Use Cases

  • Red-green-refactor workflow: Guides you to write a failing test first (red), implement the minimum to pass (green), then improve the design (refactor).
  • Behavior-first integration testing: Emphasizes tests that exercise public interfaces and real code paths instead of brittle implementation details.
  • Avoids common TDD failure modes: Warns against “horizontal slicing” (writing many tests or many implementation changes in bulk) and provides a vertical “one test at a time” tracer-bullet approach.
  • Designing for testability: Covers how to structure interfaces to make testing natural (dependency injection, returning results instead of side effects, and small surface area).

Use case example: You’re fixing a checkout bug and want a test that proves the user-facing behavior (e.g., checkout completes and returns the correct status) while keeping the test resilient to internal refactors.

Quick Start

Ask for a TDD plan using the red-green-refactor loop for a specific feature or bug, then request one tracer-bullet test focused on public behavior and minimal implementation to make it pass.

Frequently Asked Questions about tdd

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

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

Behavior-first integration testing exercises public interfaces and real code paths instead of relying on brittle implementation details. This approach ensures tests verify user-facing outcomes, keeping them resilient when you refactor underlying code structure.

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

The red-green-refactor cycle in test-driven development involves writing a failing test first (red), implementing the minimum code required to pass it (green), and then improving the design without altering behavior (refactor).

How do I apply TDD to fix a bug using vertical slices?

Applying TDD to fix a bug using vertical slices involves writing one behavior-focused test at a time as a tracer bullet. You then implement the minimal logic to pass that specific test before moving to the next slice, avoiding bulk implementation changes.

Why should I avoid horizontal slicing when writing tests?

Avoid horizontal slicing when writing tests because writing many tests or implementation changes in bulk leads to TDD failure modes. A vertical, one-test-at-a-time tracer-bullet approach ensures steady progress and validates behavior incrementally.

How do I design interfaces for testability and mocking boundaries?

Designing for testability involves structuring interfaces with dependency injection, returning results instead of causing side effects, and keeping surface areas small. Mocking boundaries should be defined to avoid coupling tests with internal implementation details.