test-driven-development

Guide code changes through red-green-refactor cycles with test-first principles.

7|2|Updated Apr 23, 2026
One-click install
npx skills add https://github.com/yishan-io/yishan-mono --skill test-driven-development-yishan-io
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/yishan-io/yishan-mono/tree/main/packages/pi-dev-flow/skills/test-driven-development
Command: npx skills add https://github.com/yishan-io/yishan-mono --skill test-driven-development-yishan-io

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill solves the problem of inconsistent code quality and untested features by enforcing a disciplined test-first development workflow.

Core Features & Use Cases

  • Red-Green-Refactor Enforcement: Guides the agent through the mandatory sequence of failing tests, minimal implementation, and safe refactoring.
  • Quality Guardrails: Provides specific anti-patterns to avoid, such as testing mock behavior or polluting production code with test-only hooks.
  • Use Case: When implementing a new API endpoint, the agent will first write a failing test case that defines the expected response, ensuring the implementation is strictly driven by requirements.

Quick Start

Use the test-driven-development skill to guide the implementation of the new user authentication module starting with a failing test case.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I enforce test-driven development when implementing new features?

The test-driven development workflow guides agents through a strict red-green-refactor cycle to ensure high-quality code, requiring a failing test case first, followed by minimal implementation, and then safe refactoring to verify behavior.

What is the best way to apply TDD for bug fixes and refactoring?

Applying TDD for bug fixes and refactoring involves writing a failing test that reproduces the bug or verifies existing behavior, then making minimal code changes to pass the test, ensuring behavior verification remains critical throughout the process.

How does the red-green-refactor cycle work in unit testing?

The red-green-refactor cycle in unit testing works by first writing a failing test to define expected behavior, then implementing the minimum code required to make the test pass, and finally refactoring the code while keeping tests green.

What testing anti-patterns should I avoid during test-first development?

Test-first development anti-patterns to avoid include testing mock behavior instead of actual implementation logic and polluting production code with test-only hooks, which compromises the integrity of behavior verification.

When do I need test-driven development for API endpoint implementation?

Test-driven development is needed for API endpoint implementation when behavior verification is critical, requiring you to first write a failing test case that defines the expected response before writing any implementation code.