tdd

Guide test-driven development with red-green-refactor loops and anti-pattern detection.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the common problem of writing fragile, implementation-coupled tests that break during code refactors even when user-facing behavior remains unchanged, and helps developers build reliable, maintainable software through structured test-first development practices.

Core Features & Use Cases

  • Structured TDD Workflow: Step-by-step guidance for the full red-green-refactor loop, including pre-implementation planning, tracer bullet testing, incremental test-implementation cycles, and safe refactoring steps.
  • Anti-Pattern Avoidance: Explicit warnings against common TDD mistakes like horizontal slicing (writing all tests before implementation) that lead to low-value, brittle tests that don't reflect real user behavior.
  • Test Quality Best Practices: Clear rules for writing behavior-focused integration tests that survive internal refactors, plus guidelines for when and how to mock external system boundaries only.
  • Real-World Use Case: When building a new checkout feature for an e-commerce site, use this Skill to write a single test for the successful checkout flow first, implement minimal code to pass the test, then refactor the payment processing logic without breaking existing functionality.

Quick Start

Use the tdd skill to implement the new user password reset feature using test-driven development, following the red-green-refactor loop for each new behavior.

Frequently Asked Questions about tdd

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

FAQPage Schema
Why do my unit tests keep breaking when I refactor code even though user-facing behavior hasn't changed?▼

Implementation-coupled tests break during refactoring because they assert internal logic rather than public behavior. Test-driven development solves this by guiding you to write behavior-focused integration tests that validate the public interface, surviving internal code restructuring.

How do I apply the red-green-refactor loop to build a new software feature?▼

Test-driven development workflow starts with pre-implementation planning, writes a failing behavior test, implements minimal code to pass it, and then safely refactors. This incremental cycle ensures each new behavior is validated before the internal implementation is optimized.

When should I use mocking in integration testing?▼

Mocking in integration testing should be applied exclusively at external system boundaries. Test-driven development best practices dictate mocking only external dependencies to ensure tests remain refactor-safe and validate real user-facing behavior across internal code paths.

What is the best way to avoid writing low-value, brittle tests in test-first development?▼

Avoid horizontal slicing—writing all tests before implementation—in test-first development. Low-value brittle tests are prevented by following incremental test-implementation cycles that focus on validating real user behavior through the public interface rather than internal logic.

Can I use test-driven development for both bug fixes and new feature builds in any size codebase?▼

Test-driven development applies to software development workflows involving feature builds, bug fixes, and integration test creation for codebases of any size. It provides structured test-first guidance and anti-pattern detection regardless of project scale or existing architecture.