Skip to content

Test-Driven Development Guide

Makes the agent write a failing test first, then the minimal code to pass it, then refactor

Stars
8,444
Licence
MIT
Files
2 files

What it does

Once installed, the agent follows a strict test-first workflow when adding features, fixing bugs, or refactoring. It writes a small test that fails, runs the project's test command to confirm the failure is for the right reason, writes the least code needed to pass, reruns the full test suite, and only then cleans up the code. The instructions are written in Chinese. The skill also includes guidance on writing honest tests (avoid asserting mock behaviour, name the production change that should make a test fail, keep test-only helpers out of production classes) and a checklist the agent must satisfy before calling work done.

Great for

  • Developers who want AI-written code backed by tests that were seen to fail first
  • Teams that already use a test runner such as npm test, pytest or cargo test and want the agent to follow a disciplined red-green-refactor loop
  • Anyone fixing bugs who wants a regression test added before the fix

Skip it if

  • Throwaway prototypes, generated code or configuration work, which the skill itself exempts unless the user approves otherwise. Strict rules can slow down quick experiments
  • Projects with no test setup, since the workflow depends on running an existing test command. The agent would first need to set one up
  • Readers who need English-language instructions, because the SKILL.md text is in Chinese

Try asking

  • “Add a function that validates phone numbers, using TDD”
  • “Fix the bug where empty email addresses are accepted by the signup form, writing the failing test first”
  • “Refactor the payment module and keep the tests green at every step”
  • “Review my new feature branch and check whether each function has a test that failed before the code was written”
Step-by-step guide: how to use Test-Driven Development GuideInstall, 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

  • Ask the agent to name the test file and the expected failure before it writes any production code, so you can check the red step
  • Make sure the agent runs the whole project test suite, not just the new test, because the skill requires it before reporting completion
  • Review any test that passes immediately, since the skill treats that as a sign the test may not prove anything

What's inside

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

Redistributed unmodified from jnMetaCode/superpowers-zh 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.