Skip to content

Test-Driven Development

Makes the agent write failing tests first, then code, and reproduce bugs with a test before fixing them.

Stars
112,668
Licence
MIT
Files
1 file

What it does

When installed, the agent follows a red-green-refactor loop: it writes a test that fails, writes the minimum code to make it pass, then cleans up while keeping tests green. For bug reports, it first writes a test that reproduces the bug before attempting a fix. It also discovers each project's own test commands and uses them throughout.

Great for

  • Developers who want AI-written code backed by automated tests
  • Teams fixing bugs who want a regression test added with every fix
  • Anyone asking an agent to change existing behavior in a codebase with a test suite

Skip it if

  • Pure configuration, documentation, or static content changes, which the skill itself says do not need it
  • Projects with no test setup, where the agent will first need to set up a framework, which may be more than a quick change

Try asking

  • “Fix this bug in my login function: users with trailing spaces in their email can't sign in. Write a test that reproduces it first.”
  • “Add tests for the calculateTax function and then add support for a new tax rate.”
  • “Change how the order total handles discounts, using TDD.”
  • “Implement a new createInvoice endpoint following the red-green-refactor cycle.”
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 1 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

  • Point the agent at the specific function or bug so it can write a precise reproduction test.
  • Let the agent discover your repo's test command; it is told not to assume npm test, so confirm it uses your project's real commands.
  • For browser-facing changes, the skill mentions combining TDD with Chrome DevTools MCP; the rest of the file (cut off in the provided text) covers further testing guidance.

What's inside

  • SKILL.md

Redistributed unmodified from addyosmani/agent-skills 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.