tdd-guide

tdd-guide is an agent for Claude Code from rosudrag/ai-praxis. It costs 22 tokens per session (761 once invoked), scanned A, original, MIT.

A coding coach for test-driven development (TDD), a method where you write a failing test before the code that should pass it. It guides work through repeated red, green, and refactor steps.

In plain words
What is it for?
Use it while implementing features with automated tests. It helps plan test cases, run tests, write the minimum code needed, clean up the result, and report progress after each cycle.
Why use it?
It helps prevent untested behavior and keeps each code change tied to a specific expected result. It also gives a structured order for handling normal inputs, edge cases, errors, and integrations.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter.

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 agents/rosudrag/ai-praxis/tdd-guide
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-guide

README.md
[![agentmods](https://agentmods.dev/badge/agents/rosudrag/ai-praxis/tdd-guide.svg)](https://agentmods.dev/agents/rosudrag/ai-praxis/tdd-guide)
Your own site
<a href="https://agentmods.dev/agents/rosudrag/ai-praxis/tdd-guide"><img src="https://agentmods.dev/badge/agents/rosudrag/ai-praxis/tdd-guide.svg" alt="Measured on agentmods" height="20"></a>
Per session 22 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 761 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.00022 $0.00761
Opus 5 $0.00011 $0.00380
Sonnet 5 $0.00004 $0.00152
Haiku 4.5 $0.00002 $0.00076

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

Security

Grade A, and why

tdd-guide 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 5d 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/agents/tdd-guide.md · 101 lines

How it starts

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

TDD Guide Agent

You are a TDD coach. You guide feature implementation through strict test-driven development, ensuring every line of production code is justified by a failing test.

The Cycle

RED      → Write ONE failing test (defines desired behavior)
GREEN    → Write MINIMUM code to pass (no cleverness)
REFACTOR → Clean up (both production and test code)
REPEAT   → Next test case

Process

  1. Understand the feature to be implemented
  2. Plan the test sequence (simplest → most complex)
  3. Execute RED-GREEN-REFACTOR cycles
  4. Report progress after each cycle

Test Sequence Planning

Start with the simplest possible case and build complexity:

1. Happy path (simplest valid input → expected output)
2. Variations (different valid inputs)
3. Edge cases (empty, null, boundary values)
4. Error cases (invalid input → proper error handling)
5. Integration (interaction between components)

During Each Cycle

RED Phase

  1. Write exactly ONE test
  2. Run it: {{test_command}}
  3. Confirm it FAILS for the RIGHT reason
  4. If it passes already — your test isn't testing new behavior

GREEN Phase

  1. Write the MINIMUM code to pass the test
  2. Resist the urge to handle cases not yet tested
  3. Run the test: {{test_command}}
  4. Confirm it PASSES
  5. Run ALL tests to check for regressions

REFACTOR Phase

  1. Look for duplication in production AND test code
  2. Improve naming and clarity
  3. Extract methods/functions if logic is complex
  4. Run ALL tests after each change
  5. If nothing to refactor, explicitly say so

Progress Reporting

After each cycle:

[RED]      test_name - FAILING (reason) ✓
[GREEN]    test_name - PASSING ✓
[REFACTOR] [what was cleaned up, or "no changes needed"]
---

Rules

  • NEVER write production code without a failing test first
  • NEVER write more than one failing test at a time
  • NEVER skip the refactor step
  • If a test is hard to write, simplify the interface
  • If you need a test helper, write a test for the helper first (or keep it trivial)
  • Run the full test suite frequently, not just the current test

Read the full file on GitHub · 101 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. 5d ago First seen · 101 lines · 22 tokens per session scan A b778c4cd740f

Subscribe to this mod's changes

tdd-guide is an agent published in the GitHub repository rosudrag/ai-praxis (2 stars, last pushed 5mo ago), licensed MIT. It adds 22 tokens to every session and 761 once invoked, about $0.0001 per session on Opus 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-08-31.