tdd

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

1|Updated Apr 25, 2025
One-click install
npx skills add https://github.com/Gabr1elaugus700/WorkaPool --skill tdd-gabr1elaugus700
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/Gabr1elaugus700/WorkaPool/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/Gabr1elaugus700/WorkaPool --skill tdd-gabr1elaugus700

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 TDD loop so tests verify observable 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 Identification: Requires agreeing on public interface seams with the user before any test is written, focusing effort on critical paths. - Anti-Pattern Detection: Flags 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 write one failing test for cart checkout behavior, implement the minimal code to pass it, and repeat slice by slice. ## Quick Start Use the tdd skill to build the new payment feature test-first, starting by agreeing on the 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 for a single behavior first, then write only the minimal code needed to make it pass, and repeat. Work in vertical slices of one test and one implementation per cycle rather than writing all tests upfront.

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?

A test is implementation-coupled when it mocks internal collaborators, tests private methods, or verifies through side channels like querying the database directly. The tell is that the test breaks when you refactor even though behavior has not changed.

Why do tautological tests pass without catching bugs?

Tautological tests recompute the expected value the same way the code does, so they pass by construction and can never disagree with the implementation. Expected values must come from an independent source like a known literal or worked example.

Should refactoring happen during the red-green cycle?

No, refactoring is not part of the red-green loop. It belongs to a separate review stage after the implementation cycle, keeping each TDD cycle focused on one failing test and one minimal implementation.