1. Habit
  2. Skills
  3. Test-Driven Development skill
Jesse Vincent · 257K installsPrime Radiant · Keyboardio · Request Tracker, Superpowers

Test-Driven Development skill
Runs by itself, when a feature or bug task starts.

Code you can trust.

Install the Test-Driven Development skill and make it a habit: follow https://gethabit.dev/skills/obra/test-driven-development.md

  1. 1Copy
  2. 2Paste into Claude Code, Codex or Cursor
  3. 3It runs by itself

257K installs303K starsMIT licenceSource on GitHub ↗

Test-Driven Development

by Jesse Vincent · 257K installs

The skill

Makes your agent write a failing test first, then the least code to pass.

Only when you ask.

Fewer bugs

Code you can trust. Fewer bugs, since every change starts with a test.

↻ Runs by itselfwhen a feature or bug task starts

How the habit works.
You don't have to.

Three questionsWhen does it start? How does it check its work? What does it remember?

One run, step by step.
Then it stops.

Stop ruleStops after one behavior per cycle and one task per run.

  1. 01

    Write failing test

    Write one small test with a clear name for one behavior.

  2. 02

    Watch it fail

    Run it, for example with npm test, and confirm it fails because the feature is missing.

  3. 03

    Write minimal code

    Write the simplest code that makes the test pass and nothing more.

  4. 04

    Run the full suite

    Run the project's test command, such as pytest, npm test or cargo test, and report every failure by name.

  5. 05

    Refactor

    Clean up names and duplication while all tests stay green.

  6. 06

    Ask on exceptions

    For prototypes, generated code or config files, ask your human partner first.

What it may do.
Nothing more.

Safe by defaultIt writes only in its own folder and asks you before anything goes out.

Is it for you?
Use it when it fits.

Quick checkRead both lists. If the left one sounds like you, the Test-Driven Development skill helps.

Use it when

  • ✓ you add a new feature
  • ✓ you fix a bug
  • ✓ you change behavior or refactor

Skip it when

  • – it is a throwaway prototype
  • – the file is generated code or config

Questions

Test-Driven Development skill, answered.

What if the new test passes at once?

Then it tests behavior that already exists. The loop fixes the test before it writes any code.

Is one green test file enough?

No. The skill asks for the whole project suite and a report of every red test by name.

What about code written before the test?

The skill says delete it and start again from the test.

How do I install the Test-Driven Development skill?

Copy the prompt at the top into your agent. It installs the skill from obra/superpowers and sets up the habit. Or run npx skills add obra/superpowers --skill test-driven-development.

Is the Test-Driven Development skill free?

Yes. It is published under MIT. Habit is free too.

Test-Driven Development. Now as a habit.

Install the Test-Driven Development skill and make it a habit: follow https://gethabit.dev/skills/obra/test-driven-development.md

  • Free
  • No account
  • Undo in one line

All Jesse Vincent skills →More code skills →

Works in

  • Claude Code
  • Codex
  • Cursor
  • ChatGPT
  • Claude app

Made by Jesse Vincent, published under MIT. Habit links to the original and never changes it. Is this your skill?

Copying didn't work here. Select the line and copy it by hand.