test-driven-development

Enforces red-green-refactor test-first discipline for features, bugfixes, and refactoring.

Updated Jul 15, 2026
One-click install
npx skills add https://github.com/em411/supercodex --skill test-driven-development-em411
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/em411/supercodex/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/em411/supercodex --skill test-driven-development-em411

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code written before tests often ships with unverified behavior, and tests written after implementation pass immediately without proving they catch real bugs. This Skill enforces a strict test-first workflow so every change is backed by a test that was watched failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing one failing test, verifying it fails for the right reason, writing minimal code to pass, then refactoring while staying green. - Rationalization Detection: Lists common excuses ("too simple to test", "I'll test after") with counterarguments and red flags that trigger a restart. - Testing Anti-Patterns Reference: Companion guide covering mock-behavior testing, test-only production methods, incomplete mocks, and over-mocking. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection, watch it fail, implement the validation, and confirm the suite passes before committing. ## Quick Start Ask the agent to implement the next feature or bugfix using test-driven development with a failing test written and verified 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 for the next behavior.

How do I write a failing test for a bug fix?

Write a test that reproduces the bug, such as asserting that an empty email is rejected, and run it to watch it fail. Then implement the minimal fix and confirm the test passes along with the rest of the suite.

When is it acceptable to skip TDD?

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

Why should I delete code written before tests instead of keeping it?

Keeping pre-written code biases tests toward the implementation rather than the requirement, so tests pass immediately and prove nothing. Deleting it and rewriting test-first ensures each test was seen failing against missing behavior.

What testing anti-patterns should I avoid with mocks?

Never assert on mock existence, never add test-only methods to production classes, and never mock without understanding side effects the test depends on. Mock complete data structures matching the real API, and prefer integration tests when mocks become too complex.