superpowers-tdd
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTDD Skill
TDD 技能
When to use this skill
适用场景
- new features that can be unit tested
- bug fixes (always add a regression test if practical)
- refactors (protect behavior with tests first)
- 可进行单元测试的新功能开发
- 漏洞修复(若可行,务必添加回归测试)
- 代码重构(先通过测试保障原有行为)
Rules
规则
- Prefer red -> green -> refactor.
- If tests are hard, still add verification: minimal repro script, integration test, or clear manual steps.
- Keep tests focused: one behavior per test where possible.
- Name tests by behavior, not implementation details.
- 优先遵循红 -> 绿 -> 重构流程。
- 若测试编写难度大,仍需添加验证机制:最简复现脚本、集成测试或清晰的手动测试步骤。
- 保持测试聚焦:尽可能每个测试对应单一行为。
- 测试命名基于行为,而非实现细节。
Process
流程
- Define the behavior change (what should be true after).
- Write/adjust a test to capture it (make it fail first if possible).
- Implement the minimal change to pass.
- Refactor if needed (keep passing).
- Run the relevant test suite + any linters.
- 定义行为变更(明确变更后的预期结果)。
- 编写/调整测试以捕获该行为(尽可能先让测试失败)。
- 实现最小化变更使测试通过。
- 如有需要进行重构(确保测试始终通过)。
- 运行相关测试套件及所有代码检查工具。
Output requirements
输出要求
When you change code, include:
- what tests you added/changed
- how to run them
- what they prove
当你修改代码时,需包含:
- 新增/修改的测试内容
- 测试运行方式
- 测试所验证的内容