tdd

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

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/MSC72m/DevForge --skill tdd-msc72m
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/MSC72m/DevForge/tree/main/skills/tdd
Command: npx skills add https://github.com/MSC72m/DevForge --skill tdd-msc72m

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 red-green-refactor workflow 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 enough code to pass it, one vertical slice at a time. - Seam Identification: Helps define and confirm public test boundaries with the user before any test is written. - Anti-Pattern Detection: Flags implementation-coupled, tautological, and horizontally-sliced tests with concrete good/bad examples in tests.md and mocking guidance in mocking.md. - Use Case: When adding a checkout feature, use this Skill to agree on the public seams, write one failing behavior test like "user can checkout with valid cart", implement the minimal code to pass, and repeat. ## Quick Start Use the tdd skill to build this feature test-first, starting by confirming which 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 red-green-refactor?▼

Write one failing test that describes behavior through a public interface, then write only enough code to make it pass, and repeat one slice at a time. Refactoring belongs to a separate review stage, not the red-green cycle.

What is a good test versus a bad test in TDD?▼

A good test verifies observable behavior through public APIs and survives internal refactors, like "user can checkout with valid cart". Bad tests mock internal collaborators, test private methods, or recompute expected values the same way the code does.

When should I mock dependencies 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 use dependency injection with SDK-style interfaces to keep mocks simple.

What are seams in test-driven development?▼

A seam is the public boundary where you observe behavior without reaching inside the code. Tests should live only at pre-agreed seams confirmed with the user before writing any test, focusing effort on critical paths.

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

Tests break on refactor when they are coupled to implementation details, such as mocking internal collaborators or asserting on call counts. Rewrite them to verify behavior through public interfaces so internal structure can change freely.