openspec-sp-tdd

Enforce test-driven development with failing tests before production code.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/cenmiao/openspec-pro --skill openspec-sp-tdd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openspec-sp-tdd
Source: https://github.com/cenmiao/openspec-pro/tree/main/.claude/skills/openspec-sp-tdd
Command: npx skills add https://github.com/cenmiao/openspec-pro --skill openspec-sp-tdd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents regressions and overengineered implementations by enforcing a fail-first workflow that ensures every production change is covered by a test. It reduces uncertainty during development and provides a repeatable cycle to deliver small, verifiable increments of functionality.

Core Features & Use Cases

  • Red / Green / Refactor cycle: Start with a failing test (Red), implement the minimal code to pass (Green), then improve structure while preserving behavior (Refactor).
  • Test-first discipline: Forces writing tests before production code to clarify requirements and catch regressions early.
  • Use Cases: Implementing new features, reproducing and fixing bugs with regression tests, and performing safe refactors with confidence provided by an all-green test suite.

Quick Start

Write a failing test that expresses the desired behavior, run it to confirm failure, implement the minimal change to make the test pass, run the full test suite to ensure no regressions, and then refactor while keeping all tests green.

Frequently Asked Questions about openspec-sp-tdd

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?

Test-driven development begins by writing a minimal failing test that expresses the desired behavior. Run it to confirm failure, implement the smallest change to pass, run the full suite, then refactor while keeping all tests green.

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

The red-green-refactor cycle is a unit testing workflow: write a failing test (Red), implement minimal code to pass (Green), then improve code structure while preserving behavior and keeping tests green (Refactor).

How do I safely reproduce and fix bugs using regression tests?

Reproduce and fix bugs by writing a failing regression test that captures the defect. Implement the minimal production change to make it pass, ensuring the entire test suite remains green and preventing future regressions.

How can I refactor existing code without breaking functionality?

Refactor existing code by relying on an all-green test suite as a safety net. Improve internal structure while preserving behavior, continuously running the full test suite to ensure no regressions occur during the refactor.

Why write failing tests before production code?

Writing failing tests before production code clarifies requirements early and prevents overengineered implementations. This test-first discipline reduces development uncertainty and ensures every production change is covered by a test.

When should I not use a test-first workflow?

A test-first workflow may not suit throwaway prototypes or exploratory spikes where requirements are highly volatile. It targets delivering small, verifiable increments and preventing regressions, requiring a runnable test suite.