# tdd-workflow

Guides Claude Code through the test-driven development loop: write a failing test first, make it pass with simple code, then refactor.

- skill · `type=skill` · Claude Code · 194 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/tdd-workflow
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/tdd-workflow

## What it does

This skill guides Claude Code through a disciplined red-green-refactor loop. The agent begins by writing a focused test that verifies expected behavior and confirms it fails. Next, it writes the minimal application logic required to pass, following YAGNI rules without early optimization. Once green, the assistant cleans up code structure while keeping test assertions intact.

Test composition follows the Arrange-Act-Assert convention. Checks are prioritized deliberately: happy-path logic comes first, followed by error states, edge cases, and performance checks. For exploratory spikes or UI styling, the instructions explicitly flag TDD as low value.

Operation relies on `Read`, `Write`, `Edit`, `Glob`, `Grep`, and `Bash`. Without a working test runner configured in your project, the agent cannot execute or verify test runs.

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --skill development/tdd-workflow
```

2. **Skills CLI (Vercel)**
```bash
npx skills add davila7/claude-code-templates --skill tdd-workflow -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/tdd-workflow/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/tdd-workflow/

### Codex

**Manually: put the files in place**
- File: `.agents/skills/tdd-workflow/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

**Manually: put the files in place**
- File: `.cursor/skills/tdd-workflow/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install davila7/claude-code-templates tdd-workflow
```

2. **Manually: put the files in place**
- File: `.github/skills/tdd-workflow/SKILL.md`

### Gemini CLI

**Platform CLI**
```bash
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/development/tdd-workflow
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/tdd-workflow/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/tdd-workflow

## When to use it
- reproduce a defect with a failing test before editing source files
- scaffold new features using the Arrange-Act-Assert pattern
- refactor repetitive code without breaking existing behavior
- prevent over-engineering by enforcing minimal passing implementations

## Example prompts
- Use TDD to implement the currency conversion utility
- Write a failing unit test for the empty payload bug, then fix it

## Similar
- [improve-codebase-architecture](https://affpapa.org/en/nevibecode/skills/improve-codebase-architecture.md) — skill · 1163035 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 678700 installs
- [tdd](https://affpapa.org/en/nevibecode/skills/tdd.md) — skill · 1141062 installs
- [skill-creator](https://affpapa.org/en/nevibecode/skills/skill-creator.md) — skill · 414180 installs
- [agent-browser](https://affpapa.org/en/nevibecode/skills/vercel-labs-agent-browser.md) — skill · 1200000 installs
- [prototype](https://affpapa.org/en/nevibecode/skills/prototype.md) — skill · 986201 installs

## Other versions with the same name
- [tdd-workflow · ruvnet](https://affpapa.org/en/nevibecode/skills/ruvnet-tdd-workflow.md) — 743 installs

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 804 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
