Expert-Coding-Harness: Skill for Cursor

.cursor/skills/tdd-master/SKILL.md

tdd-master is a skill for Cursor from ProgrammerAnthony/Expert-Coding-Harness. It costs 83 tokens per session (2,019 once invoked), scanned A, original, MIT.

A test-driven development guide: TDD means writing a test that fails, making it pass with the smallest change, and then cleaning up the design.

In plain words
What is it for?
Use it when building a feature or fixing a bug by defining small behaviors, checking whether the design is testable, and following the red-green-refactor cycle.
Why use it?
It provides quick feedback while coding and keeps tests focused on observable behavior instead of fragile internal details.

Skill for Cursor

Written for Cursor: installed under .cursor/.

This is ProgrammerAnthony/Expert-Coding-Harness's own configuration. It tells Cursor how to work on Expert-Coding-Harness 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 Expert-Coding-Harness configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/ProgrammerAnthony/Expert-Coding-Harness/master/.cursor/skills/tdd-master/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/ProgrammerAnthony/Expert-Coding-Harness

Made for: Cursor.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/programmeranthony/expert-coding-harness/tdd-master/github.svg)](https://agentmods.dev/skills/programmeranthony/expert-coding-harness/tdd-master)
Your own site
<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.

agentmods 80×15 button for tdd-master

Your own site · 80×15
<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>
Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,019 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.00083 $0.02019
Opus 5.5 $0.00033 $0.00808
Sonnet 5.5 $0.00017 $0.00404
Haiku 4.5 $0.00008 $0.00202

Measured 2mo ago against content hash a8c31ca3fc0b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

.cursor/skills/tdd-master/SKILL.md · 205 lines

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 阶段
  1. 写最小的失败测试:

    • 测试名称描述行为(test_用户注册成功返回用户ID)
    • 只测一个行为
    • 使用尽可能真实的代码(避免过度 mock)
  2. 强制验证 RED(不可跳过):

pytest tests/test_user.py::test_用户注册成功返回用户ID -v

确认:测试因正确原因失败(功能未实现),而非因测试代码错误失败

  1. RED 失败则停止:如果无法让测试变红,说明测试本身有问题,先修复测试
GREEN 阶段
  1. 写最小的实现:只写让当前测试通过所需的最少代码

    • 可以暂时硬编码(如 return 42),只要测试通过
    • 禁止超前实现"以后会用到的"功能
  2. 强制验证 GREEN(不可跳过):

    pytest tests/test_user.py -v
    

    确认:全部测试通过,包括之前的测试

  3. GREEN 失败则停止:回到实现代码修复,不重构,不写新测试

Read the full file on GitHub · 205 lines

Files

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.

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. 2mo ago First seen · 205 lines · 83 tokens per session scan A a8c31ca3fc0b

Subscribe to this mod's changes

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.