tdd

tdd is a command for Claude Code from studioKjm/ai-harness-template. It costs 0 tokens per session (842 once invoked), scanned A, original, MIT.

A command manages strict test-driven development (TDD) cycles, where tests are written before the related source code.

In plain words
What is it for?
It starts, advances, reviews, links, lists, or abandons development cycles and records their tests, source files, and requirements.
Why use it?
It tracks the Red–Green–Refactor process and blocks commits when git history shows source code was added before its test.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 methodologies/tdd-strict/scripts/tdd.py new "user can reset password" \.

Part of the harness plugin — 44 commands, 11 agents shipped together

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/studioKjm/ai-harness-template
agentmods
npx agentmods add commands/studiokjm/ai-harness-template/tdd

Made for: Claude Code.

Or install harness, the plugin that ships this one along with the rest of its 44 commands, 11 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

README.md
[![agentmods](https://agentmods.dev/badge/commands/studiokjm/ai-harness-template/tdd.svg)](https://agentmods.dev/commands/studiokjm/ai-harness-template/tdd)
Your own site
<a href="https://agentmods.dev/commands/studiokjm/ai-harness-template/tdd"><img src="https://agentmods.dev/badge/commands/studiokjm/ai-harness-template/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 842 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.00842
Opus 5 $0.00000 $0.00421
Sonnet 5 $0.00000 $0.00168
Haiku 4.5 $0.00000 $0.00084

Measured 6d ago against content hash bf87f2a6efb2, 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.

methodologies/tdd-strict/commands/tdd.md · 110 lines

How it starts

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

/tdd — TDD Cycle Manager

Methodology: tdd-strict
Purpose: Manage Red→Green→Refactor cycles. Gate enforces test-first order in git history.


Usage

/tdd new <description> [--test <path>] [--source <path>] [--hypothesis <text>] [--story <id>]
/tdd pass <cycle-id> [--criteria <text>]
/tdd refactor <cycle-id> [--notes <text>]
/tdd done <cycle-id>
/tdd abandon <cycle-id> [--reason <text>]
/tdd status <cycle-id>
/tdd list [--state red|green|refactor|done|abandoned]
/tdd link <cycle-id> [--story <id>] [--spike <id>] [--test-file <path>] [--source-file <path>]

State Machine

     new
      ↓
   🔴 red  ──pass──→  🟢 green  ──refactor──→  🔵 refactor  ──done──→  ✅ done
      │                  │                          │
      └──abandon──→  ❌ abandoned  ←─────────────────┘

Invariant enforced by gate: check-test-first.sh blocks commits where a source file was introduced into git before its corresponding test file.


Workflow

1. Start a cycle

python3 methodologies/tdd-strict/scripts/tdd.py new "user can reset password" \
  --test src/auth/reset.test.ts \
  --source src/auth/reset.ts \
  --hypothesis "POST /auth/reset sends email and returns 202"

2. Write the failing test → commit → the gate verifies test exists

# Write test file first
git add src/auth/reset.test.ts
git commit -m "test: reset password sends email (RED)"
# Gate passes: test file committed before source

3. Implement to pass the test

# Now write source
git add src/auth/reset.ts
git commit -m "feat: implement password reset"
# Gate passes: test was committed first
python3 methodologies/tdd-strict/scripts/tdd.py pass tdd-20260430-001

4. Refactor (optional cleanup)

git add .
git commit -m "[refactor] extract sendResetEmail helper"
# [refactor] prefix exempts this commit from gate
python3 methodologies/tdd-strict/scripts/tdd.py refactor tdd-20260430-001 \
  --notes "extracted sendResetEmail, removed duplication"

Read the full file on GitHub · 110 lines

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 · 110 lines · 0 tokens per session scan A bf87f2a6efb2

Subscribe to this mod's changes

tdd is a command published in the GitHub repository studioKjm/ai-harness-template (43 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 842 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.