tdd

Guide red-green-refactor cycles by writing failing tests before code.

3|Updated Jan 18, 2026
One-click install
npx skills add https://github.com/HankLiu447/SuperSpec --skill tdd-hankliu447
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/HankLiu447/SuperSpec/tree/main/skills/tdd
Command: npx skills add https://github.com/HankLiu447/SuperSpec --skill tdd-hankliu447

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Teams often drift between specs, tests, and code, leading to misaligned expectations and hard-to-track regressions. This skill enforces a Test-Driven Development workflow to keep requirements verified by tests from the start.

Core Features & Use Cases

  • Red-Green-Refactor Cycle: write a failing test, implement minimal code to pass, then refactor while keeping tests green.
  • Spec-Driven Alignment: link specs to implementation so every change is traceable to a requirement or scenario.
  • Quality Assurance Through Testing: ensures changes are validated by tests, reducing regressions and drift.

Quick Start

Start by drafting a failing test for a feature, then implement only the minimal code required to pass that test, followed by a refactor if needed.

Frequently Asked Questions about tdd

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

FAQPage Schema
How does test-driven development keep software requirements aligned with code?

Test-driven development aligns software requirements with code by enforcing a test-first workflow. You write a failing test from the spec, implement minimal production code to pass it, and refactor while keeping tests green, ensuring every change is traceable to a requirement.

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

The red-green-refactor cycle in unit testing is a discipline where you first write a failing test, then implement the minimal code required to turn that test green, and finally refactor the code while keeping the tests green to ensure software quality.

How do I start writing tests before code for a new feature?

To start writing tests before code for a new feature, draft a failing unit test that defines the expected behavior based on your spec. Then, implement only the minimal production code required to pass that test, followed by any necessary refactoring.

Can I use spec-driven testing for bugfixes across an existing codebase?

Yes, spec-driven testing applies to bugfix work across an existing codebase. It requires writing a failing test that reproduces the bug based on the spec, then implementing the minimal code to pass the test, verifying the fix and preventing future regressions.

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

You write a failing test before production code to validate that the test actually checks the expected behavior and links the spec to the implementation. This test-first discipline ensures changes are verified from the start and reduces hard-to-track regressions.

When should I not use test-first development for software changes?

You should reconsider test-first development when your specs are undefined or rapidly drifting, as this discipline relies on linking clear requirements to tests. Without stable scenarios, writing failing tests first may cause misaligned expectations and wasted cycles.