tdd

tdd is a command for Claude Code from sumulige/sumulige-claude. It costs 14 tokens per session (2,097 once invoked), scanned A, original, MIT.

A guided Test-Driven Development workflow, where tests are written before the code and the cycle repeats through failing tests, working code, and cleanup.

In plain words
What is it for?
Use it to build a feature through a seven-step cycle, optionally starting from a task in the todo folder, updating task progress, and checking coverage before completion.
Why use it?
It gives a structured way to define expected behaviour first and use tests to guide implementation and refactoring.

Command for Claude Code

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

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/sumulige/sumulige-claude/tdd.svg)](https://agentmods.dev/commands/sumulige/sumulige-claude/tdd)
Your own site
<a href="https://agentmods.dev/commands/sumulige/sumulige-claude/tdd"><img src="https://agentmods.dev/badge/commands/sumulige/sumulige-claude/tdd.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,097 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.00014 $0.02097
Opus 5 $0.00007 $0.01048
Sonnet 5 $0.00003 $0.00419
Haiku 4.5 $0.00001 $0.00210

Measured 5d ago against content hash 5c57e6008fe4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.

.claude/commands/tdd.md · 393 lines

How it starts

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

/tdd - Test-Driven Development Workflow

Guide the complete TDD cycle: write tests first, then implement.

Usage

/tdd                    # Start TDD workflow for new feature
/tdd <feature-name>     # Start TDD for specific feature
/tdd --from-todo        # Start TDD from active todo task
/tdd --continue         # Continue from current step

Integration with /todos

/tdd 与任务系统 /todos 无缝集成:

/todos: 创建任务 "实现用户认证"
    ↓
/tdd --from-todo: 从任务开始 TDD 流程
    ├── Step 1: 读取任务描述作为 User Story
    ├── Step 2-6: TDD 循环(自动更新任务进度)
    └── Step 7: 完成后标记任务状态
    ↓
/todos: 任务自动标记为完成

进度映射

TDD Step Todo 进度
Step 1: User Story [x] Planning
Step 2-5: RED → GREEN [x] In progress
Step 6: Refactor [x] Testing
Step 7: Coverage OK [x] ReviewComplete

从 Todo 开始 TDD

/tdd --from-todo
  1. 读取 development/todos/active/ 中的任务
  2. 用户选择要开发的任务
  3. 提取任务描述作为 User Story
  4. 开始 TDD 循环
  5. 完成后自动更新任务状态

The 7-Step TDD Cycle

Step 1: Define Requirements (User Story)

Before writing any code, define what you're building.

If using --from-todo:

  1. 读取任务文件中的描述和子任务
  2. 将子任务转换为验收标准
  3. 确认或补充需求

Otherwise:

## User Story

As a [user type],
I want to [action],
So that [benefit].

## Acceptance Criteria

- [ ] Criterion 1
- [ ] Criterion 2
- [ ] Criterion 3

Ask the user: What feature are we building? What are the acceptance criteria?

Todo 进度更新: [x] Planning


Step 2: Write Tests First (RED)

Create test file BEFORE implementation:

// Example: tests/feature.test.js
describe('Feature Name', () => {
  // Happy path
  test('should do X when Y', () => {
    // Arrange
    const input = ...;

    // Act
    const result = feature(input);

    // Assert
    expect(result).toBe(expected);
  });

  // Edge cases
  test('should handle empty input', () => { ... });
  test('should handle null input', () => { ... });

  // Error cases
  test('should throw error when invalid', () => { ... });
});

Read the full file on GitHub · 393 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 · 393 lines · 14 tokens per session scan A 5c57e6008fe4

Subscribe to this mod's changes

tdd is a command published in the GitHub repository sumulige/sumulige-claude (2 stars, last pushed 6mo ago), licensed MIT. It adds 14 tokens to every session and 2,097 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.