tdd

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

2|1|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/brandtam/rubber-ducky-legacy --skill tdd-brandtam
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/brandtam/rubber-ducky-legacy/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/brandtam/rubber-ducky-legacy --skill tdd-brandtam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after implementation often produces brittle tests coupled to internal structure that break during refactors. This Skill enforces a disciplined test-first workflow where tests verify observable behavior through public interfaces, so they survive internal changes. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Walks through one test at a time using vertical tracer-bullet slices instead of writing all tests upfront. - Behavior-Focused Test Design: Distinguishes good integration-style tests from implementation-coupled tests, with concrete TypeScript examples. - Design Guidance: Includes references on deep modules, interface design for testability, mocking at system boundaries, and post-cycle refactoring candidates. - Use Case: When asked to build a new feature with TDD, the Skill plans the public interface with the user, writes one failing test, implements minimal code to pass, and repeats until all prioritized behaviors are covered. ## Quick Start Ask the AI to build a feature or fix a bug using test-driven development with the red-green-refactor loop.

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 for a single behavior (red), write the minimal code to make it pass (green), then refactor while tests stay green. Repeat the cycle one behavior at a time rather than writing all tests upfront.

What is the difference between good and bad unit tests?▼

Good tests verify observable behavior through public interfaces and survive internal refactors. Bad tests mock internal collaborators, test private methods, or assert on call counts, so they break whenever implementation changes without behavior changing.

When should I use mocks in testing?▼

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 details.

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

Tests break during refactoring when they are coupled to implementation details like internal function names, private methods, or mock call expectations. Rewrite them to verify behavior through the public interface so internal restructuring leaves them untouched.

Should I write all tests before writing any implementation code?▼

No. Writing all tests first is horizontal slicing and produces tests of imagined behavior. Use vertical slices instead: one test, one minimal implementation, then repeat so each test responds to what the previous cycle revealed.