test-driven-development

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

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/Pgooone/oh-pgone-claudecode --skill test-driven-development-pgooone
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Pgooone/oh-pgone-claudecode/tree/main/.claude/plugins/cache/superpowers-marketplace/superpowers/5.0.6/skills/test-driven-development
Command: npx skills add https://github.com/Pgooone/oh-pgone-claudecode --skill test-driven-development-pgooone

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often write production code first and add tests afterward, which produces tests that pass immediately and prove nothing about correctness. This Skill enforces a strict test-first discipline so every feature and bugfix is backed by a test that was watched failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing a failing test, verifying it fails for the right reason, writing minimal code to pass, then refactoring while staying green. - Rationalization Detection: Lists common excuses for skipping TDD (e.g., "too simple to test", "I'll test after") and explains why each is invalid. - Testing Anti-Pattern Reference: Covers pitfalls like testing mock behavior, adding test-only methods to production classes, incomplete mocks, and mocking without understanding dependencies. - Use Case: When fixing a bug where an empty email is accepted, write a failing test asserting the rejection error, 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 make it pass.

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 and confirm it fails for the expected reason, then write the simplest code to make it pass. After green, refactor while keeping all tests passing, and repeat for the next behavior.

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

Write a test that reproduces the bug by asserting the correct behavior, then run it to confirm it fails. Implement the minimal fix, verify the test passes and no other tests break, which also prevents future regressions.

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

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and should be confirmed with your human partner. Exploration is allowed, but the exploratory code must be discarded and rewritten test-first.

Why should I delete code written before the test?▼

Code written before a failing test cannot be trusted because its tests would pass immediately and prove nothing. Keeping it as reference leads to adapting it during testing, which is equivalent to testing after implementation.

What are common mocking anti-patterns in unit tests?▼

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 mocks missing fields downstream code uses.