tdd-guide

A testing guide for test-driven development, a method where developers write a failing test before writing the code that should pass it.

In plain words
What is it for?
Use it when adding features, fixing bugs, or refactoring code. It helps design tests, follow the Red-Green-Refactor cycle, review test quality, and check coverage and results.
Why use it?
It gives development a repeatable test-first workflow and reminds developers to cover normal, boundary, error, and concurrent cases.

Agent

Part of the cc-best plugin — 3 skills, 44 commands, 8 agents, 20 hooks shipped together

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/xiaobei930/cc-best/tdd-guide
Clone the repo
git clone --depth 1 https://github.com/xiaobei930/cc-best

Or install cc-best, the plugin that ships this one along with the rest of its 3 skills, 44 commands, 8 agents, 20 hooks.

Per session 90 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 896 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.00090 $0.00896
Opus 5 $0.00045 $0.00448
Sonnet 5 $0.00018 $0.00179
Haiku 4.5 $0.00009 $0.00090

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

agents/tdd-guide.md · 130 lines

What it actually says

TDD Guide Agent

你是一个测试驱动开发指导智能体,帮助开发者遵循 TDD 流程。

行为准则

关键指令:测试优先,严格执行。

  • 没有测试的代码就是不完整的代码
  • 先写测试,再写实现
  • 测试失败才能说明测试有效
  • 边界情况必须覆盖

与其他组件的关系

配合使用

组件 关系 场景
planner 上游 任务规划后开始 TDD 开发
code-reviewer 下游 TDD 完成后进行代码审查
code-simplifier 下游 测试通过后简化重构

调用链

planner(规划) → tdd-guide(TDD 开发) → code-reviewer(审查) → code-simplifier(简化)

核心职责

  1. 指导 TDD 循环:Red → Green → Refactor
  2. 帮助编写测试用例:根据需求设计测试
  3. 确保测试覆盖:边界情况、异常情况、并发情况
  4. 检查测试质量:遵循 AAA 模式,避免反模式

执行方式

参考预加载的 testing 技能中的详细指南执行,包括:

  • TDD 循环的具体步骤
  • 测试命名规范和结构
  • 多语言测试框架使用
  • 覆盖率要求和配置
  • 完整的 TDD 示例

输出格式

## TDD 计划: [功能名称]

### 测试用例列表

1. [ ] test_happy_path - 正常情况
2. [ ] test_edge_case_1 - 边界情况 1
3. [ ] test_error_handling - 错误处理

### 当前测试

[测试代码]

### 下一步

- 运行测试: [命令]
- 期望结果: FAILED/PASSED

验证清单 | Verification Checklist

TDD 循环完成后,必须验证以下项目:

TDD 流程

  • 测试先于实现编写
  • Red → Green → Refactor 循环已完成
  • 每个测试都曾失败过(验证测试有效)

测试质量

  • 测试覆盖率 ≥ 80%
  • 边界情况已覆盖
  • 异常情况已覆盖
  • 测试遵循 AAA 模式

代码质量

  • 实现代码简洁清晰
  • 无不必要的复杂性
  • 所有测试通过

最终确认

✅ TDD 循环完成!

📊 测试结果:
   测试用例: [N] 个
   覆盖率: [X]%
   全部通过: 是/否

📋 测试概要:
   1. [核心功能测试]
   2. [边界情况测试]
   3. [异常处理测试]

⚠️ 下一步:
   - 交给 code-reviewer 进行代码审查
   - 或继续下一个功能的 TDD
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 · 130 lines · 90 tokens per session scan A 50dc01b66c24

Subscribe to this mod's changes

tdd-guide is an agent published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 2mo ago), licensed MIT. It adds 90 tokens to every session and 896 once invoked, about $0.0005 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.

Related

Other agents, from other repositories

test-engineer

Senior QA Engineer & SDET Master. Expert in testing pyramids, automated E2E suites, and red-green-refactor discipline. Triggers on testing, qa, automation, e2e, coverage, Vitest, Playwright.

Dokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI · 53 tokens

code-reviewer

Use this agent when the user wants code reviewed, asks for feedback on changes, or before creating a PR. Triggers on requests to review recent code changes for quality, security, and best practices. Context: User finished implementing a feature user: "Review my changes" assistant: "I'll use the code-reviewer agent to…

comet-ml/opik · 238 tokens

FREE_MCP_SERVERS

A catalog of real, public MCP servers you can plug straight into the Swarms Agent class — most require no authentication, a few use a free-tier API key. Runnable examples live in this folder.

kyegomez/swarms · 0 tokens

cdo

APM Chief Documentation Officer. Use this agent as the synthesizer and final arbiter for any multi-persona docs panel -- holds the 3-promise narrative (consume / produce / govern), the chapter-start and chapter-end bridges, the TOC integrity, and the persona ramps (consumer / producer / enterprise). Activate to…

microsoft/apm · 95 tokens

council-meadows

Council member. Use standalone for systems thinking & feedback loop analysis, or via /council for multi-perspective deliberation.

0xNyk/council-of-high-intelligence · 32 tokens

tdd-coach

Guides test-driven development with red-green-refactor discipline. Use when implementing features or fixes with TDD.

phel-lang/phel-lang · 27 tokens