test-driven-development

Enforce red-green-refactor test-first development across coding tasks.

63|2|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/xhyqaq/superpowers-plus --skill test-driven-development-xhyqaq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/xhyqaq/superpowers-plus/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/xhyqaq/superpowers-plus --skill test-driven-development-xhyqaq

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the risk of shipping untested, buggy production code and accumulating technical debt from skipped test-first practices, ensuring all code changes are fully verified before deployment.

Core Features & Use Cases

  • Strict TDD Cycle Enforcement: Mandates the red-green-refactor workflow for all new features, bug fixes, refactoring, and behavior changes, with clear guardrails against common rationalizations for skipping tests.
  • Testing Anti-Pattern Prevention: Provides guidance to avoid common pitfalls like testing mock behavior, adding test-only methods to production code, and writing tests after implementation.
  • Real-World Use Case: When building a new payment processing feature, this Skill ensures you write a failing test for invalid card number rejection first, then minimal code to pass the test, preventing untested edge cases from reaching production.

Quick Start

Invoke the test-driven-development skill before writing any implementation code for your current task to follow the full test-first red-green-refactor workflow.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I enforce test-driven development workflows to prevent untested production code?

Test-driven development workflows prevent untested production code by mandating a strict red-green-refactor cycle. This approach requires writing a failing test first, implementing minimal code to pass, and refactoring to eliminate unverified edge cases and technical debt.

What are common testing anti-patterns when writing tests after implementation?

Common testing anti-patterns include writing tests after implementation, testing mock behavior instead of real outcomes, and adding test-only methods to production code. Test-driven development prevents these by requiring tests to fail before any implementation code is written.

How to apply the red-green-refactor cycle for bug fixes and refactoring?

Apply the red-green-refactor cycle for bug fixes and refactoring by first writing a test that reproduces the bug or verifies the desired behavior change, confirming it fails, then writing the minimal production code to make it pass before cleaning up the code.

Does test-first development work for new feature implementation and behavior changes?

Yes, test-first development works for new feature implementation, bug fixes, refactoring, and behavior changes. It applies the red-green-refactor cycle to all software engineering tasks, ensuring every code change is fully verified before deployment.

Why does writing tests after implementation increase technical debt?

Writing tests after implementation increases technical debt because it rationalizes skipping tests and allows untested edge cases to reach production. Test-first workflows eliminate this risk by verifying that each test fails before writing the minimal implementation code.