# TDD

> TDD is an open-source agent skill for developer tools. Guides the agent through a test-first loop: failing test, then minimal implementation. 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/tonyghiani/ai-essentials/tree/main/skills/tdd
- **Repository:** https://github.com/tonyghiani/ai-essentials
- **GitHub stars:** 7
- **License:** MIT
- **Skill name:** tdd
- **Collection:** https://github.com/tonyghiani/ai-essentials
- **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 any implementation code, only when the user explicitly asks for test-first work. It starts by judging whether a behaviour is worth a test at all, then walks through naming the behaviour in one declarative sentence, writing a colocated test file, running it to confirm it fails for the predicted reason, implementing the smallest change that passes, and refactoring with the test as a safety net.

The skill also sets testing conventions: hand-rolled stateful fakes for services, concrete value assertions instead of snapshots, promise matchers for async code, and explicit rules against tautological or implementation-mirroring tests. It asks the agent to report each behaviour, whether its failure matched the prediction, and the final test output.

It assumes a JavaScript or TypeScript project using a Jest-style runner, and it refers to a separate marco-code-style skill for the full style guide, which is not included in this folder.

## When your agent uses it

> Writes the failing test first, then the implementation, in Marco's testing style. Use whenever the user asks for the test before the code, in any wording ("tdd", "test first", "write the failing test first, then implement..."), and when the deliver skill adds a test worth its CI cost.

## What it can access

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

- [Instructions only, no scripts](https://github.com/tonyghiani/ai-essentials/tree/HEAD/skills/tdd)
- [License: MIT](https://github.com/tonyghiani/ai-essentials/tree/HEAD/skills/tdd)

## Features

- **Test-first workflow:** Walks the agent through naming a behaviour, writing a failing test, and confirming the failure before implementing.
- **Test-worthiness check:** Tells the agent to skip tests for constants, config values, renames and pass-through code.
- **Stateful fake guidance:** Describes building service fakes that round-trip state instead of relying on module mocks.
- **Assertion conventions:** Prefers concrete values, resolves and rejects matchers, and negative assertions that pin the contract.
- **Anti-pattern rules:** Lists practices to avoid, such as tests that mirror the implementation or pass on an empty result.
- **Edge case focus:** Directs tests toward idempotency, retries, missing dependencies, boundaries and error paths.

## Good for

- Write a failing test for a new service method before implementing it
- Add test-first coverage for a retry behaviour after partial failure
- Implement a boundary-condition fix with a test written beforehand
- Check whether a proposed change deserves a test at all

## Install

### Claude Code

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

```sh
/plugin marketplace add tonyghiani/ai-essentials
/plugin install ai-essentials@ai-essentials
```

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/tdd &&
cp -R "$tmp/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/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/tdd &&
cp -R "$tmp/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/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/tdd &&
cp -R "$tmp/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/tonyghiani/ai-essentials.git --path 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/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/tdd &&
cp -R "$tmp/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/tonyghiani/ai-essentials.git
```

Then copy `ai-essentials/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?

Only when the user asks for the test before the code, using wording such as tdd or test first, or when the deliver skill decides a test is worth its CI cost.

### Does TDD need any scripts or extra tools?

It contains no scripts. It instructs the agent to run the project's own test runner, with npx jest given as an example.

### Does TDD write tests for constants or config values?

No. The skill tells the agent to say so and skip the loop for constants, config values, renames, wiring and pass-through code.

### 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 ai-essentials plugin, which includes it: /plugin marketplace add tonyghiani/ai-essentials, then /plugin install ai-essentials@ai-essentials.

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

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

## 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](https://ai-powered.com/skills/tdd-kripu77): 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.
- [Test driven development](https://ai-powered.com/skills/test-driven-development-addyosmani): Test driven development 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](https://ai-powered.com/skills/tdd-evist0): 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.
- [Test driven development](https://ai-powered.com/skills/test-driven-development-ajyadav013-2): Test driven development is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/tdd-tonyghiani
