tdd

Guides test-driven development using the red-green-refactor loop with seam-based testing.

10|3|Updated Jul 18, 2019
One-click install
npx skills add https://github.com/tanqimin/MyFavsORM --skill tdd-tanqimin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/tanqimin/MyFavsORM/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/tanqimin/MyFavsORM --skill tdd-tanqimin

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 test-first workflow so tests verify real behavior through public interfaces and survive internal changes. ## Core Features & Use Cases - Red-Green Loop Discipline: Enforces writing a failing test before any implementation, one vertical slice at a time, with no speculative features. - Seam Identification: Helps you define and confirm the public boundaries (seams) where tests belong before writing any test code. - Anti-Pattern Detection: Flags implementation-coupled, tautological, and horizontally-sliced tests with concrete good/bad examples. - Mocking Guidelines: Provides rules for mocking only at system boundaries (external APIs, time, file system) and designing mockable interfaces via dependency injection. - Use Case: When adding a checkout feature, use this Skill to agree on the seams with the user, write one failing behavior test, implement the minimal code to pass it, and repeat until the feature is complete. ## Quick Start Ask the AI to build the next feature using test-driven development, starting by agreeing on the seams to test and writing one failing 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 on a new feature?

Start by agreeing on the seams (public interfaces) to test, then write one failing test that describes observable behavior. Implement only enough code to make it pass, then repeat with the next test in a vertical slice.

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, so they survive refactors that change implementation but not behavior.

When should I use mocks in unit tests?

Mock only at system boundaries: external APIs, time or randomness, and sometimes databases or the file system. 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.

Does TDD include refactoring in the red-green loop?

No. Refactoring belongs to a separate review stage, not the red-green implementation cycle. The loop is strictly: write one failing test, write minimal code to pass it, then move to the next slice.