tdd

Guides test-driven development using a red-green-refactor loop with vertical slices.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/toderian/project_template --skill tdd-toderian
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/toderian/project_template/tree/main/plugins/agents-core/skills/tdd
Command: npx skills add https://github.com/toderian/project_template --skill tdd-toderian

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing tests after implementation often produces brittle tests coupled to internal structure, while writing all tests upfront produces tests of imagined behavior. This Skill enforces a disciplined red-green-refactor loop so tests verify observable behavior through public interfaces and survive refactors. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Drives one tracer-bullet test at a time through failing test, minimal implementation, and refactoring phases. - Test Quality Guardrails: Defines anti-patterns such as tautological assertions, horizontal slicing, and mocking internal collaborators, with worked good/bad examples. - Five-Layer Test Taxonomy: Provides a shared vocabulary (acceptance, contract, property-based, integration, unit) plus a decision matrix mapping change types to required test layers. - Use Case: When asked to implement a checkout feature with TDD, the agent confirms the interface and behaviors to test, writes one failing test, implements the minimal code to pass, and repeats per behavior before refactoring. ## Quick Start Ask the agent to build the next feature or bug fix using TDD with the red-green-refactor loop, confirming the public interface and behaviors to test first.

Frequently Asked Questions about tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I do test-driven development with the red-green-refactor loop?

Write one failing test for a single behavior (red), write the minimal code to make it pass (green), then refactor while tests stay green. Repeat one test at a time as vertical slices rather than writing all tests upfront.

What is the difference between unit, integration, and acceptance tests?

Unit tests check one function in isolation, integration tests exercise real components working together through a seam, and acceptance tests verify public behavior against spec criteria. The taxonomy also includes contract and property-based layers, with a decision matrix for which layers each change type requires.

When should I mock dependencies in 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, since that couples tests to implementation and makes them break during refactors.

Why do my tests break every time I refactor code?

Tests break during refactoring when they assert on implementation details like private methods, call counts, or internal collaborators instead of observable behavior. Rewrite them against the public interface so they describe what the system does, not how.

What is a tautological test and why is it a problem?

A tautological test recomputes its expected value using the same logic as the code under test, so it passes by construction and catches nothing. Expected values must come from an independent source such as a known-good literal, worked example, or the specification.