Skip to content

Test-driven development

by obra

Strict red, green, refactor rules for coding agents: no production code without a failing test first, and the full suite run before done.

Test-driven development, from Jesse Vincent’s Superpowers collection, holds an agent to the discipline many people ask for and few agents follow. No production code is written without a test that failed first, and code written before its test is thrown away and redone in the right order.

Before calling work finished, the agent runs the whole test suite and reports every failure by name instead of summarising. A companion guide explains how to write tests worth having: name the change that would make each test fail, write expected values by hand, mock at the right level, and never assert on the mocks themselves. The examples use TypeScript, but the rules apply to any language.

It is instructions only, with no scripts, dependencies or network use.

What it is good for

  • Make an agent write the test before the fix
  • Stop changes being declared done with failing tests
  • Raise the quality of the tests an agent writes

Install

  1. Run this in a terminal. It adds the skill to Claude Code for every project:

    tmp=$(mktemp -d) && git -C "$tmp" init -q && git -C "$tmp" fetch -q --depth 1 https://github.com/obra/superpowers 22f0b463e7a5e579904dd6211a520321035526f7 && git -C "$tmp" checkout -q FETCH_HEAD && rm -rf "$tmp/.git" && mkdir -p ~/.claude/skills && rm -rf ~/.claude/skills/test-driven-development && mv "$tmp/skills/test-driven-development" ~/.claude/skills/test-driven-development && rm -rf "$tmp"
  2. Start a new Claude Code session. The agent uses the skill when a request matches it, or you can ask for it by name.

  3. To share it with your team, put the folder in .claude/skills/ inside the repository instead and commit it.

Read the source on GitHub · MIT license · Reviewed by Whenever on 2026-11-20

Browse more skills

Your first workflow is one sentence away.

One workflow free. No card. Weekly AI-building limits.