Borrowing it
Nothing to install: this file belongs to ProgrammerAnthony/Expert-Coding-Harness. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/ProgrammerAnthony/Expert-Coding-Harness/master/.cursor/skills/tdd-master/SKILL.mdgit clone --depth 1 https://github.com/ProgrammerAnthony/Expert-Coding-HarnessWrote 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.
[](https://agentmods.dev/skills/programmeranthony/expert-coding-harness/tdd-master)<a href="https://agentmods.dev/skills/programmeranthony/expert-coding-harness/tdd-master"><img src="https://agentmods.dev/badge/skills/programmeranthony/expert-coding-harness/tdd-master/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/programmeranthony/expert-coding-harness/tdd-master"><img src="https://agentmods.dev/badge/skills/programmeranthony/expert-coding-harness/tdd-master.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00083 | $0.02019 |
| Opus 5.5 | $0.00033 | $0.00808 |
| Sonnet 5.5 | $0.00017 | $0.00404 |
| Haiku 4.5 | $0.00008 | $0.00202 |
Grade A, and why
tdd-master 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 2mo 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.
How it starts
The opening of the file, as written. The whole thing — 205 lines — stays where its author put it; the contents beside it link to each section on GitHub.
TDD 开发大师
铁律:没有失败的测试,不写一行生产代码。 先写代码再补测试的,必须删掉先写的代码重来。
核心哲学
竖向切片,而非横向切片
反模式(横向切片):先把所有测试写完,再一口气写所有实现
- 问题:测试套件成为规格书,不是活文档;实现阶段难以获得快速反馈
正确做法(竖向 tracer bullet 切片):每次选一个最小可验证行为,完成 RED→GREEN→REFACTOR 完整循环
- 每个切片都是端到端的最小功能(一个完整行为)
- 通过测试可以立即运行并得到结果
测试测行为,而非测实现
# 错误:测试内部实现(脆弱,重构即失效)
def test_calls_validate_method():
service = UserService()
with patch.object(service, '_validate') as mock:
service.create_user(data)
mock.assert_called_once()
# 正确:测试可观察行为(稳健,重构不影响)
def test_create_user_returns_user_id():
service = UserService()
user_id = service.create_user({"name": "Alice", "email": "[email protected]"})
assert isinstance(user_id, int)
assert user_id > 0
工作流
阶段一:规划(获得用户批准前禁止写代码)
1.1 接口设计
先设计公共接口,不暴露内部实现细节:
询问用户:这个功能/模块需要提供什么公共接口?
输出:函数/方法签名 + 输入/输出类型 + 前置/后置条件
加载 references/testing-principles.md 检查接口设计原则。
1.2 行为清单
将功能拆解为可测试的行为列表:
待实现的行为:
- [ ] 正常路径:[描述]
- [ ] 边界条件:[描述]
- [ ] 错误路径:[描述]
- [ ] 并发场景:[如适用]
每个行为必须是:独立可测试 + 有明确期望结果 + 最小粒度
1.3 可测试性检查
评估设计是否可测试(加载 references/testing-principles.md):
- 依赖是否可以被替换(Mock/Stub)?
- 是否有隐藏的全局状态?
- 是否混合了业务逻辑和 I/O?
将设计展示给用户确认,批准后才开始实现。
阶段二:RED-GREEN-REFACTOR 循环
每次选一个行为(从行为清单第一项开始):
RED 阶段
-
写最小的失败测试:
- 测试名称描述行为(
test_用户注册成功返回用户ID) - 只测一个行为
- 使用尽可能真实的代码(避免过度 mock)
- 测试名称描述行为(
-
强制验证 RED(不可跳过):
pytest tests/test_user.py::test_用户注册成功返回用户ID -v
确认:测试因正确原因失败(功能未实现),而非因测试代码错误失败
- RED 失败则停止:如果无法让测试变红,说明测试本身有问题,先修复测试
GREEN 阶段
-
写最小的实现:只写让当前测试通过所需的最少代码
- 可以暂时硬编码(如
return 42),只要测试通过 - 禁止超前实现"以后会用到的"功能
- 可以暂时硬编码(如
-
强制验证 GREEN(不可跳过):
pytest tests/test_user.py -v确认:全部测试通过,包括之前的测试
-
GREEN 失败则停止:回到实现代码修复,不重构,不写新测试
What ships with it
5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 2mo ago First seen · 205 lines · 83 tokens per session scan A a8c31ca3fc0b
tdd-master is a skill published in the GitHub repository ProgrammerAnthony/Expert-Coding-Harness (246 stars, last pushed 5mo ago), licensed MIT. It adds 83 tokens to every session and 2,019 once invoked, about $0.0003 per session on Opus 5.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.
Other skills, from other repositories
engram-testing-coverage
TDD and coverage standards for Engram. Trigger: When implementing behavior changes in any package.
principle-test-behavior-not-implementation
Apply when you write, change, or keep a test. Assert what the code's users can observe, so that the test fails when that behavior breaks and keeps passing when only the internals change.
conductor-implement
Execute tasks from a track's implementation plan following TDD workflow.
tdd
This skill should be used when the user wants to implement features or fix bugs using test-driven development. Enforces the RED-GREEN-REFACTOR cycle with vertical slicing, context isolation between test writing and implementation, human checkpoints, and auto-test feedback loops. Uses multi-agent orchestration with the…
mobiai-mobile-tdd
You MUST use this before writing any implementation code for a mobile feature, bug fix, refactor, or behavior change. Tests come before implementation — no exceptions.
iterative-development
TDD iteration loops using Claude Code Stop hooks - runs tests after each response, feeds failures back automatically.