tdd-green

The implementation stage of test-driven development known as the Green phase. It changes the code until the tests written in the earlier Red phase pass.

In plain words
What is it for?
Use it with a requirement name and task ID to load the task context, requirements, test cases, and Red-phase notes, then implement the feature and verify that the tests succeed.
Why use it?
It provides a defined step for implementing a feature against existing requirements and failing tests, with the work and result recorded in project documents.

Command

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/classmethod/tsumiki/tdd-green
Clone the repo
git clone --depth 1 https://github.com/classmethod/tsumiki
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,236 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.00039 $0.04236
Opus 5 $0.00019 $0.02118
Sonnet 5 $0.00008 $0.00847
Haiku 4.5 $0.00004 $0.00424

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

Security

Grade A, and why

tdd-green 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 2d 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.

legacy/commands/tdd-green.md · 327 lines

How it starts

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

TDDのGreenフェーズを実行し、Redフェーズで作成したテストを通すための実装を行います。

context

出力ディレクトリ="./docs/implements" 機能名={{feature_name}} タスクID={{task_id}} 要件名={{requirement_name}} 信頼性評価=[] メモファイル=./docs/implements/{要件名}/{{task_id}}/{feature_name}-memo.md 要件定義ファイル=./docs/implements/{要件名}/{{task_id}}/{feature_name}-requirements.md テストケースファイル=./docs/implements/{要件名}/{{task_id}}/{feature_name}-testcases.md Redフェーズファイル=./docs/implements/{要件名}/{{task_id}}/{feature_name}-red-phase.md Greenフェーズファイル=./docs/implements/{要件名}/{{task_id}}/{feature_name}-green-phase.md

step

  • $ARGUMENTS がない場合、「引数に要件名とTASK-IDを指定してください(例: ユーザー認証機能 TASK-0001)」と言って終了する
  • $ARGUMENTS の内容と context の内容をまとめてユーザに宣言する
  • step2 を実行する

step2: コンテキスト準備

開発コンテキストの準備を実行する:

  1. タスクノートの読み込み(唯一のコンテキストソース)

    • ./docs/implements/{要件名}/{{task_id}}/note.md を読み込み
    • 存在しない場合: @task で /tsumiki-legacy:tdd-tasknote {要件名} {{task_id}} を実行して生成
    • note.mdには技術スタック、開発ルール、関連実装、設計文書、テスト関連情報、注意事項が集約済み
  2. 直前フェーズの出力を読み込み

    • ./docs/implements/{要件名}/{{task_id}}/{feature_name}-requirements.md - 要件定義
    • ./docs/implements/{要件名}/{{task_id}}/{feature_name}-testcases.md - テストケース定義
    • ./docs/implements/{要件名}/{{task_id}}/{feature_name}-red-phase.md - Redフェーズのテスト記録
    • ./docs/implements/{要件名}/{{task_id}}/{feature_name}-green-phase.md - 既存のGreenフェーズ記録(存在する場合)
    • ./docs/implements/{要件名}/{{task_id}}/{feature_name}-memo.md - 開発履歴メモ(存在する場合)

読み込み完了後、step3 を実行する

step3: 実装の実行

  • 仕様との差異確認:

    • 実装前に要件定義ファイルとテストケースファイルの内容を精査
    • 現在の実装コードと仕様の間に差異を発見した場合:
      1. 差異の内容を具体的に特定
      2. どちらが正しいか判断できない場合は AskUserQuestion ツールを使用してユーザに確認
      3. 「仕様: [仕様の記述]」「実装: [実装の内容]」を明示して質問
      4. ユーザの判断を待ってから実装を進める
  • <implementation_template> の方針に従って実装を行う

    • 読み込んだコンテキスト情報を活用
    • 信頼性レベル(🔵🟡🔴)を各実装に記載
    • 必須の日本語コメントを含める
    • ファイルサイズを意識(800行制限)
    • モック使用の制限を遵守
  • テストを実行し、結果を確認する

    • 選択的実行: 実装したファイルに関連するテストのみを実行(高速)
      • Jest: npm test -- --findRelatedTests <実装ファイル>
      • pytest: pytest <関連テストファイル>
      • 特定のテストスイート: npm test -- <テストパターン>
    • 全てのテストが通ることを確認
    • 失敗した場合は原因を調査し、修正を繰り返す
    • 既存のテストがエラーになった場合は仕様を元に適切に修正
    • 注意: 全体のテスト実行は verify-complete フェーズで実施

Read the full file on GitHub · 327 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. 2d ago First seen · 327 lines · 39 tokens per session scan A cfde288eefff

Subscribe to this mod's changes

tdd-green is a command published in the GitHub repository classmethod/tsumiki (974 stars, last pushed 26d ago), licensed MIT. It adds 39 tokens to every session and 4,236 once invoked, about $0.0002 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-30.