A skill your agent uses when 用户要实现新功能、修复 bug,或明确要求使用 TDD 方式开发、先写测试时。触发场景:tdd、测试驱动、测试驱动开发、先写测试、红绿重构、单元测试、test driven、TDD开发、用TDD写、测试先行、我要开始开发新功能。

MITAuto-check passedTesting & QA

Install TDD Master

skills CLI
$ npx skills add ProgrammerAnthony/Expert-Coding-Harness --skill tdd-master -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ProgrammerAnthony/Expert-Coding-Harness tdd-master --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ProgrammerAnthony/Expert-Coding-Harness.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/tdd-master .claude/skills/tdd-master && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
tdd-master
GitHub stars
235
Token cost
~941 tokens
SKILL.md length
203 words
Files
6 (incl. references)
Skills in repo
23
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when 用户要实现新功能、修复 bug,或明确要求使用 TDD 方式开发、先写测试时。触发场景:tdd、测试驱动、测试驱动开发、先写测试、红绿重构、单元测试、test driven、TDD开发、用TDD写、测试先行、我要开始开发新功能。

  • Works in 2 steps: 还没有一个因"正确原因"而失败的测试(RED 阶段未完成) → 用户还没有确认接口设计和行为清单(阶段一未完成)
  • 用户要实现新功能、修复 bug,或明确要求使用 TDD 方式开发、先写测试时。触发场景:tdd、测试驱动、测试驱动开发、先写测试、红绿重构、单元测试、test driven、TDD开发、用TDD写、测试先行、我要开始开发新功能
  • SKILL.md covers 核心哲学, 工作流, Mock 使用原则 and 反模式警告, plus 2 more sections
  • Calls pytest

What it does

TDD Master is an agent skill from ProgrammerAnthony/Expert-Coding-Harness. Use when 用户要实现新功能、修复 bug,或明确要求使用 TDD 方式开发、先写测试时。触发场景:tdd、测试驱动、测试驱动开发、先写测试、红绿重构、单元测试、test driven、TDD开发、用TDD写、测试先行、我要开始开发新功能。

Its SKILL.md is about 940 tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `README.md`, `references/deep-modules.md` and `references/mocking-guide.md`).

It sits in Testing & QA, covering Test-driven development. The repository describes itself as: 生产级 AI Agent 技能集,辅助AI Harness应用于企业开发,覆盖代码审查、代码安全审计、TDD、需求工程、实施计划与子代理编排、架构设计、调试、前端开发与技能创建全流程。 The licence is MIT.

When your agent uses it

  • 用户要实现新功能、修复 bug,或明确要求使用 TDD 方式开发、先写测试时。触发场景:tdd、测试驱动、测试驱动开发、先写测试、红绿重构、单元测试、test driven、TDD开发、用TDD写、测试先行、我要开始开发新功能
  • Tasks that involve Test-driven development

Example prompts

  • “/tdd-master”

Requirements

  • Python 3

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. 还没有一个因"正确原因"而失败的测试(RED 阶段未完成)
  2. 用户还没有确认接口设计和行为清单(阶段一未完成)

What it can do on your machine

Read from SKILL.md and the folder at commit ab0b827. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pytest

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

TDD Master loads about 941 tokens when it runs, and up to ~5.3k if it reads all its reference files. Until then it costs about 34 tokens; SKILL.md has 203 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~34
When it runs · the whole SKILL.md, loaded when a task matches
~941
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ProgrammerAnthony/Expert-Coding-Harness at commit ab0b827, republished under its MIT licence (© ProgrammerAnthony). 203 words, ~941 tokens.

Download SKILL.mdSave it as .claude/skills/tdd-master/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
tdd-master
description
Use when 用户要实现新功能、修复 bug,或明确要求使用 TDD 方式开发、先写测试时。触发场景:tdd、测试驱动、测试驱动开发、先写测试、红绿重构、单元测试、test driven、TDD开发、用TDD写、测试先行、我要开始开发新功能。

TDD 开发大师

铁律:没有失败的测试,不写一行生产代码。 先写代码再补测试的,必须删掉先写的代码重来。

