Skip to content
HUIAHUB

obra/superpowers/skills/test-driven-development

Test-driven development

For use when implementing any feature or bug fix, before any implementation code is written.

Agent skillAgent skillsMIT
No scriptsNo networkNo hooksNo secretsSee the security check

What Test-driven development does

The skill holds the agent to a strict red, green, refactor loop. For each behavior it writes one small test with a clear name, using real code and mocks only when they cannot be avoided. It then runs that test and checks that it fails for the expected reason, because the feature is missing rather than because of a typo. Only after that does it write the simplest code that makes the test pass.

Next the agent runs the test again and also runs the project's whole test command, such as npm test, pytest or cargo test, and reports any failure by name, including ones it did not cause. Refactoring comes only once everything is green. The SKILL.md states one rule above the others: production code is not written before a failing test exists, and code written first is deleted and rewritten from tests. Throwaway prototypes, generated code and config files are exceptions the agent asks you about.

A second file, writing-good-tests.md, is read whenever the agent writes or changes a test. It asks the agent to name the production change that would make each test fail, to use hand-written expected values, to avoid asserting on mocks, and to keep test-only helpers out of production classes. At the end you get code where each function has a test that was watched failing first, plus a checklist the agent goes through before calling the work done.

Install

/plugin install superpowers@claude-plugins-official

Read the security check below before you run it. The repository's own instructions win if they differ.

Security check

What the skill's files do, from reading them. A flag that nobody has checked yet says "Not checked", never "No".

Runs scripts
No
Uses the network
No
Installs hooks
No
Asks for secrets
No

The folder holds two Markdown files, SKILL.md and writing-good-tests.md. The scan found no scripts, hook definitions, network calls or secret variables, and a file-by-file reading agrees. The skill does tell the agent to run your project's own test command and to delete code written before a test. Installing the Superpowers plugin brings more than this skill: its hooks/hooks.json registers a SessionStart hook that runs hooks/session-start on startup, clear and compact and adds the using-superpowers SKILL.md to the session context. Read those hook files and try the plugin in a test repository first.

Scan details: No scripts, hook definitions, network calls or secret variables were found in the skill folder. Checked at commit 22f0b463e7a5.

Use cases

  • Building a new feature one failing test at a time
  • Fixing a bug by first writing a test that reproduces it
  • Changing behavior or refactoring code that needs tests to stay safe
  • Reviewing whether existing tests check real behavior instead of mocks

Limitations

  • Tells the agent to delete code written before its test, which can discard work.
  • Needs a project with a working test command the agent can run.
  • Prototypes, generated code and config files are exceptions the agent must ask about.
  • Installed as part of the Superpowers plugin, so it arrives with the other Superpowers skills.

Sources