This is a principled TDD workflow that fights the two most common mistakes: writing tests that break when you refactor, and writing all your tests before any implementation. It pushes you to test behavior through public interfaces, not implementation details, so your tests survive internal changes. The workflow is vertical slicing, one test and implementation at a time, with planning up front to agree on what actually matters. You get a tracer bullet first to prove the path works end to end, then iterate. The philosophy is opinionated but right: good tests read like specs and don't care how you built it, bad tests mock internals and shatter during refactors. Includes concrete checklists and anti-patterns.
- skills.sh installs
- 6.1K
- GitHub stars
- 5.7K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add vinvcn/mattpocock-skills-zh-cn --skill tdd --agent claude-codeInstalls into .claude/skills of the current project.
Files
测试驱动开发
TDD 是 red -> green loop。这个 skill 是让该 loop 产出值得保留的 tests 的 reference:什么是好 test、tests 应该放在哪里、anti-patterns,以及 loop 的规则。每个 cycle 前和 cycle 中都要参考这些内容,而不是事后才看。
探索 codebase 时,读取 GLOSSARY.md(如果存在),让 test names 和 interface vocabulary 与项目 domain language 对齐,并尊重你触碰区域的 ADRs。
什么是好 test
Tests 应通过 public interfaces 验证 behavior,而不是 implementation details。代码可以完全改变;tests 不该随之改变。一个好 test 读起来像 specification:"user can checkout with valid cart" 能清楚说明存在什么能力;因为它不关心 internal structure,所以能承受 refactors。
示例见 tests.md,mocking 规则见 mocking.md。
Seams:tests 放在哪里
Seam 是你测试的 public boundary:可以观察 behavior、但不伸手进入内部的 interface。Tests 放在 seams 上,绝不针对 internals。
只测试预先认可的 seams。 写任何 test 前,先写下要测试的 seams 并与用户确认。未经确认的 seam 不写 test。你无法测试所有东西;提前认可 seams,才能把测试精力放在 critical paths 和复杂 logic 上,而不是每个 edge case。
询问:"What's the public interface, and which seams should we test?" 给每个提议的 seam 加一行说明:它能捕获什么,又会漏掉什么。
当 interface 的形状本身就是问题所在时(module 该多深、seam 该放在哪里、interface 应该暴露什么),调用 Skill 工具并指定 codebase-design 获取词汇。它是 module、interface、depth、seam、adapter、leverage 和 locality 这些术语的共享来源,是供查阅的 reference,而不是要运行的 session。
反模式
Sponsors
Details
- Repository
- github.com/vinvcn/mattpocock-skills-zh-cn
- Categories
- Testing & QA, Code Review & Quality
- First seen
- Jun 3, 2026
More from vinvcn/mattpocock-skills-zh-cn
All 39- Improve Codebase Architecture6.1K
- Prototype6K
- Triage5.8K
- Git Guardrails Claude Code5.7K
- Scaffold Exercises5.7K
- Setup Pre Commit5.7K
- Migrate To Shoehorn5.6K
- Teach5.4K
- Grilling4.7K
- Domain Modeling4.4K
- Code Review4.4K
- Ask Matt4.4K
- Diagnosing Bugs4.4K
- Implement4.3K
- Codebase Design4.3K
- Research4.2K
- Writing Shape3.7K
- Writing Fragments3.7K
- Writing Beats3.7K
- Resolving Merge Conflicts3.5K
- To Prd2.2K
- Design An Interface2.1K
- To Issues2.1K
- Qa2.1K
