test-driven-development

Require failing tests before implementing minimal production code changes.

Updated May 5, 2026
One-click install
npx skills add https://github.com/XCmiaow/cc-deploy --skill test-driven-development-xcmiaow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/XCmiaow/cc-deploy/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/XCmiaow/cc-deploy --skill test-driven-development-xcmiaow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Test-Driven Development prevents bugs and regressions by forcing you to define the expected behavior with a failing test before writing production code.

Core Features & Use Cases

  • Failing-test-first workflow: Write a minimal test, verify it fails for the right reason, implement the smallest code change to pass, then re-verify it passes.
  • TDD cycle discipline: Repeat red-green-refactor while keeping tests green and avoiding accidental feature creep.
  • Anti-pattern prevention: Actively discourages mock-only assertions, test-only production methods, incomplete mocking, and “tests after” as proof.
  • Use Case: When fixing a bug (e.g., “empty email is accepted”), write a test that demonstrates the incorrect behavior, watch it fail, implement the minimal fix, and confirm the test passes while guarding against future regressions.

Quick Start

Use test-driven-development when implementing or changing any behavior—write a failing test first, implement minimal code to make it pass, and only then refactor.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I prevent regressions when refactoring code?

Test-driven development prevents regressions by enforcing a failing test before production code implementation, verifying minimal changes pass tests, and actively avoiding mock-only assertions or test-after validation.

How do I fix a bug using a test-first workflow?

A test-first workflow fixes bugs by requiring a failing test demonstrating the incorrect behavior, implementing the minimal fix to pass it, and confirming the test passes to prevent future regressions.

What is the red-green-refactor cycle in unit testing?

The red-green-refactor cycle in unit testing enforces TDD discipline by requiring a failing test, implementing minimal code to pass, and refactoring while keeping tests green to prevent accidental feature creep.

Why does test-after validation fail to ensure software quality?

Test-after validation fails to ensure software quality because TDD actively discourages it as proof, mandating failing tests before production code implementation to prevent mock-only assertions and incomplete mocking.

Can I use mock-only assertions to verify new features?

You cannot use mock-only assertions to verify new features in TDD, as it actively discourages this anti-pattern alongside test-only production methods, requiring mandatory failing and passing verification for behavior updates.