test-driven-development

Enforce a RED-GREEN-REFACTOR cycle with failing tests before implementation.

1.4k|129|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/shiwenwen/hope-agent --skill test-driven-development-shiwenwen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/shiwenwen/hope-agent/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/shiwenwen/hope-agent --skill test-driven-development-shiwenwen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents regressions and low-quality code by enforcing test-first development so behavior is defined and verified before implementation.

Core Features & Use Cases

  • RED-GREEN-REFACTOR discipline: Write a failing test first, verify the failure, implement the smallest code to pass, then refactor safely.
  • Mandatory verification steps: Re-run the specific failing test and then the full suite to confirm no regressions.
  • Real-behavior testing guidance: Prefer tests that validate outcomes with real code rather than brittle mocks.

Quick Start

Ask the AI to implement a bugfix using strict test-driven-development by first writing a failing test, then running it to confirm the failure, then adding minimal production code to make it pass, and finally running the full test suite to ensure no regressions.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How does test-driven development prevent regressions when fixing bugs?

The RED-GREEN-REFACTOR cycle in test-driven development requires writing a failing test, verifying it fails for the correct reason, implementing minimal code to pass, refactoring, and running the full suite to prevent regressions.

How do I implement a bugfix using strict test-first development?

To implement a bugfix with test-first development, write a failing test that reproduces the bug, verify the failure, add the minimal production code to make it pass, then run the full test suite to ensure no regressions.

Can I use test-driven development across different programming languages and codebases?

Yes, you can apply test-driven development across common programming languages and codebases when implementing new behavior, refactoring, or changing existing systems to improve code quality.

Why should I verify that a failing test fails for the right reason?

Verifying that a failing test fails for the right reason ensures the test targets the actual missing behavior or bug, preventing false positives before you write the minimal implementation to make it pass.

Should I use mocks or real code when writing tests for test-driven development?

You should prefer tests that validate outcomes with real code rather than relying on brittle mocks, ensuring your test-driven development process verifies actual behavior and reduces regression risk.

When should I not use the test-first development approach?

You should avoid strict test-first development when exploring experimental prototypes where behavior is undefined, as the RED-GREEN-REFACTOR cycle requires predefined behavior to write meaningful failing tests.