tdd

Guide test-driven development with a red-green-refactor loop.

1|Updated May 7, 2026
One-click install
npx skills add https://github.com/Soham407/studio-kickstart --skill tdd-soham407
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/Soham407/studio-kickstart/tree/main/architecture/matt-pocock-tdd
Command: npx skills add https://github.com/Soham407/studio-kickstart --skill tdd-soham407

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you write maintainable tests that verify behavior through public interfaces, so refactors don’t break your suite unnecessarily.

Core Features & Use Cases

  • Test behavior, not implementation: Focus integration-style tests that describe what the system does, not how it does it.
  • Vertical slice workflow: Use the red-green-refactor loop with tracer bullets (one test → minimal code → repeat) to avoid “horizontal slicing” crap tests.
  • Mocking safely at boundaries: Mock only system boundaries like external APIs and databases, not internal collaborators.
  • Use cases: Apply when building new features, fixing bugs, or when you want integration-style coverage and predictable refactoring confidence.

Quick Start

Ask an AI agent to implement your next feature using a red-green-refactor loop with one tracer bullet test at a time, keeping tests focused on public behavior and mocking only external boundaries.

Frequently Asked Questions about tdd

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

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

Focus on integration-style tests that verify behavior through public interfaces rather than internal implementation details. This approach ensures your test suite remains reliable and validates what the system does without failing unnecessarily when you refactor code.

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

The red-green-refactor loop is a test-driven development workflow where you write a failing tracer-bullet test first, implement minimal code to pass it, then refactor only after achieving green. This vertical slice process repeats one test at a time to build features incrementally.

When should I mock external boundaries versus internal collaborators?

Mock only system boundaries like external APIs and databases, not internal collaborators. Mocking internal components creates brittle tests coupled to implementation details, while mocking external boundaries isolates your tests from unpredictable outside systems and maintains refactoring confidence.

Does test-driven development work for both new features and bug fixing?

Yes, test-driven development applies to both building new features and fixing bugs. Writing tracer-bullet tests one at a time using the red-green-refactor loop provides integration-style coverage and predictable confidence whether you are adding functionality or resolving defects.

Why do my tests break when I refactor internal code?

Tests break during refactoring when they verify implementation details rather than public behavior. By testing through public interfaces and mocking only external boundaries, your tests describe what the system does and remain stable regardless of how internal code is restructured.

What is the best way to avoid horizontal slicing crap tests in TDD?

Use a vertical slice workflow with tracer bullets, writing one test at a time and implementing minimal code to reach green before refactoring. This avoids horizontal slicing crap tests by focusing each test on system behavior through public interfaces rather than isolated internal functions.