# TDD

> TDD is an open-source agent skill for developer tools. Guides the agent to write a failing regression test before fixing a bug. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/michael-denyer/pstack-claude/tree/main/plugins/pstack/skills/tdd
- **Repository:** https://github.com/michael-denyer/pstack-claude
- **GitHub stars:** 5,057
- **License:** MIT
- **Skill name:** tdd
- **Collection:** https://github.com/michael-denyer/pstack-claude
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

This skill tells the agent to reproduce a bug as an executable check before touching production code. The agent identifies the intended and current behavior, picks the narrowest existing test path for that code, writes a focused test, confirms it fails for the reason the bug predicts, and then makes the smallest fix and reruns the test.

The skill is deliberately selective. It steers the agent away from tests that would need heavy harness setup, brittle mocks, slow end-to-end infrastructure or large fixture changes, and suggests a targeted script, manual reproduction, browser check or log assertion instead. It also sets guardrails against editing tests just to match a wrong implementation or weakening existing assertions without a clear reason.

The final report is expected to show evidence: the failure output seen before the fix, the passing run afterwards, and any nearby validation. It is a plain SKILL.md with no bundled scripts, so it relies on whatever test tooling the target project already has.

## When your agent uses it

> Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the test path is unclear, expensive, integration-heavy, or not requested.

## What it can access

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

- [Instructions only, no scripts](https://github.com/michael-denyer/pstack-claude/tree/HEAD/plugins/pstack/skills/tdd)
- [License: MIT](https://github.com/michael-denyer/pstack-claude/tree/HEAD/plugins/pstack/skills/tdd)

## Features

- **Failing test first:** Writes the smallest focused test that would have caught the bug before any fix is made.
- **Narrow test selection:** Prefers the closest existing unit, component or integration test for the affected code path.
- **Failure verification:** Checks that the test fails for the intended reason rather than an unrelated error.
- **Skip impractical tests:** Falls back to a targeted script, manual reproduction or browser check when a proper test would be costly.
- **Guardrails against bad tests:** Discourages mock-heavy, timing-dependent or implementation-mirroring tests and weakened assertions.
- **Evidence-based reporting:** Asks the agent to report the before-and-after failure and pass results and any nearby validation.

## Good for

- Fix a reported bug by first writing a regression test that reproduces it
- Add a focused test for an edge case that broke in a function
- Verify a bug fix when a unit test is impractical, using a manual reproduction command
- Check that a flaky behavior is pinned down with a deterministic test

## Install

### Claude Code

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

```sh
/plugin marketplace add michael-denyer/pstack-claude
/plugin install pstack@pstack-claude
```

Or copy only this skill to `~/.claude/skills/tdd`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/tdd &&
cp -R "$tmp/plugins/pstack/skills/tdd" ~/.claude/skills/tdd &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/tdd` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/tdd` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/tdd &&
cp -R "$tmp/plugins/pstack/skills/tdd" ~/.agents/skills/tdd &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/tdd` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/tdd` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/tdd &&
cp -R "$tmp/plugins/pstack/skills/tdd" ~/.cursor/skills/tdd &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/tdd` 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/michael-denyer/pstack-claude.git --path plugins/pstack/skills/tdd
```

Or copy the folder to `~/.gemini/skills/tdd` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/tdd`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/tdd &&
cp -R "$tmp/plugins/pstack/skills/tdd" ~/.copilot/skills/tdd &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/tdd` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git
```

Then copy `pstack-claude/plugins/pstack/skills/tdd` into your agent's skills folder as `tdd`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does TDD trigger?

It applies when the user explicitly asks for TDD, a failing test or a regression test, or when the bug has an obvious, cheap local test target. It is meant to be skipped when the test path is unclear, expensive, integration-heavy or not requested.

### What does the agent do if a test is impractical?

It uses the closest executable regression check instead, such as a targeted script, manual reproduction command, browser automation, snapshot comparison, log assertion or focused integration check.

### Does the skill install anything or run scripts?

No. The skill is a single SKILL.md file with no bundled scripts. It guides the agent's workflow using the test tooling already in the project.

### Does TDD require a particular testing framework?

The SKILL.md does not name a framework. It tells the agent to use the closest test already used for that code path.

### How do I install TDD in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/tdd to use it in all your projects, or to .claude/skills/tdd in one project. Or install the pstack plugin, which includes it: /plugin marketplace add michael-denyer/pstack-claude, then /plugin install pstack@pstack-claude.

### Does TDD 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 TDD?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to TDD?

The closest alternatives to TDD are TDD, Debug, Bug, TDD loop and Testing strategy.

## 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.
- [Debug](https://ai-powered.com/skills/debug-jasgujral): Debug 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.
- [TDD loop](https://ai-powered.com/skills/tdd-loop): TDD loop 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.
- [Develop](https://ai-powered.com/skills/develop): Develop is an open-source agent skill for developer tools.
- [Bug fix](https://ai-powered.com/skills/bug-fix): Bug fix is an open-source agent skill for developer tools.
- [Principle fix root causes](https://ai-powered.com/skills/principle-fix-root-causes): Principle fix root causes is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/tdd-michael-denyer
