test-driven-development

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

2|Updated Jul 11, 2026
One-click install
npx skills add https://github.com/MoofonLi/dev-ready --skill test-driven-development-moofonli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/MoofonLi/dev-ready/tree/main/src/dev_ready/templates/claude/skills/test-driven-development
Command: npx skills add https://github.com/MoofonLi/dev-ready --skill test-driven-development-moofonli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code written before tests often ships untested or with tests that pass immediately and prove nothing. This Skill enforces strict test-driven development so every feature and bugfix starts with a failing test that verifies the intended behavior. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing one failing test, verifying it fails for the right reason, implementing minimal code, and refactoring while staying green. - Rationalization Detection: Lists common excuses for skipping TDD ("too simple to test", "I'll test after") with concrete rebuttals and red flags that trigger a restart. - Test Quality Rules: A companion reference defines how to write honest tests — naming the break each test catches, asserting real behavior instead of mocks, and running a mutation check. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection, watch it fail, implement the validation, and confirm the suite passes. ## Quick Start Ask the agent to implement the next feature or bugfix using strict test-driven development with a failing test written first.

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?

Write one minimal failing test for a single behavior, run it and confirm it fails for the expected reason, then write the simplest code that passes. Verify all tests pass, refactor while keeping them green, and repeat for the next behavior.

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

Red means writing a failing test that defines desired behavior. Green means writing minimal code to make it pass. Refactor means cleaning up duplication and names while keeping all tests green, then repeating the cycle.

When is it acceptable to skip test-driven development?

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and only with explicit approval from your human partner. Exploration is allowed, but the exploratory code must be discarded before restarting with TDD.

Why should tests avoid asserting on mocks?

Mock assertions only prove the mock exists, not that the component behaves correctly. Tests should assert real component behavior, mock only slow or external dependencies, and mirror the complete real data structure when mocking.

What should I do if I already wrote code before the test?

Delete the implementation and start over with a failing test. Keeping it as reference or adapting it biases the tests toward the existing code, so you never prove the test can actually catch the bug.