test-driven-development

Enforce a red-green-refactor cycle for feature work and bug fixes.

1|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/minfengyuan/harness-knowledge-base --skill test-driven-development-minfengyuan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/minfengyuan/harness-knowledge-base/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/minfengyuan/harness-knowledge-base --skill test-driven-development-minfengyuan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Implementing features or bug fixes without tests often leads to regressions and unclear expectations. This skill enforces a test-first mindset to clarify requirements and provide a safety net before coding.

Core Features & Use Cases

  • Red-Green-Refactor workflow to guide development from failing tests to passing code and subsequent cleanup
  • Prevents regressions by forcing tests to prove behavior before implementation
  • Suitable for new features, bug fixes, and refactoring tasks with clear success criteria

Quick Start

Apply TDD by writing a failing test first, then implement the minimal code to pass, and refactor for readability.

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 writing tests before implementation code?

Writing tests before implementation code requires a red-green-refactor cycle: write a failing test first, implement the minimal code to pass it, then refactor for readability. This clarifies requirements and provides a safety net before coding.

What is the red-green-refactor workflow for test-driven development?

The red-green-refactor workflow drives development from failing tests to passing code and subsequent cleanup. You write a failing test, implement minimal code to pass, then refactor for clean, well-factored code.

Can I use test-first development for both new features and bug fixes?

Yes, test-first development suits both new features and bug fixes. It enforces a fail-first mindset to clarify expectations and prevents regressions by proving behavior before implementation.

Why does writing code without tests lead to regressions?

Writing code without tests leads to regressions because expectations remain unclear and unverified. Enforcing a test-first mindset clarifies requirements and provides a safety net before coding.

What's the best way to prevent regressions when fixing bugs?

The best way to prevent regressions when fixing bugs is enforcing a test-first approach. Forcing tests to prove behavior before implementation ensures minimal, clean code and prevents future regressions.