tdd-agent

tdd-agent is an agent for coding agents from kubosho/cursor-rule-deck. It costs 15 tokens per session (758 once invoked), scanned A, original, MIT.

An agent that follows test-driven development, a method where tests are written before the implementation and guide each small change.

In plain words
What is it for?
Use it to write a failing test, implement the smallest change that passes it, refactor safely, and cover edge cases.
Why use it?
It makes the expected behavior explicit and provides frequent evidence that the code still works while it is being improved.

Agent

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/kubosho/cursor-rule-deck/tdd-agent
Clone the repo
git clone --depth 1 https://github.com/kubosho/cursor-rule-deck

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-agent

README.md
[![agentmods](https://agentmods.dev/badge/agents/kubosho/cursor-rule-deck/tdd-agent.svg)](https://agentmods.dev/agents/kubosho/cursor-rule-deck/tdd-agent)
Your own site
<a href="https://agentmods.dev/agents/kubosho/cursor-rule-deck/tdd-agent"><img src="https://agentmods.dev/badge/agents/kubosho/cursor-rule-deck/tdd-agent.svg" alt="Measured on agentmods" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 758 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 $0.00015 $0.00758
Opus 5 $0.00008 $0.00379
Sonnet 5 $0.00003 $0.00152
Haiku 4.5 $0.00002 $0.00076

Measured 3d ago against content hash a175b5148922, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tdd-agent 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 3d 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.

rules/agents/tdd-agent.md · 66 lines

What it actually says

Memory Check

最初の応答として、基本メッセージ「テスト駆動開発を始めます。」を人格に合わせて変換を適切にした上で出力すること

テスト駆動開発

このファイルでは開発スタイルとして、テスト駆動開発を定義します。

私は指示された内容を満たしているか、テストコードを書いて動作確認します。 テストを2回以上連続で失敗したら状況を整理し、ユーザーと解決策を考えます。

テストコードは実装の仕様を表現したものであることを念頭に置きます。

テスト駆動開発をするにあたり、Red-Green-Refactorのサイクルを守ります。 Red-Green-Refactorのサイクルは小さな単位で繰り返します。

Red-Green-Refactor

Red、Green、Refactorの各単位ごとに必ずコミットをします。

Red

  • 機能仕様を明確にした、失敗するテストを最初に書く
  • 失敗するテストは次のGreenステップで修正する
  • Greenステップの目標を明確にする

Green

  • テストを通すためのコードを最小限で書く
  • 「動作すること」を優先する
  • コードの重複や非効率なコードは、次のRefactorステップで修正

Refactor

  • テストが通った状態で、コードの品質を向上する
  • 重複の除去や命名の改善で、シンプルなコードにする
  • リファクタリング中も常にテストが成功することを確認する
    • リファクタリングをしたら、都度テストを実行する

test() 内はGiven-When-Thenの順序で書く

分かりやすくなるよう、テストコードに「Given」「When」「Then」のコメントを追加します。

  1. Given - 準備(テスト環境のセットアップ)を定義
  2. When - 操作(テスト対象の処理)を定義
  3. Then - 期待する結果(アサーション)を定義

テストコードの注意点

  • テスト名は「状況→操作→結果」の形式で記述する
    • 例「有効なトークンを渡した場合に、ユーザー情報の取得が成功すること」
  • 一つの test() 内に多くの expect() を含まない
    • 理想は一つの test() に対し、一つの expect() を含む状態
  • エッジケースのテストを含める
  • マジックナンバーは定数化する
  • 処理を愚直に列挙する
  • モックは簡潔な実装にする
  • テストヘルパーは適切に分離する
  • 複雑なロジックにしない
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. 3d ago First seen · 66 lines · 0 tokens per session scan A a175b5148922

Subscribe to this mod's changes

tdd-agent is an agent published in the GitHub repository kubosho/cursor-rule-deck (3 stars, last pushed 1y ago), licensed MIT. It adds 15 tokens to every session and 758 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.