test-driven-development

Enforces test-first development using the red-green-refactor cycle for features and bugfixes.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/erwinv2k-TKG/AgentesVSC --skill test-driven-development-erwinv2k-tkg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/erwinv2k-TKG/AgentesVSC/tree/main/packs/superpowers/skills/test-driven-development
Command: npx skills add https://github.com/erwinv2k-TKG/AgentesVSC --skill test-driven-development-erwinv2k-tkg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It prevents untested production code by requiring a failing test before any implementation, eliminating the false confidence of tests written after the fact. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Guides writing a failing test, verifying the failure, implementing minimal code, and refactoring while staying green. - Anti-Rationalization Rules: Counters common excuses like "I'll test after" or "deleting code is wasteful" with concrete reasoning. - Testing Anti-Patterns Reference: Covers testing mock behavior, test-only production methods, incomplete mocks, and mocking without understanding dependencies. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection, watch it fail, implement the minimal validation, and confirm all tests pass. ## Quick Start Use the test-driven-development skill to implement this feature by writing a failing test first, then the minimal code to pass it.

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 step by step?

Write one minimal failing test for a single behavior, run it and confirm it fails for the expected reason, write the simplest code to make it pass, verify all tests pass, then refactor while keeping tests green. Repeat for each new behavior.

Why should tests be written before implementation code?

Tests written after code pass immediately, which proves nothing about whether they test the right thing. Watching a test fail first confirms it actually detects the missing behavior and is not biased by the existing implementation.

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 should be discarded and rewritten test-first.

What should I do if I already wrote code before the test?

Delete the implementation and start over with a failing test. Keeping it as reference leads to adapting it, which is effectively testing after. The sunk time is already gone; unverified code is technical debt.

Why does my test pass immediately after writing it?

An immediately passing test means it is testing existing behavior or testing nothing meaningful. Fix the test so it fails for the expected reason, such as a missing feature, before writing any implementation code.

How do I avoid testing mock behavior instead of real code?

Never assert on mock elements or test IDs; test the real component's behavior. Mock only after understanding the dependency's side effects, mirror complete real API responses, and move test-only cleanup into test utilities rather than production classes.