tdd

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

Updated Jun 28, 2026
One-click install
npx skills add https://github.com/AO-HyS/aohys.com --skill tdd-ao-hys
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/AO-HyS/aohys.com/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/AO-HyS/aohys.com --skill tdd-ao-hys

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 verify behavior through public interfaces and survive code changes. ## 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-Based Test Design: Defines tests only at pre-agreed public interface seams, confirmed with the user before any test is written. - Anti-Pattern Detection: Identifies implementation-coupled, tautological, and horizontally-sliced tests with concrete good/bad examples. - Mocking Guidelines: 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 agree on the public seams, write a failing test like "user can checkout with valid cart", implement the minimal code to pass, and repeat slice by slice. ## Quick Start Ask the AI to build the next feature test-first using the tdd skill, starting by agreeing on the seams to 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 slice at a time, letting each test respond to what the previous cycle taught you.

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 all seams under test should be agreed with the user before any test is written.

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 prefer dependency injection and SDK-style interfaces to make boundaries easy to mock.

Why do my tests break every time I refactor code?▼

Tests break during refactoring when they are coupled to implementation details, such as mocking internal collaborators, testing private methods, or asserting on call counts. Tests should verify 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 implementation 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, worked example, or specification.

Should I write all tests before implementing the feature?▼

No. Writing all tests first is horizontal slicing, which verifies imagined behavior and commits to test structure prematurely. Work in vertical slices instead: one failing test, one minimal implementation, then repeat.