test-driven-development

Enforces red-green-refactor test-driven development cycles before writing production code.

6|2|Updated Jan 30, 2026
One-click install
npx skills add https://github.com/Jerrylalala/compound-engineering --skill test-driven-development-jerrylalala
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Jerrylalala/compound-engineering/tree/main/plugins/compound-engineering/skills/test-driven-development
Command: npx skills add https://github.com/Jerrylalala/compound-engineering --skill test-driven-development-jerrylalala

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developers often write production code first and add tests afterward, which produces tests that pass immediately and prove nothing. This Skill enforces a strict test-first discipline so every feature and bug fix is backed by a test that was observed failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Mandates writing a failing test, verifying it fails for the right reason, writing minimal code to pass, then refactoring while keeping tests green. - Anti-Rationalization Guardrails: Lists common excuses for skipping TDD (e.g., "too simple to test", "I'll test later") and counters each with concrete reasoning. - Testing Anti-Pattern Reference: Ships a reference document covering mock-behavior testing, test-only production methods, uninformed mocking, and incomplete mocks. - Use Case: When fixing a bug where empty emails are accepted, the Skill guides you to first write a failing test asserting the rejection, watch it fail, implement the minimal validation, and confirm the suite passes. ## Quick Start Ask the AI to implement a new feature or bug fix using strict test-driven development with the red-green-refactor cycle.

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 step by step?▼

Follow the red-green-refactor cycle: write one minimal failing test, run it to confirm it fails for the expected reason, write the simplest code that makes it pass, then refactor while keeping all tests green. Repeat for each new behavior.

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

Red means writing a failing test that defines the desired behavior. Green means writing the minimal code to make that test pass. Refactor means cleaning up duplication and naming while keeping all tests passing, without adding new behavior.

Should I write tests before or after writing code?▼

Write tests before code. Tests written after implementation pass immediately, which proves nothing about whether they test the right behavior. Seeing a test fail first confirms it actually exercises the missing functionality.

When is it acceptable to skip test-driven development?▼

Only for throwaway prototypes, generated code, or configuration files, and only with explicit user confirmation. Bug fixes, features, refactoring, and behavior changes should always follow TDD according to this Skill's rules.

Why do my tests pass immediately without any implementation?▼

An immediately passing test means it is testing existing behavior or is written incorrectly. Fix the test so it fails for the right reason, such as a missing feature, before writing any implementation code.

What are common mocking mistakes in unit tests?▼

Common mistakes include asserting mock behavior instead of real behavior, mocking methods whose side effects the test depends on, and creating incomplete mocks missing fields the real API returns. Mock at the lowest necessary level and mirror real data structures.