test-driven-development

Write failing tests before implementing minimal code using Red-Green-Refactor.

2|Updated Oct 25, 2025
One-click install
npx skills add https://github.com/robertpelloni/workspace --skill test-driven-development-robertpelloni
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/robertpelloni/workspace/tree/main/AI_COORDINATION/skills/superpowers-skills-main/skills/testing/test-driven-development
Command: npx skills add https://github.com/robertpelloni/workspace --skill test-driven-development-robertpelloni

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill guides you through the Test-Driven Development (TDD) cycle, ensuring that code is written with a focus on correctness, maintainability, and clear requirements. It reduces bugs, improves design, and provides immediate feedback during development.

Core Features & Use Cases

  • Red-Green-Refactor Guidance: Lead through each step of the TDD cycle.
  • Test Case Generation: Help write effective unit and integration tests.
  • Use Case: When implementing a new function, use this skill to first write a failing test, then write the minimum code to make it pass, and finally refactor for cleanliness, ensuring the function works as intended.

Quick Start

Start a TDD cycle for a new 'user validation' function in Python.

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 before code in test-driven development?

Test-driven development starts by writing a failing test that specifies the desired behavior, then writing minimal production code to make it pass, and finally refactoring while keeping tests green. This Red-Green-Refactor cycle ensures code meets requirements before implementation begins.

What's the Red-Green-Refactor workflow in TDD?

Red-Green-Refactor is the core TDD cycle: write a failing test (Red), implement the smallest code change to pass it (Green), then improve code quality without breaking tests (Refactor). This cycle repeats for each feature, bug fix, or behavior change.

Can I use test-driven development for bug fixes and refactoring?

Yes, TDD applies across feature development, bug fixes, refactoring, and behavior changes in any language. For bugs, write a failing test reproducing the issue, fix the minimal code to pass it, then refactor—ensuring the bug stays fixed.

How do I write effective unit and integration tests in TDD?

TDD guides writing tests that specify exact behavior before implementation. Tests should cover both unit behavior and integration points, focusing on what the code must do rather than how it does it, ensuring correctness and maintainability.

Why does test-driven development reduce bugs and improve design?

TDD enforces correct behavior by requiring tests to pass before code ships, catching defects early. Writing tests first clarifies requirements and forces modular, testable design, reducing complexity and improving long-term maintainability.

Can I start a TDD cycle for a new function in any programming language?

Yes, TDD applies across languages. Start by writing a failing test for your function's expected behavior, write minimal code to pass it, then refactor for clarity—the same cycle works whether you're using Python, JavaScript, Java, or other languages.

Related Skills