Test-Driven Development (Spec Kit Plus)

Enforce a failing test before production code changes in sp-* workflows.

7|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/chenziyang110/spec-kit-plus --skill test-driven-development-spec-kit-plus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Test-Driven Development (Spec Kit Plus)
Source: https://github.com/chenziyang110/spec-kit-plus/tree/main/templates/passive-skills/test-driven-development
Command: npx skills add https://github.com/chenziyang110/spec-kit-plus --skill test-driven-development-spec-kit-plus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents incomplete or fragile implementations by enforcing that you verify requirements through a failing test before writing production code, reducing regressions and debugging churn.

Core Features & Use Cases

  • Iron Law: failing test first: Requires starting with a test that demonstrates the feature is missing or the bug reproduces before changing production behavior.
  • Tight TDD loop (Red → Green → Refactor): Guides you to implement the minimum code to pass, then refactor without introducing new behavior.
  • Workflow alignment with sp- tasks*: Applies specifically when working in sp-implement, sp-debug, sp-fast, and sp-quick so your first step is evidence-based and requirement-complete.

Quick Start

Use the test-driven-development skill when you begin a change to ensure you first write a failing test that proves what is currently broken or missing, then write the smallest production code change to make it pass.

Frequently Asked Questions about Test-Driven Development (Spec Kit Plus)

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 or bugfix?

Test-driven development requires writing a failing test first that demonstrates the missing feature or reproduces the bug before changing any production code, ensuring your implementation is evidence-based and requirement-complete.

What is the Red-Green-Refactor loop in test-first development?

The Red-Green-Refactor loop in test-first development guides you to write a failing test, implement the minimum production code to make it pass, and then refactor without introducing new behavior to prevent regressions.

Why should I write a failing test before writing production code?

Writing a failing test before production code prevents incomplete or fragile implementations by verifying requirements empirically first, which reduces debugging churn and prevents unverified production edits.

Does test-driven development apply to refactoring existing code?

Yes, test-driven development applies to refactoring by ensuring you have a passing test confirming current behavior before you refactor, preventing new behavior from being introduced and stopping regressions.

Can I use spec-driven workflows for debugging and fast implementation tasks?

Spec-driven workflows apply specifically to sp-implement, sp-debug, sp-fast, and sp-quick tasks, ensuring your first debugging or implementation step is evidence-based and starts with a failing test.

What are the limitations of enforcing a test-first development workflow?

Enforcing a test-first development workflow strictly prohibits making any unverified production edits before empirically confirming a test failure, which may slow down rapid prototyping when requirements are completely undefined.