Test-Driven Development
Enforces red-green-refactor discipline in agent coding sessions: write a failing test first, make it pass with the smallest change, then refactor with tests as the safety net.
Install:
Install the Superpowers plugin for Claude Code (see the obra/superpowers repo README for the current marketplace install steps), which bundles this skill.
Source: https://github.com/obra/superpowers/tree/main/skills/test-driven-development
Repository: https://github.com/obra/superpowers
Updated 27 November 2026.
Used in: Micro-SaaS with AI Coding Tools
What it does
- Strict red-green-refactor cycle for new behaviour
- Requires watching the test fail before implementing
- Keeps implementations minimal: only enough code to pass
- Uses the test suite as a regression net during refactoring
- Part of the widely used Superpowers plugin for Claude Code
Use it for
- Build a new feature with tests that prove it works
- Add behaviour to legacy code without breaking it
- Make an agent verify its own work as it goes
What it does
Test-Driven Development makes the agent work the way disciplined developers are taught to: red, green, refactor. Write a test for the behaviour you want and watch it fail — proving the test actually tests something. Write the smallest implementation that makes it pass. Then refactor, with the passing suite as proof nothing broke. For agent-written code this discipline matters doubly: the tests are a specification the agent must satisfy, a verification you can inspect, and a regression net that survives the session, long after the conversation that produced the code is gone.
How to install and use
The skill ships as part of the Superpowers plugin: install the plugin following the README in the obra/superpowers repository, and the skill becomes available in Claude Code. It engages on feature and bugfix work. Your part is to describe behaviour in testable terms — inputs, outputs, edge cases — and to actually look at the failing-then-passing test runs the agent reports.
Example use
Ask: ‘Add discount codes to the checkout: percentage and fixed-amount, expired codes rejected.’ The agent first writes tests covering a valid percentage code, a fixed code, an expired code and a code on an empty cart, shows them failing, then implements until they pass — and the edge cases you would have forgotten to mention are pinned down in the test list where you can see them.
Good to know
TDD slows the first hour and speeds up every hour after; on a throwaway script that trade is wrong, and the skill is meant for code that will live. Also, tests written to be passed prove little — check that the tests assert real behaviour and that the failure step genuinely happened, rather than accepting a green suite at face value.
When a test fails for reasons that are not obvious, Systematic Debugging is the discipline to switch to; for browser-level behaviour, Webapp Testing covers Playwright checks. The two together are the closest thing this directory has to a quality gate.
Requirements
You need an agent that supports the Agent Skills standard — Claude Code is the target tool listed for this skill — plus the install command shown at the top of this page: Install the Superpowers plugin for Claude Code (see the obra/superpowers repo README for the current marketplace install steps), which bundles this skill.. The skill itself is a folder of instruction files (a SKILL.md, and in some cases bundled scripts or reference files) that the agent loads when a task matches its description. Nothing in the skill replaces the underlying tool it guides: where the skill covers an API, a document format or a platform, you still need your own access and accounts for that platform.
Safety notes
Installs as local instruction files — a SKILL.md plus any bundled scripts or assets — that your agent reads and follows locally. Review the SKILL.md and any scripts in the skill folder before first use; no third-party security scan was run and no scan result is claimed.
In practice: read the SKILL.md before the first run, skim any bundled scripts for network calls or file writes outside the project, and run the skill first on a copy of a real file rather than the original. A skill’s instructions are followed by your agent with your permissions, so the review standard is the same one you would apply to a script a stranger handed you. What was verified for this entry: Verified via the GitHub API on 2026-11-27: the skill exists in obra/superpowers’s skills directory. Description rewritten in our own words; popularity/install counts deliberately not reproduced.
Before you rely on it
Run the example task from the section above on a small, real job and compare the output with doing the same job unaided. Keep the skill if it removes steps or errors you actually make; remove it if it only adds ceremony. Skills cost a description line of context on every session until they trigger, so a directory of unused skills is not free — it is a small, permanent tax on every conversation.
Safety notes
Verified via the GitHub API on 2026-11-27: the skill exists in obra/superpowers's skills directory. Description rewritten in our own words; popularity/install counts deliberately not reproduced.
Installs as local instruction files — a SKILL.md plus any bundled scripts or assets — that your agent reads and follows locally. Review the SKILL.md and any scripts in the skill folder before first use; no third-party security scan was run and no scan result is claimed.