skill-test-driven-development

Enforces red-green-refactor test-driven development for new features and bug fixes.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/longdang193/project-OS-starter --skill skill-test-driven-development-longdang193
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: skill-test-driven-development
Source: https://github.com/longdang193/project-OS-starter/tree/main/generated_agents/claude/skills/skill-test-driven-development
Command: npx skills add https://github.com/longdang193/project-OS-starter --skill skill-test-driven-development-longdang193

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code written before tests often ships without proof that tests actually verify the intended behavior, leading to regressions, biased tests-after, and untrusted implementations. ## Core Features & Use Cases - Red-Green-Refactor Discipline: Mandates writing a failing test first, verifying it fails for the right reason, then writing minimal code to pass. - Rationalization Detection: Lists common excuses for skipping TDD and red flags that require deleting code and starting over. - Testing Anti-Pattern Reference: Companion guide covering mock behavior testing, test-only production methods, incomplete mocks, and over-mocking. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection error, watch it fail, implement the validation, and confirm all tests pass. ## Quick Start Use the test-driven development skill to implement this feature by writing a failing test first, then minimal code to make it pass.

Frequently Asked Questions about skill-test-driven-development

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

FAQPage Schema
How do I practice test-driven development for a bug fix?▼

Write a failing test that reproduces the bug, run it to confirm it fails for the expected reason, then write the minimal fix to make it pass. The test proves the fix works and prevents regression.

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

Red means writing one minimal failing test, green means writing the simplest code to pass it, and refactor means cleaning up while keeping tests green. Each phase is verified by running the test suite before moving on.

When is it acceptable to skip TDD?▼

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and only with explicit human approval. Behavior-preserving refactoring may start from green characterization coverage instead of a failing test.

Why should tests be written before implementation code?▼

Tests written after code pass immediately, which proves nothing about whether they test the right thing. Watching a test fail first confirms it actually catches the missing behavior and is not biased by the existing implementation.

What testing anti-patterns should I avoid with mocks?▼

Avoid asserting on mock elements, adding test-only methods to production classes, mocking without understanding side effects, and creating incomplete mocks that omit fields downstream code uses. Test real behavior and mock minimally at the correct level.