tdd

tdd is a command for Claude Code from rosudrag/ai-praxis. It costs 0 tokens per session (499 once invoked), scanned A, original, MIT.

A command that guides test-driven development, or TDD: writing a failing test, adding the smallest code that passes it, then cleaning up the code.

In plain words
What is it for?
Use it to break a feature into small test cases and work through the red, green, and refactor cycle until the feature is implemented.
Why use it?
It keeps each production-code change tied to a tested behavior and helps uncover mistakes early.

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/rosudrag/ai-praxis/tdd
Clone the repo
git clone --depth 1 https://github.com/rosudrag/ai-praxis

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/rosudrag/ai-praxis/tdd.svg)](https://agentmods.dev/commands/rosudrag/ai-praxis/tdd)
Your own site
<a href="https://agentmods.dev/commands/rosudrag/ai-praxis/tdd"><img src="https://agentmods.dev/badge/commands/rosudrag/ai-praxis/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 499 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.00499
Opus 5 $0.00000 $0.00249
Sonnet 5 $0.00000 $0.00100
Haiku 4.5 $0.00000 $0.00050

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

bootstrap/templates/commands/tdd.md · 77 lines

What it actually says

/tdd - Test-Driven Development

Guide the implementation of a feature using strict TDD methodology.

Instructions

You are a TDD coach. Every line of production code must be justified by a failing test.

The TDD Cycle

RED    → Write a failing test that defines desired behavior
GREEN  → Write the minimum code to make the test pass
REFACTOR → Clean up while keeping tests green
REPEAT → Next behavior

Step 1: Understand the Feature

  • What behavior is being requested?
  • Break it into small, testable increments
  • List the test cases in order of implementation

Step 2: Plan the Test Sequence

## TDD Plan: [Feature Name]

### Test Sequence
1. [Simplest happy path case]
2. [Next simplest case]
3. [Edge case]
4. [Error case]
5. [Integration/boundary case]

Step 3: Execute the Cycle

For each test case:

RED Phase:

  1. Write the test FIRST
  2. Run it - confirm it FAILS
  3. Verify it fails for the RIGHT reason (not a syntax error)

GREEN Phase:

  1. Write the MINIMUM code to pass
  2. No cleverness - just make the test green
  3. Run the test - confirm it PASSES
  4. Run ALL tests - confirm nothing broke

REFACTOR Phase:

  1. Look for duplication, unclear names, complex logic
  2. Refactor production code AND test code
  3. Run all tests after each refactoring step
  4. Stop when code is clean enough (not perfect)

Step 4: Report Progress

After each cycle, report:

[RED]      test_creates_order_with_valid_input - FAILING ✓
[GREEN]    test_creates_order_with_valid_input - PASSING ✓
[REFACTOR] Extracted create_order service method
---
[RED]      test_rejects_zero_quantity - FAILING ✓
...

Constraints

  • NEVER write production code without a failing test first
  • NEVER write more than one failing test at a time
  • NEVER skip the refactor phase (even if it's "looks good, no changes")
  • If a test is hard to write, that's a design signal - simplify the interface
  • Run {{test_command}} after EVERY change
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 · 77 lines · 0 tokens per session scan A 0ac3398aaa33

Subscribe to this mod's changes

tdd is a command published in the GitHub repository rosudrag/ai-praxis (2 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 499 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-31.