tdd

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

Updated Sep 11, 2026
One-click install
npx skills add https://github.com/CYRUS-pinto/pi-bot --skill tdd-cyrus-pinto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/CYRUS-pinto/pi-bot/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/CYRUS-pinto/pi-bot --skill tdd-cyrus-pinto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after the fact often produces brittle, implementation-coupled tests that break on every refactor and fail to verify real behavior. This Skill enforces a disciplined red-green test-driven development loop so tests verify observable behavior through public interfaces and survive refactors. ## 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 examples of good and bad tests in tests.md and mocking guidance in mocking.md. - Use Case: When adding a checkout feature, ask the assistant to work test-first: it will confirm the seams with you, write one failing behavior test like "user can checkout with valid cart", implement the minimal code to pass, and repeat. ## Quick Start Ask the assistant to build the next feature or fix the bug using test-driven development, starting with one failing test at an agreed public seam.

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?

Test-driven development follows the red-green loop: write one failing test that describes the desired behavior, then write only enough code to make it pass. Repeat one vertical slice at a time rather than writing all tests upfront.

What makes a good unit test versus a bad test?

A good test verifies observable behavior through public interfaces 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.

What is a seam in testing and where should tests go?

A seam is the public boundary where you observe behavior without reaching inside a module. Tests should live only at pre-agreed seams confirmed with the user, never against internals, so testing effort lands on critical paths.

Why do my tests break every time I refactor code?

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

When should I not write all my tests before the implementation?

Writing all tests first is horizontal slicing: bulk tests verify imagined behavior and lock in test structure before you understand the implementation. Work in vertical slices instead, letting each test respond to what the previous cycle taught you.