test-driven-development

Enforce a failing test before production code using Red-Green-Refactor.

1|Updated May 15, 2025
One-click install
npx skills add https://github.com/badaniya/.stowed --skill test-driven-development-badaniya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/badaniya/.stowed/tree/main/agents/.agents/skills/test-driven-development
Command: npx skills add https://github.com/badaniya/.stowed --skill test-driven-development-badaniya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enforces writing a failing test before production code to ensure correct behavior and design.

Core Features & Use Cases

  • Red-Green-Refactor: follow a deterministic cycle to validate changes.
  • Mandatory tests for new features, bug fixes, and refactors to prevent regressions.
  • Clear guidance on how to structure tests, name expectations, and maintain test quality.

Quick Start

  • Write a failing test that captures the intended behavior.
  • Implement the minimal code to make the test pass.
  • Refactor for readability and maintainability while keeping all tests green.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
What is test-driven development and how does the Red-Green-Refactor cycle work?

Test-driven development is a software testing process requiring a failing test before writing production code. The Red-Green-Refactor cycle involves writing a failing test, implementing minimal code to pass it, then refactoring for readability while keeping tests green.

How do I write tests before implementing new software features and bug fixes?

To write tests before implementing new software features or bug fixes, first author a failing test that captures the intended behavior. Then implement the minimal production code required to make that test pass, ensuring correct behavior and preventing regressions.

Can I use test-driven development for refactoring existing code without breaking behavior?

Yes, you can use test-driven development for refactoring existing code. It mandates writing tests to validate current behavior before changes, allowing you to safely refactor for readability and maintainability while ensuring all tests stay green.

Why does test-driven development require a failing test before writing production code?

Test-driven development requires a failing test before writing production code to enforce the Iron Law of correct software behavior. This deterministic cycle ensures every code change is validated, preventing regressions and guiding structural test quality.

What is the best way to structure tests and name expectations in test-driven development?

The best way to structure tests and name expectations in test-driven development is to capture intended behavior clearly within the initial failing test. This enforces test quality and maintainability throughout the subsequent refactoring step.