test-driven-development

Enforces red-green-refactor test-driven development workflow before writing implementation code.

Updated Jul 30, 2026
One-click install
npx skills add https://github.com/johsquaree/claude-basic-docs --skill test-driven-development-johsquaree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/johsquaree/claude-basic-docs/tree/main/.claude/skills/test-driven-development
Command: npx skills add https://github.com/johsquaree/claude-basic-docs --skill test-driven-development-johsquaree

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 Enforcement: Guides the full cycle of writing a failing test, verifying it fails for the right reason, writing minimal code to pass, and refactoring while staying green. - Rationalization Detection: Lists common excuses for skipping TDD ("too simple to test", "I'll test after") with concrete rebuttals, plus red flags that trigger a restart. - Test Quality Rules: A companion reference defines how to write honest tests that name the break they catch, assert real behavior instead of mocks, and pass a mutation check. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection error, watch it fail, implement the minimal validation, and confirm all tests pass. ## Quick Start Ask the assistant to implement a new 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 describing the desired behavior, run it and confirm it fails for the expected reason, then write the simplest code that makes it pass. After green, refactor while keeping tests passing, and repeat for the next behavior.

How do I write a good failing test before implementation?

Name the production change that would make the test fail, derive expected values by hand rather than from the code under test, and assert real behavior instead of mock interactions. Keep each test focused on one behavior with a clear descriptive name.

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 and rewritten test-first.

Why does my test pass immediately without any implementation?

An immediately passing test means it is testing existing behavior or is tautological, so it proves nothing. Fix the test to target the missing feature, then watch it fail before writing any implementation code.

When should I use mocks in unit tests?

Mock only slow or external dependencies after learning the real method's side effects, and mirror the complete real data structure. Never assert on the mock itself; if mock setup outgrows the test logic, switch to an integration test with real components.