Test-Driven Development
Independent PiSkill directory guide. The original skill remains hosted by Superpowers.
What is Test-Driven Development?
Enforces test-first implementation for features, bug fixes, refactors, and behavior changes using a strict red-green-refactor workflow and explicit verification.
What does Test-Driven Development do?
Test-Driven Development is a Superpowers skill that enforces a strict red-green-refactor loop for features, bug fixes, refactors and behavior changes. Its central rule is that production code should not be written until a test exists and has been observed failing for the expected reason.
Who is Test-Driven Development best for?
- Developers using AI coding agents on behavior changes
- Teams trying to prevent regressions from rapid implementation
- Engineers refactoring code with stronger safety
- Projects where test-first discipline is part of the development process
Common use cases
- Implement a new feature by writing the behavior test first
- Reproduce a bug with a failing regression test before fixing it
- Refactor code while keeping tests green
- Use tests to clarify the desired public API before implementation
How does Test-Driven Development work?
The workflow starts with one minimal failing test, verifies that it fails for the intended reason, writes the smallest code needed to make it pass, verifies the full test suite and only then refactors. It explicitly treats immediately passing tests and post-hoc tests as insufficient evidence of test-driven development.
Key benefits
- Creates direct evidence that a test can catch the missing behavior
- Reduces regression risk during changes
- Encourages simpler, testable interfaces
- Provides a repeatable development loop for AI agents
Things to know
- Strict TDD can be disproportionate for throwaway prototypes or some generated/configuration work
- Bad tests can still encode the wrong requirement
- Legacy code with heavy coupling may require design work before the workflow is comfortable
Compatible tools
Frequently asked questions
What is the core rule of the Test-Driven Development skill?
Can this be used for bug fixes?
Related skills
Systematic Debugging
Guides agents through root-cause-first debugging for test failures, production bugs, performance problems, build failures, and unexpected behavior instead of guessing at fixes.
Verification Before Completion
Requires fresh evidence before an agent claims work is fixed, passing, or complete, making it especially useful for validating AI-generated code before commits or pull requests.
Azure Diagnostics
Investigates Azure application and infrastructure failures using resource state, logs, metrics, configuration, and dependency evidence, then recommends scoped remediation.
Azure Validation
Validates Azure application and infrastructure readiness before deployment by checking configuration, permissions, dependencies, templates, and expected operational behavior.
Hugging Face Community Evals
Runs model evaluations with community evaluation tooling such as inspect-ai and lighteval on local hardware, supporting reproducible comparison of Hugging Face models.
Microsoft DebugView
Uses focused diagnostics and debugging evidence to investigate application behavior, logs, failures, and runtime state without replacing root-cause analysis with speculative fixes.