Skip to main content
skill CX Codex

tdd · rohitg00 — Claude Code skill: what it does, how to install

tdd guides Claude Code through a strict test-driven development loop: write a failing test, pass it with minimal code, and clean up.

MIT ★ 2,966 updated 2026-09-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add rohitg00/pro-workflow
/plugin install pro-workflow@pro-workflow
Open on GitHub

What tdd does

This skill directs the assistant into a tight Red-Green-Refactor sequence. The model first writes a single test for an observable behavior slice, then runs it to confirm it fails on the assertion rather than a setup error. Only after verifying the failure does it implement the simplest code that passes the test, followed by cleanup while keeping tests green.

The skill mandates showing each transition between red and green states instead of jumping directly to the final result. Mocking is restricted to external system boundaries like network calls, clocks, and filesystems. It explicitly skips layout-only interfaces, throwaway spikes, and exploratory code where tests cannot pin down concrete logic.

What it helps with

  • pin business logic with a failing test before writing implementation
  • reproduce a reported bug through a test case before patching it
  • refactor complex code safely with immediate test verification
  • build parsers and state machines in incremental slices

Example prompts for the agent

  • Implement the discount calculator using TDD, starting with a failing test
  • Fix this bug using a red-green-refactor loop
  • Write the test first for edge cases in the parser, then implement the handler

How to install tdd

1Plugin marketplace

/plugin marketplace add rohitg00/pro-workflow
/plugin install pro-workflow@pro-workflow

This installs the whole pro-workflow plugin with all its skills

2Skills CLI (Vercel)

npx skills add rohitg00/pro-workflow --skill tdd -a claude-code

3Manually: put the files in place

~/.claude/skills/tdd/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/tdd/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about tdd

How do I install tdd in Claude Code?

Run /plugin marketplace add rohitg00/pro-workflow, then install the bundle with /plugin install pro-workflow@pro-workflow.

What does the tdd skill enforce?

It forces the agent to write a failing test first, make it pass with the simplest solution, and refactor only while all tests remain green.

When should this skill be skipped?

The instructions advise skipping TDD during exploratory spikes and layout-focused UI work where visual inspection is required.

Source text

SKILL.md · MIT
---
name: tdd
description: Drive a change through a red-green-refactor loop - failing test first, minimal code to pass, then clean up. Use when implementing a feature or fixing a bug where correctness matters and a test can pin the behavior. Says "TDD", "test first", "red green refactor", "write the test first".
user-invocable: true
---

# tdd

The agent codes better with a tight feedback loop than with a long
specification. A failing test is the tightest loop there is: it states the
target, and the target either goes green or it does not.

## The loop

1. **Red.** Write one failing test that states the next slice of behavior.
   Run it. Confirm it fails for the right reason - a test that passes before
   you write the code is testing nothing. If it errors instead of failing on
   the assertion, fix the test setup first.
2. **Green.** Write the least code that makes the test pass. Not the general
   solution, not the abstraction - the minimal move. Run the test. Green.
3. **Refactor.** Now clean up with the test as a net: remove duplication,
   name things, simplify. Re-run after every edit. Behavior is frozen; only
   the shape changes.
4. Repeat for the next slice. Small slices. The rate of feedback is the
   speed limit - never take on a step too big to hold a single test.

## What makes a test worth writing

- **Tests behavior, not implementation.** Assert on the observable result,
  not on which private method got called. A test that breaks on every
  refactor is a liability.
- **One reason to fail.** Each test pins one behavior. When it goes red you
  should know what broke without reading the body.
- **Real seams, minimal mocks.** Mock at the system boundary (network, clock,
  filesystem), not internal collaborators. A test that mocks the thing under
  test asserts nothing.
- **No tautologies.** A test that restates the implementation (`expect(x).toBe(x)`
  after setting `x`) verifies nothing. Assert the value the behavior should produce.

## When to reach for it

Reach for TDD when the behavior is specifiable and a test can pin it: business
logic, parsers, state machines, bug fixes (write the failing case first, then
fix). Skip it for pure exploration, throwaway spikes, and layout-only UI where
a test asserts nothing a human would not eyeball.

## Output contract

