tdd

Apply red-green-refactor TDD loops to verify behavior through public interfaces.

1|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/mattbutlerengineering/mattbutlerengineering --skill tdd-mattbutlerengineering
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/mattbutlerengineering/mattbutlerengineering/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/mattbutlerengineering/mattbutlerengineering --skill tdd-mattbutlerengineering

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves the problem of creating fragile, implementation-coupled tests by guiding you to write behavior-focused tests that drive clean development.

Core Features & Use Cases

  • Red-green-refactor TDD loop: Learn one small behavior at a time using a test-first cycle.
  • Integration-style verification: Validate public interfaces and observable outcomes instead of internal calls.
  • Anti-pattern prevention: Avoid “horizontal slicing” where you write many tests before adding minimal implementation.

Use it when you are building a new feature or fixing a bug and you want tests that survive refactors and clearly describe what the system does.

Quick Start

Ask the assistant to help you write the first tracer-bullet test for the next public behavior, then implement just enough code to make that test pass.

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 survive refactoring and avoid fragile test suites?

Test-driven development reduces fragile test suites by focusing on behavior verified through public interfaces. This approach ensures tests describe observable outcomes rather than internal calls, keeping them stable during refactoring.

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

The red-green-refactor loop is a test-driven development cycle where you write one failing test for a small behavior, implement minimal code to pass it, then refactor safely. It uses tracer bullets to build features incrementally.

How do I start building a feature using test-driven development?

Start test-driven development by writing a tracer-bullet test for the next public behavior using a vertical slice, then implement just enough code to make that test pass. Repeat the red-green-refactor loop for each new behavior.

Should I mock internal collaborators when doing integration testing?

Integration testing in this test-driven approach avoids mocking internal collaborators. It validates public interfaces and observable outcomes instead of internal calls, ensuring tests accurately describe system behavior without coupling.

Why does horizontal slicing create bad tests in test-driven development?

Horizontal slicing in test-driven development means writing many tests before adding minimal implementation, creating implementation coupling. It is prevented by focusing on one small behavior at a time through vertical slices and tracer bullets.

Can I use test-driven development for fixing bugs as well as new features?

Test-driven development works for both feature development and bug fixing. It applies the red-green-refactor loop with tracer bullets to write behavior-focused tests that clearly describe what the system does in either scenario.