Ling: Skill for Claude Code

.agents/skills/tdd-workflow/SKILL.md

tdd-workflow is a skill for Claude Code from MisonL/Ling. It costs 25 tokens per session (1,179 once invoked), scanned A, original, MIT.

A test-driven development workflow: write a failing test, add the smallest code that passes it, then improve the design. TDD means tests guide the implementation from the start.

In plain words
What is it for?
Use it when building features, handling edge cases and errors, and developing code through small red-green-refactor cycles.
Why use it?
It clarifies expected behavior before code is written and provides a check that the implementation still works during refactoring.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: installed under .agents/ (shared by several agents).

This is MisonL/Ling's own configuration. It tells Claude Code how to work on Ling itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything Ling configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/MisonL/Ling/main/.agents/skills/tdd-workflow/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/MisonL/Ling

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-workflow

README.md
[![agentmods](https://agentmods.dev/badge/skills/misonl/ling/tdd-workflow.svg)](https://agentmods.dev/skills/misonl/ling/tdd-workflow)
Your own site
<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>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,179 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00025 $0.01179
Opus 5 $0.00013 $0.00589
Sonnet 5 $0.00005 $0.00236
Haiku 4.5 $0.00003 $0.00118

Measured 3d ago against content hash 81e9691f48be, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

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.

.agents/skills/tdd-workflow/SKILL.md · 150 lines

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 三大法则

  1. 除非是为了使一个失败的单元测试通过,否则不允许编写任何生产代码。
  2. 只允许编写刚好能够证明失败的测试(编译失败也算失败)。
  3. 只允许编写刚好能够使当前失败测试通过的生产代码。

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(性能)

Read the full file on GitHub · 150 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. 3d ago First seen · 150 lines · 25 tokens per session scan A 81e9691f48be

Subscribe to this mod's changes

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.