Show each red-green transition, not just the final green. If a test is hard to
write, say what the difficulty reveals about the design - untestable code is
usually badly-seamed code, and that is a finding, not an obstacle.

© Rohit Ghumare · MIT · rohitg00/pro-workflow

Similar skills

All skills for Testing and QA →

tdd by other authors comes first.

tdd Matt Pocock Guides the red-green TDD loop: ensures tests are written first, keep them at public interfaces, and avoid coupling to implementation details. CX Codex +1 1,141,062installs tdd backnotprop tdd is a Claude Code skill that enforces writing an executable failing test before changing bugged code. It runs on explicit TDD prompts or cheap local test paths. CX Codex +1 10,000installs tdd Yeachan-Heo tdd enforces a strict red-green loop: one test per agreed seam, minimal green implementation, and no mid-cycle refactoring. CX Codex +1 244installs tdd codewithmukesh tdd guides a strict red-green-refactor cycle for .NET 10 applications using xUnit v3, WebApplicationFactory, and Testcontainers. CX Codex +1 4,000installs tdd parcadei tdd — a skill that keeps the agent on a strict red-green-refactor loop: failing test first, minimal code next, then verification. CX Codex +1 474installs tdd-workflow travisjneuman tdd-workflow — a skill for Claude Code, Codex, Cursor and other platforms that enforces test-driven development: first a failing test (RED), then minimal code to pass (GREEN), then refactoring. CX Codex +1 141installs w-tdd blockmatic-icebox The w-tdd Claude Code skill guides implementation through red-green-refactor. It activates when a developer requests TDD or the repository requires it. CX Codex +1 647installs 054-design-tdd Juan Antonio Breña Moral 054-design-tdd — a skill that walks Java developers through red-green-refactor cycles with test-driven development. Write a failing test first, implement just enough code to pass, then refactor while tests stay green. CX Codex +1 177installs tdd-orchestrator davila7 tdd-orchestrator is a Claude Code skill that orchestrates test-driven development through red-green-refactor cycles. It coordinates multi-agent testing workflows and verifies test-first compliance. CX Codex +1 51installs TDD Refactor Phase - Improve Quality & Security official github TDD Refactor Phase - Improve Quality & Security is a GitHub Copilot subagent that refines code after tests pass and checks it against a GitHub issue. It asks for plan approval before editing. CX Codex +1 ★ 41,430repo stars tdd-refactor Seth Hobson This command refactors code through the TDD refactor phase while keeping tests green. Use it for controlled structural changes without altering behavior. CX Codex +1 ★ 42,780repo stars

From the same set83

The whole set →
smart-commit smart-commit runs lint, typecheck and tests before a commit, scans staged code for leftovers, then writes a conventional commit message from the diff. CX Codex +1 ★ 2,966repo stars file-watcher file-watcher configures Claude Code hooks to react to changes in configuration files, dependencies, and environment files. CX Codex +1 ★ 2,966repo stars commit Runs project checks, reviews staged changes, and creates a focused git commit. Use it when a change is ready to be recorded. CX Codex +1 ★ 2,966repo stars mcp-audit mcp-audit analyzes connected MCP servers for token overhead, redundancy, and unused configurations. Run when sessions slow down or before connecting a new server. CX Codex +1 ★ 2,966repo stars module-shape The module-shape rule keeps public module APIs small while hiding complexity inside. Use it when designing modules or reviewing tests and dependencies. CX Codex +1 ★ 2,966repo stars improve-architecture improve-architecture audits code structure, identifies tangles in boundaries and dependencies, and proposes a ranked list of minimal moves that relieve the strain—no rewrite, only a plan you approve first. CX Codex +1 ★ 2,966repo stars parallel-worktrees parallel-worktrees — a skill for Claude Code that creates isolated git worktrees for parallel coding sessions. While tests or builds run in one window, start a new task in another without waiting or switching context. CX Codex +1 ★ 2,966repo stars compact-guard compact-guard is a Claude Code skill that records task state before context compaction and helps restore it afterward. Run it before /compact or when an auto-compaction warning appears. CX Codex +1 ★ 2,966repo stars

Project sponsors

Companies that keep this analytics open