test-driven-development

Enforces red-green-refactor test-driven development workflow before writing production code.

Updated Aug 14, 2026
One-click install
npx skills add https://github.com/bill80362/laravel-thread-admin --skill test-driven-development-bill80362
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/bill80362/laravel-thread-admin/tree/main/.github/superpowers/test-driven-development
Command: npx skills add https://github.com/bill80362/laravel-thread-admin --skill test-driven-development-bill80362

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developers often write production code first and add tests afterward, which produces tests that pass immediately without proving they can catch bugs. This Skill enforces a strict test-driven development discipline so every feature, bug fix, and refactor is backed by a test that was seen to fail first. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides the AI to write a failing test, verify it fails for the right reason, write minimal code to pass, then refactor while keeping tests green. - Anti-Rationalization Rules: Provides a table of common excuses ("too simple to test", "I'll add tests later") with concrete rebuttals, plus red-flag signals that require deleting code and restarting with TDD. - Test Quality Reference: A companion guide (writing-good-tests.md) covering how to name the breakage each test catches, avoid mocking real behavior, derive expected values independently, and run mutation checks. - Use Case: When fixing a bug where empty emails are accepted, the Skill directs writing a failing test asserting the rejection error, verifying the failure, then implementing the minimal validation fix. ## Quick Start Ask the AI to implement a new feature or fix a bug using test-driven development, writing the failing test before any production code.

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 when fixing a bug?

Write a failing test that reproduces the bug first, then run it to confirm it fails for the expected reason. Implement the minimal fix to make it pass, verify all tests stay green, and refactor if needed. The test both proves the fix and prevents regression.

What is the red-green-refactor cycle in TDD?

Red means writing a minimal failing test for one behavior. Green means writing the simplest code that makes it pass. Refactor means cleaning up duplication and naming only while tests stay green, then repeating the cycle for the next behavior.

When is it acceptable to skip test-driven development?

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and require explicit approval from your human partner. Writing code first and adding tests later is not an accepted exception because such tests never proved they can fail.

Why should tests avoid asserting on mocks?

An assertion against a mock only verifies the mock exists, not the real component's behavior. Mock only the slow or external layer after understanding the real method's side effects, and keep everything the test depends on running as real code.

What should I do if I already wrote code before tests?

Delete the implementation and start over with TDD. Keeping it as reference leads to adapting it during testing, which produces after-the-fact tests that pass immediately and prove nothing about catching bugs.