<HARD-GATE>
禁止在以下情况下编写任何生产代码:
1. 还没有一个因"正确原因"而失败的测试(RED 阶段未完成)
2. 用户还没有确认接口设计和行为清单(阶段一未完成)
这两条无一例外,"简单功能"也不例外。
</HARD-GATE>

核心哲学

竖向切片,而非横向切片

反模式(横向切片):先把所有测试写完,再一口气写所有实现

  • 问题:测试套件成为规格书,不是活文档;实现阶段难以获得快速反馈

正确做法(竖向 tracer bullet 切片):每次选一个最小可验证行为,完成 RED→GREEN→REFACTOR 完整循环

  • 每个切片都是端到端的最小功能(一个完整行为)
  • 通过测试可以立即运行并得到结果
测试测行为,而非测实现
python
# 错误:测试内部实现(脆弱,重构即失效)
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": "a@example.com"})
    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(不可跳过):

<HARD-GATE>
必须在当前消息中实际运行测试命令并贴出失败输出。不得说"测试会失败"而不运行。看到测试失败的输出是进入 GREEN 阶段的唯一门票。
</HARD-GATE>
bash
pytest tests/test_user.py::test_用户注册成功返回用户ID -v

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

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

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

    bash
    pytest tests/test_user.py -v

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

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

REFACTOR 阶段

只在全绿时重构,RED 状态下严禁重构。

加载 references/refactoring-guide.md 进行安全重构:

  • 消除重复代码
  • 改善命名
  • 提取方法(不改变外部行为)

每次重构后立即运行全部测试:全绿则继续,失败则撤销上一步修改。

完成一个行为后

勾选清单,选下一个行为,重复循环。


阶段三:深模块设计检查

所有行为实现完成后,加载 references/deep-modules.md:

  • 接口是否足够简单(浅接口是警告信号)?
  • 是否可以进一步内化复杂性?
  • 模块边界是否清晰?

Mock 使用原则

加载 references/mocking-guide.md 获取详细指引。

何时使用 Mock:

  • 外部 I/O(网络请求、数据库、文件系统)
  • 时间相关(datetime.now()、time.sleep())
  • 随机数
  • 第三方付费 API

何时不用 Mock:

  • 自己写的代码(测试真实集成)
  • 简单的值对象
  • 不涉及副作用的纯函数

反模式警告

反模式识别特征处理方式
横向切片"先把所有测试写完"立刻停止,改为逐行为切片
测试实现细节patch.object 内部方法重写为测试行为
巨型测试一个测试验证多个行为拆分为多个测试
跳过 RED 验证"我知道测试会失败"必须执行,有时会有惊喜
GREEN 阶段重构测试刚过就大改先让所有测试通过再重构
过度 MockMock 了自己写的类测试真实集成
无意义测试名test_it_works改为行为描述

警告:当你想跳过 TDD 流程时

遇到以下想法,立刻停下——这些是你即将违反铁律的信号:

借口现实
"这个功能太简单,不需要先写测试"简单功能的边界条件往往出错。TDD 的价值在设计接口,不只是测试。
"先写代码,写完后补测试效果一样"补测试 = 测"代码做了什么",不是测"代码应该做什么"。本质不同。
"我已经在心里验证过了,测试只是形式"心理验证不算验证。必须运行命令并看到红色输出。
"用户在等,没时间写测试"没有测试的代码往往需要返工。TDD 总体耗时更短。
"这是修复 bug,不需要走 TDD"修 bug 时先写能复现 bug 的测试,是最重要的 TDD 应用场景之一。
"我只是稍微改了一点现有代码""稍微改" 没有测试保护 = 引入回归 bug 的标准路径。
"RED 阶段测试肯定会失败,没必要运行""肯定会失败"的测试有时不会失败——这意味着测试本身有问题。必须运行。

这些借口的本质都是同一件事:你在合理化绕过 TDD。删掉先写的代码,重来。

参考资源

  • references/testing-principles.md — 测试原则与可测试性设计
  • references/mocking-guide.md — Mock 使用指南
  • references/refactoring-guide.md — 安全重构技术
  • references/deep-modules.md — 深模块设计原则

© ProgrammerAnthony, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in skills/tdd-master of ProgrammerAnthony/Expert-Coding-Harness.

  • SKILL.md
  • README.md
  • references/deep-modules.md
  • references/mocking-guide.md
  • references/refactoring-guide.md
  • references/testing-principles.md

