test-driven-development

Enforces test-first development using the red-green-refactor cycle before writing production code.

3|1|Updated May 29, 2026
One-click install
npx skills add https://github.com/mambo-wang/CodingHub --skill test-driven-development-mambo-wang
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/mambo-wang/CodingHub/tree/main/.qoder/skills/test-driven-development
Command: npx skills add https://github.com/mambo-wang/CodingHub --skill test-driven-development-mambo-wang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often write production code first and add tests afterward, which produces tests that pass immediately and prove nothing about correctness. This Skill enforces strict test-driven development so every feature, bug fix, and refactor is backed by a test that was seen to fail first. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Guides the full TDD cycle—write a failing test, verify it fails for the right reason, write minimal code to pass, then refactor while keeping tests green. - Anti-Pattern Detection: Ships a testing-anti-patterns reference covering mock misuse, test-only production methods, incomplete mocks, and tests written as an afterthought. - Excuse Countering: Provides concrete rebuttals to common rationalizations like "I'll add tests later" or "I already tested manually." - 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 the suite passes. ## Quick Start Ask the AI to implement a new feature or fix a bug using strict test-driven development with a failing test written 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 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 to make it pass, then refactor while keeping all tests green. Repeat for each new behavior.

Why should tests be written before production code?▼

Tests written after implementation pass immediately, which proves nothing—they may test the wrong thing or mirror the implementation's biases. Watching a test fail first confirms it actually exercises the intended behavior and catches real bugs.

When is it acceptable to skip TDD?▼

Only for throwaway prototypes, generated code, or configuration files, and only with explicit approval from your human partner. Features, bug fixes, refactors, and behavior changes should always follow the test-first cycle.

What are common testing anti-patterns with mocks?▼

Key anti-patterns include asserting on mock behavior instead of real behavior, adding test-only methods to production classes, mocking without understanding dependencies, and creating incomplete mocks missing fields the real API returns. Test real behavior and mock minimally.

What should I do if I already wrote code before tests?▼

Delete the implementation and restart with TDD. Keeping it as reference leads to adapting it during testing, which becomes after-the-fact testing. Sunk cost is not a reason to keep unverified code.