# Test driven development

> Test driven development is an open-source agent skill for developer tools. Guides an agent through red-green-refactor test-first development and bug reproduction. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/addyosmani/agent-skills/tree/main/skills/test-driven-development
- **Repository:** https://github.com/addyosmani/agent-skills
- **GitHub stars:** 122,283
- **License:** MIT
- **Skill name:** test-driven-development
- **Collection:** https://github.com/addyosmani/agent-skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill makes the agent write a failing test before changing any logic, whether it is a new behavior, a bug fix or an edit to existing functionality. For bug reports it has the agent reproduce the defect in a test first, then implement the fix and confirm the test passes along with the rest of the suite.

Before writing the first test, the agent is told to discover how the repository runs its tests: checking the build files, checked-in wrappers, test configuration, neighboring test conventions and documented CI commands, and to use those commands rather than a default like npm test. It also covers test sizing, preferring real implementations over mocks, arrange-act-assert structure, and naming tests after the behavior they check.

For browser-based changes it points to combining the workflow with Chrome DevTools MCP for runtime checks such as console, network and DOM inspection. The skill includes a JavaScript and TypeScript patterns reference file, but its examples are illustrative and the process applies to any language.

## When your agent uses it

> Drives development with tests using the red-green-refactor loop. Use when implementing any logic, fixing any bug, or changing any behavior. Use when you need to prove that code works, when a bug report arrives, or when you're about to modify existing functionality. Use when asked to add tests to a function, fix a bug in it or change its behavior, even when the code is pasted inline, the request does not mention tests and the answer looks obvious from reading it. The skill writes the failing test first and changes the function second, never the change alone.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/addyosmani/agent-skills/tree/HEAD/skills/test-driven-development)
- [License: MIT](https://github.com/addyosmani/agent-skills/tree/HEAD/skills/test-driven-development)

## Features

- **Red-green-refactor loop:** Walks the agent through writing a failing test, minimal passing code and a clean-up step.
- **Bug reproduction first:** Has the agent write a test that demonstrates a reported bug before attempting a fix.
- **Repository command discovery:** Directs the agent to find and use the project's own test runner and full-suite command.
- **Test quality guidance:** Covers state-based assertions, test isolation, naming and limiting mocks to boundaries.
- **Test pyramid and sizing:** Explains small, medium and large test categories and how to split testing effort between them.
- **Browser runtime verification:** Describes using Chrome DevTools MCP to inspect console, network, DOM and performance during UI fixes.

## Good for

- Add tests before implementing a new function or feature
- Reproduce a reported bug with a failing test, then fix it
- Change existing behavior while keeping the test suite green
- Verify a front-end fix by checking console and network output in a browser

## Install

### Claude Code

This skill ships in the `agent-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add chrisalehman/bionic
/plugin install agent-skills@bionic
```

Or copy only this skill to `~/.claude/skills/test-driven-development`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/addyosmani/agent-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/test-driven-development &&
cp -R "$tmp/skills/test-driven-development" ~/.claude/skills/test-driven-development &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/test-driven-development` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/test-driven-development` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/addyosmani/agent-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/test-driven-development &&
cp -R "$tmp/skills/test-driven-development" ~/.agents/skills/test-driven-development &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/test-driven-development` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/test-driven-development` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/addyosmani/agent-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/test-driven-development &&
cp -R "$tmp/skills/test-driven-development" ~/.cursor/skills/test-driven-development &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/test-driven-development` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/addyosmani/agent-skills.git --path skills/test-driven-development
```

Or copy the folder to `~/.gemini/skills/test-driven-development` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/test-driven-development`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/addyosmani/agent-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/test-driven-development &&
cp -R "$tmp/skills/test-driven-development" ~/.copilot/skills/test-driven-development &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/test-driven-development` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/addyosmani/agent-skills.git
```

Then copy `agent-skills/skills/test-driven-development` into your agent's skills folder as `test-driven-development`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill change in my project?

It changes how the agent works: it writes a failing test first and uses the repository's own test commands for each step. It does not add files of its own beyond the skill folder.

### Does Test driven development need any scripts or tools?

It ships no scripts. Browser checks need Chrome DevTools MCP, and the examples assume TypeScript, though the workflow applies to any language.

### When does Test driven development trigger?

Its description says it applies when implementing logic, fixing bugs or changing behavior, including when the request does not mention tests.

### How do I install Test driven development in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/test-driven-development to use it in all your projects, or to .claude/skills/test-driven-development in one project. Or install the agent-skills plugin, which includes it: /plugin marketplace add chrisalehman/bionic, then /plugin install agent-skills@bionic.

### Does Test driven development run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Test driven development?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Test driven development?

The closest alternatives to Test driven development are TDD, TDD workflow, TDD, TDD and TDD loop.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [TDD](https://ai-powered.com/skills/tdd): TDD is an open-source agent skill for developer tools.
- [TDD workflow](https://ai-powered.com/skills/tdd-workflow-nabwinsaud): TDD workflow is an open-source agent skill for developer tools.
- [TDD](https://ai-powered.com/skills/tdd-kripu77): TDD is an open-source agent skill for developer tools.
- [TDD](https://ai-powered.com/skills/tdd-michael-denyer): TDD is an open-source agent skill for developer tools.
- [TDD loop](https://ai-powered.com/skills/tdd-loop): TDD loop is an open-source agent skill for developer tools.
- [Cpp testing](https://ai-powered.com/skills/cpp-testing): Cpp testing is an open-source agent skill for developer tools.
- [Testing strategy](https://ai-powered.com/skills/testing-strategy): Testing strategy is an open-source agent skill for developer tools.
- [Bug](https://ai-powered.com/skills/bug-jasgujral): Bug is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/test-driven-development-addyosmani
