Skip to content

Test-Driven Development

Guides an agent to write a failing test first, then minimal code, then refactor, when TDD is selected

Stars
8,553
Licence
Apache-2.0
Files
3 files

What it does

When installed, the agent follows a test-first workflow for code changes: it writes a small failing test, confirms it fails for the right reason, writes the simplest code to make it pass, then cleans up while keeping tests green. The skill also says TDD is a strong default rather than a rigid rule, so the agent should apply it where it reduces real risk (core logic, contracts, tricky edge cases) and skip it for throwaway prototypes, generated code, or trivial config tweaks. A companion file lists common testing anti-patterns to avoid.

Great for

  • Developers who want an AI agent to write tests before implementation on features and bug fixes
  • Teams in a project that already uses a test runner and wants disciplined red-green-refactor steps
  • People who want agents to avoid writing tests that only mock code or pass trivially

Skip it if

  • Quick prototypes, one-line copy edits or generated code where test-first adds little value (the skill itself says so)
  • Projects with no test runner set up: the examples assume commands like npm test, so the agent must adapt them, and it cannot verify the right failure without one
  • Anyone expecting the skill to enforce approvals or completion gates; it explicitly grants no extra authority to delete code or add human review steps

Try asking

  • “Implement a retry helper for API calls using test-first development”
  • “Fix this login bug: write a failing test that reproduces it first, then fix it”
  • “Add an email validation feature with tests written before the implementation”
  • “Review my tests and point out any that mock too much or test implementation details”
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 3 original files, the Apache-2.0 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

  • Name the project's test command (for example npm test or pytest) so the agent runs the right failing and passing checks.
  • Point the agent at the specific behavior you want tested to keep each red-green cycle small.
  • Be aware the skill is a shipping-oriented default; if you need strict TDD on every change, state that explicitly in your request.

What's inside

  • LICENSE.txt
  • SKILL.md
  • testing-anti-patterns.md

Redistributed unmodified from mvschwarz/openrig under the Apache-2.0 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.