tdd-best-practices
Test-Driven Development guidance. Use when writing tests before implementation, applying Red-Green-Refactor, testing Value Object contracts, typed domain failures/Results, DDD Aggregates, Domain Events/subscribers, transaction or cache boundaries, data migrations/backfills, Criteria/query adapters, repository contracts or persistence adapters, choosing between test doubles, deciding test granularity, reviewing test suite quality, or diagnosing brittle tests.
原文 · 译文尚未补齐适用对象:软件开发与测试。自动收录 · 待核查。
原作者说明节选
从固定版本的 SKILL.md 提取,保留原文语言。以下内容属于作者说明,本站尚未验证安装、兼容或运行结果。
查看英文原文
原文涵盖的主题
- TDD Best Practices
- Working Style
- The Red-Green-Refactor Cycle
- The 3 Laws (Uncle Bob)
- Design Workflow
- Choosing Test Granularity
- Heuristics
- When to mock
Use this skill when the main question is how to drive implementation from tests, how to structure a test suite, or how to recover discipline in a codebase where tests were written after the fact. 1. Write one failing test, then make it pass with the minimum code needed. 2. Refactor only when all tests are green. 3. Test behaviors, not implementations — the public API, not private methods. 4. Keep tests as simple as the production code they verify. 5. A test suite that is hard to change is as expensive as production code that is hard to change. The discipline is in the order. Never refactor on Red. On Green, add only the behavior demanded by the current failing test. 1. You may not write production code unless you have a failing unit test. 2. You may not write more of a unit test than is sufficient to fail. An intentionally missing public API/type can be a valid first Red; unrelated compilation or setup failures are not. 3. You may not write more production code than is sufficient to make the currently failing test pass. 1. Describe the behavior — what should the system do? Write the test name first. 2. Write a failing test — make it fail for the right reason (assertion, not setup e
这里只展示节选,请以完整原文和当前要求为准。
- 来源仓库
- OKHP3/skillz
- 源文件
- community/tdd-best-practices/SKILL.md
- 固定版本
- 7b187777d42ab7bc7bab1e5f2c940cd3139ecebf
来源与内容状态
本条为自动发现的元数据,尚未完成人工文档核查;适用性与运行结果待核查。
原作者:OKHP3/skillz · 原作者仓库元数据。文档核查:未核查。最近来源检查:2026-11-10T10:00:54.376Z。
分类由名称、说明与路径规则生成,分类不代表已核实适配。
许可与权利归属
MIT。第三方内容及版权归原作者,使用条件以原文为准。
许可原文 ↗本站没有因同步、复制或用户自报成功而将资源标为运行验证通过。
限制与注意事项
- 元数据收录不代表本站已经安装、适配、实测或进行安全审查。