Skip to content

Test-Driven Development

Makes the agent write a failing test before any feature, bugfix, or behavior change code.

Stars
310,931
Licence
MIT
Files
2 files

What it does

When installed, the agent follows a strict test-first workflow whenever it implements a feature, fixes a bug, refactors, or changes behavior. It must write a small test, run it and confirm it fails for the right reason, then write the minimum code to make it pass, and finally tidy up while keeping tests green. It also pushes back on shortcuts like skipping tests or writing them after the code, and points to a companion guide on writing honest tests.

Great for

  • Developers who want AI-written code to come with meaningful automated tests
  • Teams that already practise test-driven development and want the agent to follow the same discipline
  • Anyone fixing bugs who wants a reproducing test before the fix

Skip it if

  • Throwaway prototypes, generated code, or configuration changes, which the skill itself lists as exceptions; the agent is told to ask first, so it may slow quick experiments down
  • Projects without an existing test setup or command, since the workflow assumes tests can be run and will not help set one up
  • Non-developers, because the instructions assume familiarity with test runners, mocks and code structure

Try asking

  • “Add a retry feature to our API client, test first”
  • “Fix the bug where empty email addresses are accepted, starting with a failing test”
  • “Refactor the billing module and keep the test suite green throughout”
  • “Write tests for the new user-export function before implementing it”
Step-by-step guide: how to use Test-Driven DevelopmentInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 2 original files, the MIT licence and an attribution note.

    test-driven-development.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip test-driven-development.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip test-driven-development.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Give the agent a clear task so it can name the failing behavior it is testing before writing code
  • Ask it to run the project's full test command, not just the new test, since the skill requires reporting any failures it sees
  • Expect it to ask you before skipping TDD for prototypes or config files; answer explicitly if you want an exception

What's inside

  • SKILL.md
  • writing-good-tests.md

Redistributed unmodified from obra/superpowers under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.