tdd

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

1|Updated Nov 9, 2025
One-click install
npx skills add https://github.com/akashjpal/question-generator --skill tdd-akashjpal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/akashjpal/question-generator/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/akashjpal/question-generator --skill tdd-akashjpal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after implementation often produces brittle, implementation-coupled tests that break during refactors and fail to verify real behavior. This Skill enforces a disciplined test-first workflow so tests act as durable specifications of behavior. ## 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-Based Test Placement: Defines tests only at pre-agreed public interface boundaries, confirmed with the user before any test is written. - Anti-Pattern Detection: Identifies implementation-coupled, tautological, and horizontally-sliced tests, with mocking guidelines restricted to system boundaries like external APIs, time, and file systems. - Use Case: When adding a checkout feature, write one failing test through the public checkout interface, implement the minimal code to pass it, then repeat for the next behavior. ## Quick Start Ask the AI to build a new feature using test-driven development with the red-green-refactor loop, starting by agreeing on the seams to 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-refactor loop?

Write one failing test against a public interface first, then implement only the minimal code needed to make it pass. Repeat one vertical slice at a time, and defer refactoring to a separate review stage rather than mixing it into the loop.

What is a seam in test-driven development?

A seam is the public boundary where you observe behavior without reaching inside the code, such as a module's public interface. Tests live only at pre-agreed seams confirmed with the user, never against private methods or internal structure.

When should I use mocks in unit tests?

Mock only at system boundaries: external APIs, databases, time, randomness, and file systems. Never mock your own classes or internal collaborators, and design boundary interfaces with dependency injection and SDK-style functions for easy mocking.

Why do my tests break every time I refactor code?

Tests break during refactoring when they are coupled to implementation details, such as mocking internal collaborators, testing private methods, or asserting on call counts. Rewrite them to verify observable behavior through public interfaces instead.

What is a tautological test and why is it bad?

A tautological test recomputes the expected value the same way the implementation does, so it passes by construction and can never catch a bug. Expected values must come from an independent source like a known literal, worked example, or specification.