tdd

Guide test-first development with red-green-refactor cycles and public-interface tests.

1|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/ian-pascoe/dotfiles-chezmoi --skill tdd-ian-pascoe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/ian-pascoe/dotfiles-chezmoi/tree/main/dot_agents/skills/tdd
Command: npx skills add https://github.com/ian-pascoe/dotfiles-chezmoi --skill tdd-ian-pascoe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you build features and fix bugs test-first so your tests describe real behavior, not implementation details.

Core Features & Use Cases

  • Red-Green-Refactor Guidance: Supports the test-first loop with a strict red-before-green workflow.
  • Behavior-Focused Testing: Encourages tests at public seams that survive refactors and read like specifications.
  • Mocking and Test Design Rules: Explains when to mock system boundaries, how to avoid tautological tests, and how to keep tests meaningful.
  • Use Case: Use it when you are adding a checkout flow, fixing a regression, or deciding where an integration test should live.

Quick Start

Use the tdd skill to guide me through writing the next failing test and implementing the smallest change 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 behavior-focused tests instead of testing implementation details?

Behavior-focused testing targets public seams so your tests survive refactors and read like specifications. You write assertions against public interfaces one slice at a time, avoiding implementation-coupled or tautological assertions that break during internal changes.

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

The red-green-refactor cycle enforces a strict test-first workflow where you write a failing test, implement the smallest code change to make it pass, and then refactor. This ensures your tests describe real behavior before the implementation exists.

When should I mock system boundaries during integration testing?

Mock system boundaries when you need to isolate external dependencies and keep tests meaningful. You should mock at the edges to avoid tautological tests while ensuring your behavior-focused integration tests validate real interactions without coupling to internal implementation.

How do I start writing a failing test for a new feature or bug fix?

To start writing a failing test, select a public seam, define the expected behavior for one slice, and write an assertion that fails. Then implement the smallest code change to make that failing test pass, following the strict red-before-green workflow.

Can I use test-first development for fixing regressions and adding checkout flows?

Yes, test-first development applies to fixing regressions and adding flows like checkout. You guide the process by writing a failing test that describes the expected behavior, then implementing the minimal change to make it pass.

Why do my tests break when I refactor my code?

Tests break during refactoring when they are coupled to implementation details rather than public behavior. Writing behavior-focused tests at public seams and avoiding tautological assertions ensures your tests survive internal refactors.