test-driven-development

Enforce test-first development with a red-green-refactor cycle for features and bug fixes.

1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/51hhh/BU03 --skill test-driven-development-51hhh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/51hhh/BU03/tree/main/.github/skills/test-driven-development
Command: npx skills add https://github.com/51hhh/BU03 --skill test-driven-development-51hhh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you implement features and bug fixes with confidence by making the failing test the starting point, so you can catch mistakes before they spread into production.

Core Features & Use Cases

  • Red-Green-Refactor Workflow: Write one failing test, make the smallest change to pass it, then clean up without changing behavior.
  • Behavior-Focused Testing: Prefer real behavior over mock-heavy assertions and avoid testing mock existence instead of the product logic.
  • Anti-Pattern Guardrails: Detect common mistakes like test-after implementation, test-only production methods, incomplete mocks, and over-mocking.
  • Use Case: When fixing a regression or adding a feature, use this Skill to define the expected behavior first, verify the failure, implement the minimum code, and keep coverage aligned with actual outcomes.

Quick Start

Ask the assistant to help you write the first failing test for your feature or bug fix, then follow the red-green-refactor cycle until the behavior is implemented and verified.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I start test-driven development for a new feature?

Test-driven development starts by writing one failing test that specifies expected behavior, verifying the failure, making the smallest code change to pass it, then refactoring. This red-green-refactor cycle ensures reliable behavior specification and regression protection across application codebases.

Why does writing tests after implementation cause regression issues?

Writing tests after implementation often leads to testing mock existence instead of actual product logic. Test-driven development prevents this by requiring real-behavior tests upfront, avoiding test-after shortcuts, incomplete mocks, and test-only production methods that fail to catch mistakes before they spread into production.

What is the best way to write unit tests for behavior changes and refactoring?

The best way to write unit tests for behavior changes is to define the expected behavior first with a failing test. This behavior-focused testing approach prefers real behavior over mock-heavy assertions, ensuring safer code changes and explicit coverage of edge cases during refactoring.

Does test-driven development work for fixing bugs and regressions?

Yes, test-driven development works for fixing bugs and regressions by making the failing test the starting point. You define the expected behavior first, verify the failure, implement the minimum code to pass the test, and keep coverage aligned with actual outcomes to prevent future regressions.

How do I avoid over-mocking when writing unit tests?

To avoid over-mocking when writing unit tests, prefer real behavior over mock-heavy assertions and avoid testing mock existence instead of product logic. Test-driven development includes anti-pattern guardrails to detect incomplete mocks, over-mocking, and test-only production methods.