tdd

Guides test-driven development using the red-green loop with behavior-focused tests at public interfaces.

Updated May 11, 2026
One-click install
npx skills add https://github.com/cloudofgeorge/AI-hands-Engineer --skill tdd-cloudofgeorge
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/cloudofgeorge/AI-hands-Engineer/tree/main/skills/engineering/tdd
Command: npx skills add https://github.com/cloudofgeorge/AI-hands-Engineer --skill tdd-cloudofgeorge

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after implementation often produces brittle tests coupled to internal structure that break during refactors and fail to verify real behavior. This Skill enforces a disciplined red-green TDD loop so tests act as durable specifications of behavior. ## Core Features & Use Cases - Red-Green Loop Rules: Enforces writing a failing test first, then only the minimal code to pass it, one vertical slice at a time. - Seam Identification: Defines tests at pre-agreed public boundaries confirmed with the user, never against internals. - Anti-Pattern Detection: Flags implementation-coupled, tautological, and horizontally sliced tests with concrete good/bad examples. - Mocking Guidance: Restricts mocks to system boundaries like external APIs, time, and file systems, with dependency injection patterns. - Use Case: When building a checkout feature, use this Skill to write one failing behavior test per cycle, mock only the payment API boundary, and keep tests stable through refactors. ## Quick Start Use the tdd skill to build this feature test-first, starting by agreeing on the public 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 loop?▼

Write one failing test that describes desired behavior through a public interface, then write only the minimal code needed to make it pass. Repeat one vertical slice at a time, and keep refactoring out of the loop until the review stage.

When should I mock dependencies in unit tests?▼

Mock only at system boundaries such as external APIs, time, randomness, and sometimes databases or file systems. Never mock your own classes or internal collaborators, and use dependency injection to make boundaries easy to substitute.

What makes a test implementation-coupled or brittle?▼

A test is implementation-coupled when it mocks internal collaborators, tests private methods, asserts on call counts, or verifies through side channels like direct database queries. Such tests break during refactors even when behavior is unchanged.

What is a tautological test and why is it bad?▼

A tautological test recomputes its expected value the same way the implementation does, so it passes by construction and can never catch a bug. Expected values should come from independent sources like known literals or worked examples.

Should I write all tests before implementing a feature?▼

No, writing all tests first is horizontal slicing and produces tests of imagined behavior. Work in vertical slices instead: one failing test, one minimal implementation, then repeat based on what each cycle teaches you.