Skip to content
Skill

TDD loop

Guides an agent through red/green/refactor test-first development at any scale

TDD loop is an open-source agent skill for developer tools. It is available on Claude Code.

Scripts
None
Platforms
Claude Code
GitHub stars
6
Last commit
License
Apache-2.0
Listing updated

Similar skills

About TDD loop

This skill is a reference rulebook for test-driven development. It lays out a six-step loop: read the acceptance criteria, write tests that pin the new behavior, confirm they fail, write the minimum code to pass, refactor while staying green, then repeat. It adapts the artifacts to the level of work, from unit tests and prose specs at the base level up to Gherkin scenarios, domain invariant tests and mutation thresholds at the highest level, and it also covers a story-driven variant for presentational UI components.

The skill also sets out discipline rules: what to do when a first-run test passes unexpectedly, how to keep green-phase code minimal, small refactoring steps, and committing at each green step with the behavior named in the message. It describes a short list of situations where the loop may be abridged, and asks that any exception be recorded in the pull request body.

It is written for use inside a larger FFFlow workflow rather than as a standalone command. It refers to other FFFlow skills and to a project justfile with test tiers, and it expects a stack with a test framework such as pytest, vitest or junit already in place.

When your agent uses it

The red/green/refactor discipline — same at every level, artifacts scale. Reference rulebook loaded by work and by characterize backfill tasks.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 1 file (8 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

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

/plugin marketplace add zerotechdebt/ffflow
/plugin install fff@ffflow

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

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/tdd-loop &&
cp -R "$tmp/plugin/skills/tdd-loop" ~/.claude/skills/tdd-loop &&
rm -rf "$tmp"

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

Claude Code docs on skills

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

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/tdd-loop &&
cp -R "$tmp/plugin/skills/tdd-loop" ~/.agents/skills/tdd-loop &&
rm -rf "$tmp"

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

Codex docs on skills

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

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/tdd-loop &&
cp -R "$tmp/plugin/skills/tdd-loop" ~/.cursor/skills/tdd-loop &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/tdd-loop inside it instead.

Cursor docs on skills

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

gemini skills install https://github.com/zerotechdebt/ffflow.git --path plugin/skills/tdd-loop

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

Gemini CLI docs on skills

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

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/tdd-loop &&
cp -R "$tmp/plugin/skills/tdd-loop" ~/.copilot/skills/tdd-loop &&
rm -rf "$tmp"

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

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/zerotechdebt/ffflow.git

Then copy ffflow/plugin/skills/tdd-loop into your agent's skills folder as tdd-loop. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Red-green-refactor loop
Walks the agent through writing a failing test, making it pass with minimal code, and refactoring under green.
Per-level artifact mapping
Shows which tests and specs apply at each level of work, from unit tests to Gherkin scenarios and mutation testing.
Red and green discipline
Explains how to treat a test that passes too early and how to keep the green step minimal.
Refactoring rules
Sets small-step refactoring under passing tests, with type, lint and format checks alongside.
Commit cadence
Recommends one commit per green step, naming the behavior and any rule or requirement ID.
Recorded exceptions
Lists legitimate reasons to skip the loop and asks that each skip be noted in the pull request.
Characterization variant
Describes how the loop runs in reverse to pin existing behavior when backfilling tests.

Good for

  • Implement a new feature by writing failing tests first
  • Add unit tests that pin down existing behavior before changing code
  • Refactor a module while keeping the test suite green at every step
  • Build a UI component in isolation with stories and tests before wiring it up

TDD loop FAQ

Is TDD loop a tool the agent can call?

No. It is a reference document that the work-issue workflow loads as context; it does not expose a tool call.

What does the skill need to run?

It has no scripts. It assumes a project with an existing test framework and, optionally, a justfile with test tiers and a .ffflow/config.yaml file.

When does the discipline allow skipping the test-first step?

The skill names a few edges, such as exploratory spikes, pure configuration wiring, I/O with no seam yet, and defects that cannot be reproduced. It asks that any skip be recorded in the pull request body.

How do I install TDD loop in Claude Code?

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

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

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 loop?

The closest alternatives to TDD loop are TDD workflow, TDD, TDD loop, TDD and TDD.

Where this comes from

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

More from zerotechdebt/ffflow

  1. Onboards a project onto FFFlow: config, stack setup, then a phased roadmap

    • Open source
    • 6 GitHub stars
    • Developer tools
  2. Runs keep-honest audits on a project and reports drift, stale docs and tech debt

    • Open source
    • 6 GitHub stars
    • Developer tools
  3. Runs another interactive skill unattended, making routine choices from project context

    • Open source
    • 6 GitHub stars
    • Developer tools
  4. Lists and validates the adapter cartridges that FFFlow ports load in a project

    • Open source
    • 6 GitHub stars
    • Developer tools
  5. Extracts a behavioral spec from an unspecified codebase and plans characterization tests

    • Open source
    • 6 GitHub stars
    • Developer tools
  6. Adds GitHub Actions workflows that run FFFlow quality gates on pull requests

    • Open source
    • 6 GitHub stars
    • Developer tools