test-driven-development

Enforces writing failing tests before production code using red-green-refactor cycles.

Updated Jul 6, 2026
One-click install
npx skills add https://github.com/chenziyang110/launchdeck --skill test-driven-development-chenziyang110
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/chenziyang110/launchdeck/tree/main/.specify/templates/passive-skills/test-driven-development
Command: npx skills add https://github.com/chenziyang110/launchdeck --skill test-driven-development-chenziyang110

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often write production code first and add tests later, or skip tests entirely for small fixes, leading to regressions, unverified bug fixes, and tests that validate mocks instead of real behavior. This Skill enforces a strict test-first discipline so every feature, bugfix, and refactor is backed by a failing test before any production code is written. ## Core Features & Use Cases - Iron Law Enforcement: Blocks production code changes until a failing test exists, with explicit red flags that trigger a stop-and-restart when violated. - Red-Green-Refactor Workflow: Guides the full cycle of writing a minimal failing test, implementing the simplest passing code, and refactoring without adding behavior. - Testing Anti-Pattern Reference: Documents five common anti-patterns (testing mock behavior, test-only production methods, mocking without understanding, incomplete mocks, tests as afterthought) with gate functions and fixes. - Use Case: While fixing a bug in an sp-debug workflow, write a failing test that reproduces the bug first, confirm the failure empirically, then implement the minimal fix and verify all tests pass. ## Quick Start Ask the AI to implement a new feature or fix a bug using test-driven development, writing a failing test before any production code.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I practice test-driven development when fixing a bug?▼

Write a failing test that explicitly reproduces the bug before changing any production code. Confirm the test fails for the correct reason, then implement the minimal fix and verify all tests pass.

What is the red-green-refactor cycle in TDD?▼

Red means writing a minimal failing test that shows what should happen. Green means writing the simplest production code to make it pass. Refactor means cleaning up duplication and structure while keeping tests green, without adding new behavior.

Why is testing mock behavior considered an anti-pattern?▼

Asserting on mock elements verifies the mock exists rather than that the component works, so the test tells you nothing about real behavior. Test the real component or unmock it, and never assert on mock-only test IDs.

Should small or quick fixes still have tests written first?▼

Yes. Even for small bounded fixes in fast workflows, write a test first to verify the fix and prevent regressions. Claims like 'the fix is too simple to need a test' are explicit red flags requiring a restart.

When should I avoid adding methods to production classes for tests?▼

Never add methods used only by tests to production classes, since this pollutes the API and risks accidental production calls. Move test-only cleanup or setup logic into dedicated test utility modules instead.