tdd

Guides test-driven development through red-green cycles with seam-based test design.

2|Updated Jul 11, 2026
One-click install
npx skills add https://github.com/MoofonLi/dev-ready --skill tdd-moofonli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/MoofonLi/dev-ready/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/MoofonLi/dev-ready --skill tdd-moofonli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after code often produces brittle, implementation-coupled tests that break on every refactor. This Skill enforces a disciplined red-green TDD loop so tests verify behavior through public interfaces and survive internal changes. ## Core Features & Use Cases - Red-Green Loop Rules: Enforces writing a failing test first, then only enough code to pass it, one vertical slice at a time. - Seam-Based Test Design: Requires agreeing on public-interface seams with the user before any test is written, focusing effort on critical paths. - Anti-Pattern Detection: Identifies implementation-coupled, tautological, and horizontally-sliced tests, with mocking guidelines for system boundaries only. - Use Case: When adding a checkout feature, ask the agent to work test-first; it will confirm the seams, write one failing behavior test, implement the minimal code, and repeat per slice. ## Quick Start Ask the agent to build the next feature using test-driven development with the red-green-refactor loop.

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 on a new feature?

Write one failing test against a public interface first, then implement only enough code to make it pass, and repeat per vertical slice. Confirm the seams under test before writing anything, and keep refactoring out of the red-green cycle.

What is a seam in test-driven development?

A seam is the public boundary where you observe behavior without reaching inside the code. Tests live at seams, never against internals, and the seams under test should be agreed with the user before any test is written.

When should I use mocks in unit tests?

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

Why do my tests break every time I refactor code?

Tests break on refactoring when they are coupled to implementation details, such as mocking internal collaborators, testing private methods, or asserting call counts. Rewrite them to verify observable behavior through public interfaces so they survive internal changes.

What is a tautological test and why is it bad?

A tautological test recomputes the expected value the same way the code does, so it passes by construction and can never catch a bug. Expected values must come from an independent source such as a known literal, a worked example, or the specification.