test-driven-development

Enforce test-first implementation with failing tests before production code.

264|11|Updated Apr 25, 2026
One-click install
npx skills add https://github.com/coco-research/coco --skill test-driven-development-coco-research
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/coco-research/coco/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/coco-research/coco --skill test-driven-development-coco-research

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents unverified code from being shipped by forcing you to define behavior with a failing test before you write implementation code. It reduces regressions, clarifies requirements, and makes refactoring safer.

Core Features & Use Cases

  • Test-first workflow: Write one focused failing test, confirm it fails for the right reason, then implement the smallest change needed to pass.
  • Behavior-driven verification: Prefer real behavior over mock behavior so tests validate what the code actually does.
  • Regression prevention: Use the same cycle for new features, bug fixes, behavior changes, and refactoring work.
  • Use case: When a bug is reported, start by writing a test that reproduces the failure, then fix the code until the test passes and the bug cannot return unnoticed.

Quick Start

Ask the assistant to apply the test-driven-development skill to your next feature or bug fix and start by writing the first failing test.

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 fixing a bug using test-driven development?

To fix a bug with test-driven development, start by writing a failing test that reproduces the reported issue, then implement the minimal code change needed to pass it. This ensures the specific behavior is validated before production code is written.

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

The red-green-refactor cycle in unit testing requires writing a failing test first, implementing the smallest code change to pass it, and then refactoring. This iterative workflow validates behavior early and prevents unverified code from being shipped.

Can I use mocks when writing tests for TDD?

When applying TDD, you should prefer verifying real behavior over mock behavior. Tests that validate actual code behavior rather than mock interactions provide more reliable regression prevention for API changes and refactoring work.

How do I apply TDD discipline to refactoring existing logic?

To apply TDD to refactoring, write tests that verify the current behavior of the existing logic before making changes. This test-first approach ensures the refactor is safe and validates that behavior remains consistent after the code is modified.