test-driven-development

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

1|Updated Jul 6, 2015
One-click install
npx skills add https://github.com/ksolomon/dotfiles --skill test-driven-development-ksolomon
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/ksolomon/dotfiles/tree/main/AI/.claude/plugins/cache/claude-plugins-official/superpowers/6.1.1/skills/test-driven-development
Command: npx skills add https://github.com/ksolomon/dotfiles --skill test-driven-development-ksolomon

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code written without tests first often ships with hidden bugs, untested edge cases, and no proof that tests actually verify behavior. This Skill enforces a strict test-first discipline so every feature and bugfix is backed by a failing test that was observed before implementation. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing a failing test, verifying it fails for the right reason, implementing minimal code, and refactoring while staying green. - Rationalization Defense: Provides concrete rebuttals to common excuses like "I'll test after" or "deleting work is wasteful" to keep the discipline intact. - Testing Anti-Pattern Reference: Covers pitfalls such as testing mock behavior, test-only methods in production classes, and incomplete mocks. - 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 all tests pass before refactoring. ## Quick Start Use the test-driven-development skill to implement this feature by writing a failing test first, then 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 on a new feature?▼

Write one minimal failing test describing the desired behavior, run it to confirm it fails for the expected reason, then write the simplest code to pass. Refactor only after all tests are green, and repeat the cycle for each new behavior.

How to fix a bug using TDD?▼

Write a failing test that reproduces the bug first, then implement the minimal fix until the test passes. The test proves the fix works and prevents the bug from regressing later.

When is it acceptable to skip test-driven development?▼

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and only with explicit approval from your human partner. Thinking "skip TDD just this once" is treated as rationalization.

Why should tests be written before implementation code?▼

Tests written after code pass immediately, which proves nothing about whether they test the right behavior. Watching a test fail first confirms it actually exercises the missing feature rather than existing behavior or mocks.

What are common testing anti-patterns with mocks?▼

Common anti-patterns include asserting on mock elements instead of real behavior, adding test-only methods to production classes, mocking without understanding side effects, and creating incomplete mock responses. Test real behavior and mock minimally at the correct level.