Skip to content

Guide · Agent skill

How to use the Test-Driven Development agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The test-driven-development skill is a set of instructions that tells an AI agent to write a failing test before it writes implementation code for a feature or bug fix. This guide explains what the skill changes about the agent's behavior, how to install it from a ZIP file, how to ask for it in plain language, and what to check before relying on it. By the end you will know how to set it up, what your project needs, and when the skill tells the agent to skip test-first work.

Test-Driven Developmentmvschwarz/openrig · Apache-2.0

Quick start

  1. 1Download the package. Download the ZIP file for the test-driven-development skill from this page.
  2. 2Unzip it into the right folder. Unzip into ~/.claude/skills/ for personal use, or into your project's .claude/skills/ folder for one project.
  3. 3Or upload it in the Claude apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the skill.
  4. 4Confirm your test runner works. Run your project's test command, such as npm test, so the agent has a working way to see tests fail and pass.
  5. 5Describe the change and ask for tests first. Ask for a feature or bug fix in plain language and say you want the failing test written first.
  6. 6Review the first failing test. Check that the test names one behavior, uses real code where practical, and fails for the expected reason before implementation begins.

What does the test-driven-development skill make the agent do?

The skill asks the agent to follow a red-green-refactor cycle for code changes. The agent writes one minimal failing test, confirms that it fails for the expected reason, writes the simplest code that makes it pass, and then cleans up the code while keeping the tests green.

The skill is explicit that TDD is a strong default, not a rigid rule. The agent is asked to use it where a failing test pins down behavior that could easily go wrong, such as core logic, contracts and tricky edge cases. For throwaway prototypes, one-line copy tweaks, generated code and configuration files, the skill says proportionate verification is enough.

  • RED: write one test for one behavior and confirm it fails correctly
  • GREEN: write the minimal code to pass that test
  • REFACTOR: remove duplication and improve names, without adding behavior
  • A companion file, testing-anti-patterns.md, lists testing mistakes to avoid, such as testing mock behavior instead of real code

How do you install the test-driven-development skill?

Download the ZIP file from this page. The package contains LICENSE.txt, SKILL.md and testing-anti-patterns.md. You can install it in one of two ways.

For a personal install, unzip the package into ~/.claude/skills/ so the skill is available across your projects. For a single project, unzip it into that project's .claude/skills/ folder so it applies only there.

In the Claude apps, you can instead upload the skill under Settings → Capabilities → Skills.

  • Personal: unzip into ~/.claude/skills/
  • Project only: unzip into the project's .claude/skills/ folder
  • Claude apps: Settings → Capabilities → Skills, then upload

How do you trigger the skill with natural requests?

The skill's description says it applies when implementing any feature or bugfix, before writing implementation code. You do not need a special command. Describe the change in normal language and say that you want tests first, so the agent knows to follow the cycle.

Naming the behavior you want helps the agent write a useful first test. Mention your test runner if you have one, because the examples in the skill assume commands such as npm test.

  • Add a retry to the payment client. Write the failing test first, then implement it.
  • Fix the bug where empty email addresses pass validation. Start with a test that reproduces it.
  • Refactor the date parser, keeping the existing tests green and adding a test for the timezone edge case first.
  • Before changing the cart total logic, write a test that shows the current expected behavior fails for the new rule.

What does a test-first run look like?

Suppose you ask the agent to add retry behavior to an operation. The skill's own example shows a good first test: it has a clear name, tests real behavior, covers one thing, and uses the real function rather than a heavy mock. The skill's example retries an operation until it succeeds on the third attempt and checks the result and the attempt count.

The agent then runs the test and must see it fail because the feature is missing, not because of a typo. Only after that does it write the smallest implementation that passes.

  • A test that passes right away is treated as testing existing behavior, so the test needs fixing
  • A test that errors rather than fails must be corrected and re-run
  • The skill warns against over-engineering, such as adding backoff options before a test requires them
npm test path/to/test.test.ts

What does the skill need and what are its limits?

The source lists no required dependencies. In practice, the skill depends on your project having a test runner. The examples use npm test, so the agent must adapt them to your toolchain. Without a test runner, the agent cannot verify that a test fails for the right reason.

The skill also grants no authority to delete code or add human review steps. If you need approvals or completion gates, set them up in your own project or workflow. The skill does not enforce them.

  • Requires: nothing listed in the skill metadata, but a working test runner is needed for the workflow to work
  • Runs scripts: no
  • Uses network: no
  • Existing or others' code is preserved; the skill says to set aside only your own change when establishing a failing baseline

What should you check before relying on it?

Read the first failing test the agent writes. Check that it names one behavior, does not simply mock the code under test, and fails for the reason you expect. The companion anti-patterns file describes the mock-heavy tests the skill is designed to avoid.

If you are working on existing code that you have already changed, the skill says to demonstrate the failing baseline in an isolated copy or by setting aside only your owned change. It also says that tests written after the code do not count as TDD. If a baseline cannot be shown, the agent should record that limit.

  • Confirm the test fails for the missing behavior, not a syntax or import error
  • Check that the test uses real code where practical
  • Keep an eye on whether the agent skipped test-first work for a case the skill allows it to skip

What people use it for

  • Adding a new function to a service where a wrong result would be costly, with a failing test written first
  • Reproducing a reported bug as a failing test, then fixing it so the test passes
  • Refactoring existing logic while keeping the current tests green and adding tests for new edge cases
  • Changing a contract or API behavior where a test documents the intended result before the code changes

Frequently asked questions

How do I install the test-driven-development agent skill?

Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder for one project. In the Claude apps, you can also upload it under Settings → Capabilities → Skills.

What does the test-driven-development skill require?

The skill metadata lists no requirements, and it runs no scripts and uses no network. In practice you need a working test runner, because the skill's examples assume commands such as npm test and the agent cannot verify a correct failure without one.

Is the test-driven-development skill free?

The skill's bundled LICENSE.txt is an MIT License by Jesse Vincent, which permits use, copying and modification with the notice included. This directory lists the item as Apache-2.0, which does not match the bundled file, so read LICENSE.txt yourself before redistributing or relying on the terms.

Does the skill always force TDD on every change?

No. The skill describes TDD as a strong default and says to apply it where it reduces real risk. It says throwaway prototypes, one-line copy edits, generated code and trivial configuration can use proportionate verification instead.

Can the skill make the agent delete code or require my approval?

No. The skill explicitly grants no authority to delete code and does not add human review steps. If you want approvals or completion gates, you need to set them up in your own workflow.

How is this different from just asking the agent to write tests?

The skill requires the failing test to be watched before implementation, and it asks for a minimal test and minimal code. Tests written after the code pass immediately, which the skill says proves little, so the workflow is designed to show the test catches the missing behavior first.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you work in a project with a test runner and want an AI agent to write a failing test before features and bug fixes, with minimal code afterwards. Pick something else if you mainly build quick prototypes, need enforced approvals, or have no test setup, because the skill itself says test-first adds little value in those cases and cannot verify failures without a runner.

Download the skill