test-driven-development

Enforce the RED-GREEN-REFACTOR cycle with failing tests before production code.

80|17|Updated Oct 27, 2025
One-click install
npx skills add https://github.com/withzombies/hyperpowers --skill test-driven-development-withzombies
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/withzombies/hyperpowers/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/withzombies/hyperpowers --skill test-driven-development-withzombies

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents writing untested or poorly tested code by enforcing the "Red-Green-Refactor" cycle. It ensures tests genuinely verify behavior by requiring them to fail before implementation, catching bugs earlier and reducing technical debt.

Core Features & Use Cases

  • Red-Green-Refactor Cycle: Guides you through writing a failing test, implementing minimal code to pass it, and then refactoring.
  • Behavior-First Development: Forces focus on desired behavior before implementation details, leading to clearer, more robust code.
  • Regression Prevention: Ensures every bug fix and new feature has a corresponding test that proves its correctness and prevents future regressions.
  • Use Case: When adding a new user authentication feature, use this Skill to write a failing test for "rejects empty email" first, then implement the minimal code to make it pass.

Quick Start

Use the test-driven-development skill to add a new feature that calculates the average of a list of numbers.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I write tests that fail before implementing code?

Test-driven development requires writing a failing test first, then implementing minimal code to pass it. This Red-Green-Refactor cycle ensures tests genuinely verify behavior and catch bugs earlier, preventing untested code from reaching production.

What's the Red-Green-Refactor cycle and why does it matter?

Red-Green-Refactor is a workflow where you write a failing test (red), implement minimal code to pass it (green), then refactor safely. It prevents poorly tested code, reduces technical debt, and ensures every feature and bug fix has corresponding tests that prove correctness.

Can I use test-driven development with TypeScript, Rust, and Swift?

Yes. Test-driven development applies across TypeScript, Rust, Swift, and other production codebases. The Iron Law remains consistent: no production code without a failing test first, implement minimally, verify green, and refactor only after passing.

How do I prevent regressions when fixing bugs or adding features?

Write a failing test that demonstrates the bug or desired behavior before implementing the fix or feature. This ensures the test genuinely validates the change and prevents future regressions across your codebase.

When should I use test-driven development versus writing tests after code?

Test-driven development forces focus on desired behavior before implementation, catching bugs earlier and reducing technical debt. Use it for new features, bug fixes, and refactors that alter behavior to ensure comprehensive test coverage and clearer, more robust code.