tdd-patterns

tdd-patterns is a skill for Claude Code from juanmhidalgo/claude-plugins. It costs 35 tokens per session (1,468 once invoked), scanned A, original, MIT.

A guide for test-driven development, or TDD: writing a failing test, making it pass with the smallest change, then improving the code.

In plain words
What is it for?
Use it when implementing features through RED, GREEN, and REFACTOR stages with limits and checks for changed files.
Why use it?
It provides a controlled testing cycle and rules for handling repeated failures, coverage, and test changes.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the feature-dev plugin — 2 skills, 8 commands, 13 agents shipped together

Good fit Use it when implementing features through RED, GREEN, and REFACTOR stages with limits and checks for changed files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/juanmhidalgo/claude-plugins/tdd-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add juanmhidalgo/claude-plugins --skill tdd-patterns
Clone the repo
git clone --depth 1 https://github.com/juanmhidalgo/claude-plugins

Made for: Claude Code.

Or install feature-dev, the plugin that ships this one along with the rest of its 2 skills, 8 commands, 13 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tdd-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/juanmhidalgo/claude-plugins/tdd-patterns/github.svg)](https://agentmods.dev/skills/juanmhidalgo/claude-plugins/tdd-patterns)
Your own site
<a href="https://agentmods.dev/skills/juanmhidalgo/claude-plugins/tdd-patterns"><img src="https://agentmods.dev/badge/skills/juanmhidalgo/claude-plugins/tdd-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tdd-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/juanmhidalgo/claude-plugins/tdd-patterns"><img src="https://agentmods.dev/badge/skills/juanmhidalgo/claude-plugins/tdd-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,468 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.01468
Opus 5.5 $0.00014 $0.00587
Sonnet 5.5 $0.00007 $0.00294
Haiku 4.5 $0.00003 $0.00147

Measured 1mo ago against content hash 165db1b05267, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

tdd-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

feature-dev/skills/tdd-patterns/SKILL.md · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TDD Cycle Constraints

Iteration Limits

  • Maximum 5 RED-GREEN cycles per bounded behavior (one acceptance criterion), not per feature. A feature with N criteria gets N separate budgets. If tests still fail after 5 cycles on the same criterion, halt and report the blocking issue; the orchestrator decides whether to re-dispatch.
  • Stuck-after-3 rule: If the same test failure persists after 3 consecutive cycles with different fix attempts, STOP immediately. Do not keep trying the same approach.

Phase Ordering

Phases are strictly sequential. Never skip or reorder:

  1. RED: Write ONE test that MUST fail. If it passes immediately, it is testing existing behavior — remove or rewrite it. The exceptions are a step dispatched in characterization mode and a step's Pins:, whose tests are meant to pass on first run; there, a passing test proves nothing until a temporary mutation shows it can fail (see tdd-runner).
  2. GREEN: Write the minimum code to make tests pass. No refactoring, no optimization, no "while I'm here" changes.
  3. REFACTOR: Only after all tests are green. Run tests after every refactoring change. If a test breaks during refactor, undo the refactoring change.

Fix Implementation, Not Tests

When a test fails during the GREEN phase:

  • Default action: fix the implementation, not the test.
  • Only modify a test if the test itself has a bug (wrong assertion, incorrect setup) — never weaken a test to make it pass.
  • If the spec is ambiguous, ask the user rather than adjusting the test.

Test Quality

A test that fails first can still prove nothing. RED and mutation proof show a test can fail; they do not show it fails for the right reason. Check these when writing each test:

  • The expected value comes from outside the code under test: a literal, or a value the spec states. Computing it with the same function, formula or helper the impl uses is a tautology: the test and the code agree by construction, and both are wrong together.
  • Mock only external boundaries: third-party HTTP (responses, respx, vi.mock on the client module), time (time-machine, freezegun, vi.useFakeTimers), randomness. Never mock the project's own services, models or composables; a test that does proves the wiring you wrote, not the behavior.
  • No call-count asserts on the project's own code (assert_called_once, toHaveBeenCalledTimes). They pin the implementation, so every refactor breaks them. Assert the observable outcome instead: the return value, the response, the state.
  • A database assert is fine when the row is the contract: a Django test that checks the row a request created asserts the behavior, not the implementation.
  • Test through the public interface. If the behavior is only reachable through a private helper, or only with a mock of the project's own code, there is no good test seam: report it rather than testing the helper.

Read the full file on GitHub · 89 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +14 lines 165db1b05267
  2. 2mo ago Changed 4eecaedfcb32
  3. 2mo ago Changed dc51bedd03db
  4. 2mo ago Changed 66c9440c3db6
  5. 2mo ago First seen · 75 lines · 35 tokens per session scan A 9fd7ecfc80c3

Subscribe to this mod's changes

tdd-patterns is a skill published in the GitHub repository juanmhidalgo/claude-plugins (8 stars, last pushed 16d ago), licensed MIT. It adds 35 tokens to every session and 1,468 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

tdd-patterns compared with skills from other repositories

tdd-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
tdd-patternsjuanmhidalgo/claude-pluginsSkill816d agoMITA35Claude Code
tddparcadei/Continuous-Claude-v3Skill4.0k14d agoMITA19Claude Code
software-test-executionstencila/stencilaSkill916yesterdayApache-2.0A97Claude Code
software-test-creationstencila/stencilaSkill916yesterdayApache-2.0A82Claude Code
software-code-refactoringstencila/stencilaSkill916yesterdayApache-2.0A102Claude Code
software-implementationstencila/stencilaSkill916yesterdayApache-2.0A124Claude Code
software-plan-creationstencila/stencilaSkill916yesterdayApache-2.0C86Claude Code