Open the folder on GitHubat commit ab0b827

Compare with similar skills

TDD Master next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

TDD Master compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
TDD Master this skillProgrammerAnthony/Expert-Coding-Harness235—~941Automated safety check: PassMIT
TDDfossasia/eventyay-interpretation1.6k28 repos~1.1kAutomated safety check: PassApache-2.0
TDD WorkflowhellangleZ/burn-in-cceverywhere-ralph11211 repos~2.4kAutomated safety check: PassNone
TDDsanity-io/sanity6.4k20 repos~1kAutomated safety check: PassMIT
Test Driven Developmentfarm-fe/farm5.6k49 repos~2.5kAutomated safety check: PassMIT
Tapd Story PipelineTencentBlueKing/bk-bcs840—~2.6kAutomated safety check: PassCustom licence

Similar skills

  • TDD

    fossasia/eventyay-interpretation

    Test-driven development. An agent skill from fossasia/eventyay-interpretation.

    1.6k GitHub starsUsed in 28 repos~1.1k tokens
    Testing & QAAuto-check passed
  • TDD Workflow

    hellangleZ/burn-in-cceverywhere-ralph

    A skill your agent uses when writing new features, fixing bugs, or refactoring code.

    112 GitHub starsUsed in 11 repos~2.4k tokens
    Testing & QAAuto-check passed
  • TDD

    sanity-io/sanity

    Official

    Test-driven development with red-green-refactor loop. An agent skill from sanity-io/sanity.

    6.4k GitHub starsUsed in 20 repos~1k tokens
    Testing & QAAuto-check passed
  • A skill your agent uses when implementing any feature or bugfix, before writing implementation code

    5.6k GitHub starsUsed in 49 repos~2.5k tokens
    Testing & QAAuto-check passed
  • Tapd Story Pipeline

    TencentBlueKing/bk-bcs

    单需求实现流水线——把一个 TAPD 需求从零推进到代码提交。自动串联技术澄清、 开发计划、任务拆分、TDD 实现、架构/安全校验、代码提交六个阶段。

    840 GitHub stars~2.6k tokensUpdated 13 days ago
    Testing & QAAuto-check passed
  • Absolute Init

    maddhruv/absolute

    One-time setup for absolute: interview how you want it to behave (output style, autonomy, TDD strictness, spec dir, families) + detect the stack once, then write .absolute.config.json (project…

    218 GitHub starsUsed in 1 repo~3k tokens
    Testing & QAAuto-check passed

More from ProgrammerAnthony/Expert-Coding-Harness

All 23 skills in this repo
  • Architecture Advisor

    ProgrammerAnthony/Expert-Coding-Harness

    A skill your agent uses when 用户需要设计新系统架构、评审或优化已有系统架构、选择技术方案时。触发场景:架构分析、架构设计、系统设计、architecture、架构优化、系统架构、架构评审、架构咨询、技术方案、技术设计、如何组织代码结构、模块划分、服务拆分、数据库选型、微服务设计。

    235 GitHub stars~673 tokensUpdated 4 mo ago
    Auto-check passed
  • Code Review Expert

    ProgrammerAnthony/Expert-Coding-Harness

    A skill your agent uses when 用户要求审查代码、评估代码质量、提交 PR 前检查、发现代码有潜在问题时。触发场景:代码审查、code review、审查代码、review、检查代码、代码检查、代码质量、代码评审、这段代码有问题吗、帮我看看代码、合并前检查。

    235 GitHub stars~806 tokensUpdated 4 mo ago
    Auto-check passed
  • Code Security Audit

    ProgrammerAnthony/Expert-Coding-Harness

    A skill your agent uses when 用户需要对代码进行安全审计、发现安全漏洞、上线前安全评估、检查代码是否存在安全风险时。触发场景:代码安全审计、安全审计、白盒审计、安全扫描、漏洞检测、漏洞挖掘、SQL注入、命令注入、XSS、SSRF、反序列化、认证绕过、越权、代码安全检查、security audit、code…

    235 GitHub stars~1.6k tokensUpdated 4 mo ago
    Auto-check passed
  • Debug Expert

    ProgrammerAnthony/Expert-Coding-Harness

    A skill your agent uses when 程序出现错误、异常、崩溃,或行为与预期不符,或测试失败,或无法定位问题根因时。触发场景:调试、debug、报错、错误、异常、bug、问题排查、故障排查、不工作、崩溃、无法运行、出错了、为什么不生效、运行报错、跑不起来、程序挂了。

    235 GitHub stars~986 tokensUpdated 4 mo ago
    Auto-check passed
  • Frontend Code Review

    ProgrammerAnthony/Expert-Coding-Harness

    A skill your agent uses when 用户需要审查前端代码(React/Vue/Next.js/TypeScript/Tailwind等)、检查代码质量、性能问题、可维护性、安全漏洞、最佳实践落地时。触发场景:前端代码评审、前端代码优化、React/Vue代码检查、TypeScript代码审查、前端性能优化、前端安全审计、前端代码规范检查。

    235 GitHub stars~614 tokensUpdated 4 mo ago
    Auto-check passed
  • Frontend Performance Optimization

    ProgrammerAnthony/Expert-Coding-Harness

    A skill your agent uses when 用户需要优化前端性能、提升页面加载速度、减少白屏时间、优化交互流畅度、进行性能排查时。触发场景:前端性能优化、页面加载慢、白屏时间长、卡顿、LCP/FID/CLS指标优化、前端性能分析、打包体积优化。

    235 GitHub stars~701 tokensUpdated 4 mo ago
    Auto-check passed

Categories

Questions about TDD Master

What does TDD Master do?

A skill your agent uses when 用户要实现新功能、修复 bug,或明确要求使用 TDD 方式开发、先写测试时。触发场景:tdd、测试驱动、测试驱动开发、先写测试、红绿重构、单元测试、test driven、TDD开发、用TDD写、测试先行、我要开始开发新功能。. TDD Master is an agent skill from ProgrammerAnthony/Expert-Coding-Harness.

When should I use TDD Master?

TDD Master fits situations like: 用户要实现新功能、修复 bug,或明确要求使用 TDD 方式开发、先写测试时。触发场景:tdd、测试驱动、测试驱动开发、先写测试、红绿重构、单元测试、test driven、TDD开发、用TDD写、测试先行、我要开始开发新功能; tasks that involve Test-driven development.

How do I install TDD Master in Claude Code?

Run `npx skills add ProgrammerAnthony/Expert-Coding-Harness --skill tdd-master -a claude-code`. Or copy the skill folder (skills/tdd-master in ProgrammerAnthony/Expert-Coding-Harness) into .claude/skills/tdd-master in your project. Claude Code loads it when a task matches its description.

How do I install TDD Master in Codex?

Run `npx skills add ProgrammerAnthony/Expert-Coding-Harness --skill tdd-master -a codex`. Or copy the skill folder (skills/tdd-master in ProgrammerAnthony/Expert-Coding-Harness) into .agents/skills/tdd-master in your project. Codex loads it when a task matches its description.

Can I use TDD Master in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ProgrammerAnthony/Expert-Coding-Harness --skill tdd-master -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/tdd-master, .gemini/skills/tdd-master, .github/skills/tdd-master and .opencode/skills/tdd-master in your project.

What does TDD Master need to run?

Going by SKILL.md and its folder, TDD Master needs the command-line tools its instructions call (pytest). Our summary lists: Python 3.

Does TDD Master access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is TDD Master safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does TDD Master use?

TDD Master is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does TDD Master use?

About 941 tokens (SKILL.md is roughly 3.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.3k tokens, read only when the agent opens those files.

What are the alternatives to TDD Master?

Skills that share tags, products or a category with TDD Master: TDD (fossasia/eventyay-interpretation, 1.6k stars), TDD Workflow (hellangleZ/burn-in-cceverywhere-ralph, 112 stars), TDD (sanity-io/sanity, 6.4k stars) and Test Driven Development (farm-fe/farm, 5.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains TDD Master?

ProgrammerAnthony (a GitHub user) maintains it in ProgrammerAnthony/Expert-Coding-Harness, which has 235 GitHub stars. The repository holds 23 skills in this directory. The repository was last updated on May 11, 2026.

Source: ProgrammerAnthony/Expert-Coding-Harness on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.