tdd

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

3|1|Updated May 29, 2026
One-click install
npx skills add https://github.com/mambo-wang/CodingHub --skill tdd-mambo-wang
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/mambo-wang/CodingHub/tree/main/.codebuddy/skills/tdd
Command: npx skills add https://github.com/mambo-wang/CodingHub --skill tdd-mambo-wang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after implementation often produces brittle tests coupled to internal structure that break on every refactor. This Skill enforces a disciplined test-first workflow so tests verify real behavior through public interfaces and survive code changes. ## Core Features & Use Cases - Red-Green Loop Discipline: Enforces writing one failing test before each minimal implementation, one vertical slice at a time. - Seam Identification: Helps you agree on public interface boundaries (seams) before any test is written, focusing effort on critical paths. - Anti-Pattern Detection: Flags implementation-coupled, tautological, and horizontally-sliced tests with concrete good/bad examples. - Mocking Guidance: Defines when to mock (system boundaries only) and how to design mockable interfaces via dependency injection and SDK-style APIs. - Use Case: When adding a checkout feature, use this Skill to define the seams, write a failing test like "user can checkout with valid cart", implement just enough code to pass, and repeat for each behavior. ## Quick Start Use the tdd skill to build this feature test-first, starting by agreeing on the seams we should test.

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 the red-green-refactor loop?▼

Write one failing test first (red), then implement only enough code to make it pass (green), and repeat one vertical slice at a time. Refactoring belongs to a separate review stage, not the red-green implementation cycle.

What is a seam in test-driven development?▼

A seam is the public boundary where you test behavior without reaching inside the code. Tests live only at pre-agreed seams confirmed with the user before writing, never against private methods or internal structure.

When should I mock dependencies in unit tests?▼

Mock only at system boundaries: external APIs, time, randomness, and sometimes databases or file systems. Never mock your own classes or internal collaborators, since that couples tests to implementation details.

What makes a test tautological or implementation-coupled?▼

A tautological test recomputes the expected value the same way the code does, so it passes by construction. An implementation-coupled test mocks internal collaborators or asserts on call counts, breaking whenever you refactor without changing behavior.

Why should I avoid writing all tests before the implementation?▼

Writing all tests first is horizontal slicing: bulk tests verify imagined behavior and commit to test structure before understanding the implementation. Work in vertical slices instead, one test and one minimal implementation per cycle.