Test Driven Development
Force a coding agent to write a failing test first, then the minimum implementation, then refactor — so it cannot claim done without a red-green loop.
Get the complete skill folder, including its scripts and reference files.
·
When to use this skill
Use TDD when adding behavior to a codebase that already has a test runner. It is the default skill for "add a feature" in Claude Code or Codex.
When not to use it
Do not use it to explore a throwaway prototype with no test harness. Use Systematic Debugging when the tests already exist and are failing for unknown reasons.
How to install
Where will you use it?
Install the publisher’s plugin
This installs a bundle that can include other skills. Choose this method or the manual alternative below; you only need one installation.
Run these commands in Claude Code:
Claude Code CLI/plugin install superpowers@claude-plugins-official
- Ask Claude Code to use Test Driven Development on a small task and confirm that it loads. Check the setup requirements in the publisher’s guide if it cannot run.
Alternative: install the folder manually
Use these steps if you choose the manual folder method. If you installed the plugin above, skip this alternative.
- Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/test-driven-development/SKILL.md. For a shared project, commit the folder at .claude/skills/test-driven-development/ instead.
- Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
- For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.
What supports this recommendation?
82/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.
- Documentation
- 82/100
- Practical detail
- 92/100
- Source evidence
- 63/100
- Source signals
- 88/100
Model compatibility evidence
- claudeuntested
No model-specific signal or recorded compatibility test was found.
- chatgptuntested
No model-specific signal or recorded compatibility test was found.
- geminiuntested
No model-specific signal or recorded compatibility test was found.
- copilotuntested
No model-specific signal or recorded compatibility test was found.
- llamauntested
No model-specific signal or recorded compatibility test was found.
- perplexityuntested
No model-specific signal or recorded compatibility test was found.
- mistraluntested
No model-specific signal or recorded compatibility test was found.
- grokuntested
No model-specific signal or recorded compatibility test was found.
Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.
Try one small task
Best first exercise: watch a boundary test fail before adding the implementation.
See actual outputs and execution limits →What you need
- A scratch repository with a runnable test framework and write access.
- The Superpowers skill package and a small, explicit behavior contract.
Implement a non-negative integer validator through failing and passing tests.
Use test-driven-development in a scratch JavaScript project to implement isNonNegativeInteger(value). It must accept 0 and 7, and reject -1, 1.5, null and the string "7". Write one behavior test first, run it and record the failure, then implement only enough to pass. Add the remaining cases, run the full suite, and show the red/green command results. Keep the exercise isolated from my application.
Expected result
A specification to check against, not output from an AI run.
A small validator and a test record that shows an actual failing behavior assertion followed by passing checks.
- The first failure is the intended missing behavior, not an unrelated test-runner setup error.
- All six contract cases are checked and the final suite passes.
- The report includes executed command results rather than a simulated red/green transcript.
Where this exercise stops
- Tests check the specified contract; they cannot prove that the contract covers every real requirement.
- This exercise does not measure the agent against a no-skill baseline.
Recorded example run
These files came from actual execution in a Codex session. They were produced and checked within the same session; this is scoped evidence, not independent review or a measured success rate.
Integer validator: two recorded red/green cycles
Executed · Automated Codex exercise
Codex agent; Node.js 24.13.0, Python 3.12.3, Linux 7.0.0-1010-aws. Exact model version not exposed.
Wrote a zero behavior assertion with only an empty API scaffold, ran it to observe the intended failure, added the minimum behavior, expanded the contract, observed the next failures, and implemented the final predicate.
Download the actual outputs
- Run report
- Sources, snapshots and original evidence (ZIP)
- Executed command ledger
- First observed red
- First observed green
- Expanded contract red
- Final six passing cases
- Final validator
Recorded checks and observations
- Observed: The first test actually failed on undefined !== true; the runner and import setup worked.
- Observed: The minimal true implementation passed the zero test, then failed four newly added rejection cases.
- Observed: The final full contract suite passed all six cases.
Scope, limitations and pinned sources
- The agent read the pinned upstream instructions and used their prescribed tools. Native Claude skill loading and general cross-agent compatibility were not tested.
- The six fixtures cover the requested contract; they do not prove all future requirements or JavaScript edge cases.
- The exercise was isolated from the application and did not compare the agent with a no-skill baseline.
- The executor was Codex in this conversation; the exact model version was not exposed.
- These examples do not represent independent human users, customer outcomes or a compatibility certification.
Source and evidence
The upstream instructions informed this guide. The exercise and acceptance checks are an OpxSkills test recipe. Where a run is recorded, its actual outputs, environment and limits appear separately above. A recorded example does not establish general model compatibility or a success rate.
Source reviewed · Upstream revision 8ca22dba9a94
What this skill does
Without TDD, agents write code then hunt for a test. This skill reverses that: name the behavior, watch it fail, then implement.
Intended uses
- Add an API route with a contract test
- Fix a bug by first capturing it as a failing test
- Keep a refactor honest
Implementation notes
- One failing test at a time.
- If the test is hard to write, the interface is wrong — do not skip the test.
Try it, then tell us how it went
A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.