One-click install
npx skills add https://github.com/whyte25/reusables --skill tdd-whyte25
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/whyte25/reusables/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/whyte25/reusables --skill tdd-whyte25

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Test-driven development helps you prevent regressions and design better behavior by forcing you to define expected outcomes before writing the implementation.

Core Features & Use Cases

  • Red-Green-Refactor loop: Drive implementation from one failing test to a minimal passing solution, then improve structure.
  • Behavior-focused, integration-style tests: Verify behavior through public interfaces so tests survive refactors.
  • Mocking guidelines: Mock only system boundaries (external APIs, databases, time/randomness, filesystem) to avoid brittle tests.
  • Avoid horizontal slicing: Write tests and implementation vertically (tracer bullets) instead of batching tests first.

Quick Start

Ask the AI to guide you through writing one tracer-bullet test for a specific behavior, then implementing only enough code to make it pass, and finally refactoring while keeping tests green.

Frequently Asked Questions about tdd

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

FAQPage Schema
How does test-driven development help fix brittle test suites?

Test-driven development fixes brittle test suites by applying behavior-first, integration-style testing. You verify observable outcomes through public interfaces and mock only system boundaries, ensuring tests survive refactoring without coupling to internal implementation details.

What is the red-green-refactor loop and how do I use it?

The red-green-refactor loop drives implementation by writing one failing test, creating minimal code to pass it, then improving structure. You follow this cycle vertically using tracer bullets, writing one test at a time instead of batching tests first.

When should I use mocking in test-driven development?

Mocking in test-driven development should be reserved strictly for system boundaries like external APIs, databases, time, randomness, and filesystems. Mocking internal components creates brittle tests that break during refactoring and obscure actual behavior.

How do I write tests for unclear requirements using tracer bullets?

Writing tests for unclear requirements using tracer bullets involves defining public behavior up front and implementing one vertical slice at a time. You write a single test, implement minimal code to pass, and refactor while keeping tests green.

Why should I avoid horizontal slicing when doing test-driven development?

Avoiding horizontal slicing in test-driven development prevents batching all tests before implementation. You write tests and implementation vertically slice by slice, ensuring each tracer bullet validates observable outcomes through public interfaces before moving forward.