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.
npx agentmods add skills/azzygoatcoder/agent-useful-skills/test-driven-developmentnpx skills add Azzygoatcoder/agent-useful-skills --skill test-driven-developmentgit clone --depth 1 https://github.com/Azzygoatcoder/agent-useful-skillsWrote 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/azzygoatcoder/agent-useful-skills/test-driven-development)<a href="https://agentmods.dev/skills/azzygoatcoder/agent-useful-skills/test-driven-development"><img src="https://agentmods.dev/badge/skills/azzygoatcoder/agent-useful-skills/test-driven-development.svg" alt="Measured on agentmods" 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 | $0.00017 | $0.00865 |
| Opus 5 | $0.00009 | $0.00432 |
| Sonnet 5 | $0.00003 | $0.00173 |
| Haiku 4.5 | $0.00002 | $0.00086 |
Grade A, and why
test-driven-development 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.
How it starts
The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Test-Driven Development (TDD)
Overview
Write the test first. Watch it fail. Write minimal code to pass.
Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.
Violating the letter of the rules is violating the spirit of the rules.
场景判定(先定力度,再走流程)
不是所有代码都值得完整 TDD 仪式。先确认这块代码将来会不会被依赖/复用,再选择力度:
| 场景 | 力度 |
|---|---|
| 生产代码、共享库、正式项目、bug 修复、回归防护 | 完整 TDD:红 → 绿 → 重构,缺一不可 |
| 个人业余项目、探索性脚本、原型、一次性工具 | 轻量 TDD:先让它跑起来;只对“会长期存在”的核心逻辑补 1-2 个有意义的测试;不要为每个小函数都建测试 |
| 纯 throwaway / 临时验证 | 可以跳过测试,但不要把它混进生产代码 |
判断标准:这段代码如果出错,会不会影响别人/后续/生产? 不会,就走轻量路径,别让流程拖慢节奏。会,就走完整 TDD,不讨价还价。
The Iron Law
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
写生产代码前没有失败测试?删掉重来。
No exceptions:
- Don't keep it as "reference"
- Don't "adapt" it while writing tests
- Don't look at it
- Delete means delete
适用边界: 这条铁律针对会成为生产/持久代码的部分。个人探索代码可以快速跑通再补测试,但不能把“没验证过的代码”直接当生产代码提交。
Red-Green-Refactor(速览)
digraph tdd_cycle {
rankdir=LR;
red [label="RED\nWrite failing test", shape=box, style=filled, fillcolor="#ffcccc"];
verify_red [label="Verify fails\ncorrectly", shape=diamond];
green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
verify_green [label="Verify passes\nAll green", shape=diamond];
refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
next [label="Next", shape=ellipse];
red -> verify_red;
verify_red -> green [label="yes"];
verify_red -> red [label="wrong\nfailure"];
green -> verify_green;
verify_green -> refactor [label="yes"];
verify_green -> green [label="no"];
refactor -> verify_green [label="stay\ngreen"];
verify_green -> next;
next -> red;
}
完整流程、好测试标准、反模式和示例见 references/tdd-guide.md。
核心检查
- 每个新行为有一个失败测试,并且你亲眼看过它失败
- 写最小代码让它通过
- 重构时保持测试全绿
- 测试关注真实行为,不测 mock
- 完整 checklist / good tests / rationalization 表见 references/tdd-guide.md
What ships with it
2 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.
- 5d ago First seen · 90 lines · 17 tokens per session scan A e31b8c861f16
test-driven-development is a skill published in the GitHub repository Azzygoatcoder/agent-useful-skills (4 stars, last pushed 6d ago), licensed MIT. It adds 17 tokens to every session and 865 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.
Other skills, from other repositories
dsh-test-first
修复 bug 或实现新功能时使用:先写失败测试,再最小实现,最后重构。.
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code.
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code.
tdd
测试驱动开发:先写失败测试再写实现的红绿循环,一次一个垂直切片,测试只对着公开接口写。Test-driven development with a red-green-refactor loop.
implement
实现:根据需求文档或任务清单开始写代码。内部走 TDD 小步测试,完成后做代码评审再提交。Implement a piece of work based on a spec or set of tickets.
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code.