test-driven-development

Enforces red-green-refactor test-first workflow for implementing features and bugfixes.

Updated Aug 20, 2026
One-click install
npx skills add https://github.com/Pega88/agy-superpowers --skill test-driven-development-pega88
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Pega88/agy-superpowers/tree/main/.agents/plugins/superpowers/skills/test-driven-development
Command: npx skills add https://github.com/Pega88/agy-superpowers --skill test-driven-development-pega88

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code written before tests often ships with unverified behavior, hidden bugs, and no proof that tests actually catch failures. This Skill enforces a strict test-first discipline so every line of production code is backed by a test that was watched failing first. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides the agent through writing a failing test, verifying the failure, writing minimal passing code, and refactoring safely. - Rationalization Blocking: Explicitly counters common excuses like "I'll test after" or "too simple to test" with concrete rebuttals and red-flag stop conditions. - Test Quality Rules: A companion reference (writing-good-tests.md) defines how to name the break each test catches, avoid mock assertions, and run mutation checks. - Use Case: When asked to fix a bug where empty emails are accepted, the agent first writes a failing test asserting the rejection, watches it fail, then implements the minimal validation fix. ## Quick Start Ask the agent to implement a new feature or bugfix using test-driven development with a failing test written first.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I practice test-driven development on a new feature?

Write one minimal failing test describing the desired behavior, run it to confirm it fails for the right reason, then write the simplest code that passes. Refactor only while tests stay green, then repeat the cycle for the next behavior.

How do I fix a bug using TDD?

Write a failing test that reproduces the bug first, then follow the red-green-refactor cycle to fix it. The test proves the fix works and prevents the bug from regressing later.

When is it acceptable to skip test-driven development?

Only for throwaway prototypes, generated code, or configuration files, and only with explicit approval from your human partner. Exploration is fine, but the exploratory code must be discarded and rewritten test-first.

Why should tests be written before implementation code?

Tests written after implementation pass immediately, which proves nothing about whether they catch real bugs. Watching a test fail first confirms it tests the right behavior and is not biased by code already written.

When should mocks be used in unit tests?

Mock only slow or external dependencies after learning the real method's side effects, and never assert on the mock itself. If mock setup outgrows the test logic, switch to an integration test with real components.