tdd

tdd is a command for Claude Code from hgahlot/claude-flow. It costs 0 tokens per session (371 once invoked), scanned A, original, MIT.

A command that enforces test-driven development, or TDD: write a failing test first, add the smallest code that makes it pass, then clean up the code while keeping the test passing.

In plain words
What is it for?
Use it to guide an implementation through the red, green, and refactor stages and show the test results at each stage.
Why use it?
It provides evidence that the requested behavior was missing, implemented, and preserved after cleanup instead of relying only on untested code.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

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.

agentmods
npx agentmods add commands/hgahlot/claude-flow/tdd
Clone the repo
git clone --depth 1 https://github.com/hgahlot/claude-flow

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/hgahlot/claude-flow/tdd.svg)](https://agentmods.dev/commands/hgahlot/claude-flow/tdd)
Your own site
<a href="https://agentmods.dev/commands/hgahlot/claude-flow/tdd"><img src="https://agentmods.dev/badge/commands/hgahlot/claude-flow/tdd.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 371 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00000 $0.00371
Opus 5 $0.00000 $0.00186
Sonnet 5 $0.00000 $0.00074
Haiku 4.5 $0.00000 $0.00037

Measured 6d ago against content hash 61e7e678a2b7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

tdd 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 6d 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.

commands/tdd.md · 54 lines

What it actually says

/tdd — Red-Green-Refactor Cycle Enforcement

Enforce strict TDD discipline for the current implementation task.

Instructions

Execute the full RED-GREEN-REFACTOR cycle:

Phase 1: RED (Write Failing Test)

  1. Identify the behavior to implement (from plan or description)
  2. Write the test FIRST — do not write any implementation code yet
  3. Run the test — confirm it FAILS with a meaningful error (not a syntax error)
  4. Show the failing test output as evidence

Phase 2: GREEN (Minimum Implementation)

  1. Write the MINIMUM code required to make the test pass
  2. Do not over-engineer — just make it green
  3. Run the test — confirm it PASSES
  4. Show the passing test output as evidence

Phase 3: REFACTOR (Clean Up)

  1. Improve code quality without changing behavior
  2. Remove duplication, improve naming, simplify logic
  3. Run the test again — confirm it STILL PASSES after refactoring
  4. Show the passing test output as evidence

Output Format

## RED Phase
[test code]
Running: <test command>
Result: FAIL — <error message>
✓ Test fails as expected

## GREEN Phase
[implementation code]
Running: <test command>
Result: PASS
✓ Test passes

## REFACTOR Phase
[refactored code — describe changes made]
Running: <test command>
Result: PASS
✓ Tests still pass after refactor

Rules

  • NEVER write implementation code before a failing test exists
  • NEVER skip the REFACTOR phase
  • NEVER claim GREEN without running the test and showing output
  • If a test passes immediately without any implementation, the test is wrong — fix it
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. 6d ago First seen · 54 lines · 0 tokens per session scan A 61e7e678a2b7

Subscribe to this mod's changes

tdd is a command published in the GitHub repository hgahlot/claude-flow (53 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 371 tokens. 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-08-30.