tdd

Guides test-driven development using the red-green-refactor loop with behavior-focused integration tests.

1|1|Updated Oct 3, 2021
One-click install
npx skills add https://github.com/benjr70/Smart-Smoker-V2 --skill tdd-benjr70
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/benjr70/Smart-Smoker-V2/tree/main/.claude/skills/tdd
Command: npx skills add https://github.com/benjr70/Smart-Smoker-V2 --skill tdd-benjr70

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after the fact often produces brittle tests coupled to implementation details that break on every refactor. This Skill enforces a disciplined test-driven development workflow where tests verify observable behavior through public interfaces, so they survive internal changes and read like specifications. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Walks through one test at a time using vertical tracer-bullet slices instead of writing all tests up front, preventing tests of imagined behavior. - Seam Identification: Helps decide which public interfaces to test at before writing any test, with guidance on deep modules and interface design for testability. - Mocking Discipline: Provides rules for mocking only at system boundaries (external APIs, time, file system) and never internal collaborators. - Use Case: When adding a checkout feature, use this Skill to write one failing test for the first behavior, implement the minimal code to pass, then repeat per behavior, finishing with a guided refactor pass. ## Quick Start Ask the assistant to build the next feature or bug fix using TDD with the red-green-refactor loop, confirming the seams and behaviors to test first.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I practice test-driven development with red-green-refactor?

Write one failing test for a single behavior (red), write the minimal code to make it pass (green), then refactor while tests stay green. Repeat per behavior rather than writing all tests first, so each test responds to what you learned from the previous cycle.

What is the difference between good and bad tests in TDD?

Good tests verify observable behavior through public interfaces and survive internal refactors. Bad tests mock internal collaborators, test private methods, or assert on call counts, so they break whenever implementation changes even though behavior stays the same.

When should I mock dependencies in unit tests?

Mock only at system boundaries such as external APIs, databases, time, randomness, and the file system. Never mock your own classes or internal collaborators, and use dependency injection plus SDK-style interfaces to make boundary mocks simple.

Why should I avoid writing all tests before implementation?

Writing all tests first is horizontal slicing, which produces tests of imagined behavior and data shapes rather than real behavior. Vertical tracer-bullet slices, one test then one implementation, keep tests aligned with actual system behavior.

What is a deep module and why does it matter for testing?

A deep module pairs a small interface with substantial hidden implementation, from A Philosophy of Software Design. Deep modules reduce the surface area tests must cover, making behavior-focused tests easier to write and more stable across refactors.