Borrowing it
Nothing to install: this file belongs to MisonL/Ling. 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/MisonL/Ling/main/.agents/skills/tdd-workflow/SKILL.mdgit clone --depth 1 https://github.com/MisonL/LingWrote 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/misonl/ling/tdd-workflow)<a href="https://agentmods.dev/skills/misonl/ling/tdd-workflow"><img src="https://agentmods.dev/badge/skills/misonl/ling/tdd-workflow.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.1 | $0.00025 | $0.01179 |
| Opus 5 | $0.00013 | $0.00589 |
| Sonnet 5 | $0.00005 | $0.00236 |
| Haiku 4.5 | $0.00003 | $0.00118 |
Grade A, and why
tdd-workflow 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.
How it starts
The opening of the file, as written. The whole thing — 150 lines — stays where its author put it; the contents beside it link to each section on GitHub.
TDD(测试驱动开发)工作流
先写测试,后写代码。
1. TDD 核心循环
[CRITICAL] 红(RED)-> 编写一个失败的测试
v
[NIT] 绿(GREEN)-> 编写最少量的代码使测试通过
v
重构(REFACTOR)-> 优化代码结构与质量
v
循环往复...
2. TDD 三大法则
- 除非是为了使一个失败的单元测试通过,否则不允许编写任何生产代码。
- 只允许编写刚好能够证明失败的测试(编译失败也算失败)。
- 只允许编写刚好能够使当前失败测试通过的生产代码。
3. “红(RED)”阶段准则
编写重点
| 关注点 | 示例 |
|---|---|
| Behavior(行为) | “应当能够相加两个数字” |
| Edge Cases(边缘情况) | “应当能够处理空输入” |
| 错误状态 | “遇到无效数据时应当抛出异常” |
“红”阶段规则
- 测试必须先失败。
- 测试名称应清晰描述预期的行为。
- 每个测试(最好)仅包含一个 Assertion(断言)。
4. “绿(GREEN)”阶段准则
最少代码原则
| 原则 | 含义 |
|---|---|
| YAGNI | You Aren't Gonna Need It(你不会需要它) |
| 最简方案 | 编写能让测试通过的最少代码 |
| 暂不优化 | 此时只求“跑通”,不求“精炼” |
“绿”阶段规则
- 不要编写多余的代码。
- 暂时不要进行性能优化。
- 仅仅是为了通过测试,不多做一点。
5. “重构(REFACTOR)”阶段准则
优化方向
| 领域 | 动作 |
|---|---|
| 重复逻辑 | 提取公共函数/代码块 |
| 命名规范 | 使代码意图更加清晰 |
| 代码结构 | 改善组织架构 |
| 复杂度 | 简化逻辑判断 |
重构规则
- 所有测试必须保持绿色。
- 采取小步快跑的增量式改动。
- 每次重构之后都进行 Commit(提交)。
6. AAA 模式
每个测试均应遵循 AAA(Arrange-Act-Assert,准备-执行-断言):
| 步骤 | 目的 |
|---|---|
| Arrange(准备) | 初始化测试数据与环境 |
| Act(执行) | 执行被测代码逻辑 |
| Assert(断言) | 验证结果是否符合预期 |
7. 何时使用 TDD
| 场景 | TDD 价值 |
|---|---|
| 新功能开发 | 极高 |
| Bug(缺陷)修复 | 极高(先写复现测试) |
| 复杂逻辑实现 | 极高 |
| Spike(探索性研究) | 较低(研究完后再补 TDD) |
| UI(用户界面)布局调试 | 较低 |
8. 测试优先级
| 优先级 | 测试类型 |
|---|---|
| 1 | Happy path(正常路径) |
| 2 | Error cases(错误处理) |
| 3 | Edge cases(边界情况) |
| 4 | Performance(性能) |
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.
- 3d ago First seen · 150 lines · 25 tokens per session scan A 81e9691f48be
tdd-workflow is a skill published in the GitHub repository MisonL/Ling (8 stars, last pushed 5mo ago), licensed MIT. It adds 25 tokens to every session and 1,179 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-09-03.
Other skills, from other repositories
engram-testing-coverage
TDD and coverage standards for Engram. Trigger: When implementing behavior changes in any package.
nw-fp-clojure
Clojure language-specific patterns, data-first modeling, REPL-driven development, and spec.
strict-tdd
Strict RED->GREEN->REFACTOR test-driven development with enforcement. Never write production code before a failing test. Atomic commits per TDD cycle.
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…
conductor-implement
Execute tasks from a track's implementation plan following TDD workflow.
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.