tdd
GitHub遵循TDD模式,分步实现功能:先写失败测试(Red),再写最小代码使通过(Green),最后重构优化。循环执行直至完成并展示差异供审查。
触发场景
用户要求新功能或函数
提到测试优先或TDD
安装
npx skills add wesammustafa/Claude-Code-Everything-You-Need-to-Know --skill tdd -g -y
SKILL.md
Frontmatter
{
"name": "tdd",
"description": "Builds a requested feature test-first, one behavior at a time, and stops at a diff for review. Use when the user asks for a new function or feature, or says test-first or TDD."
}
Build this test-first, one behavior at a time: $ARGUMENTS
- Red: write one failing test for the next behavior. Run the tests and confirm that it fails, and fails for the reason you expect. Don't change code outside the tests in this step.
- Green: write the least code that makes the new test pass, then run the whole test suite and confirm that every test passes. Don't change the tests in this step.
- Refactor: improve the names and structure of the code you just wrote without changing what it does, and run the tests again. They must still pass.
Repeat until the feature is done, then run the whole test suite and show the diff. Don't commit: the user reviews the diff and commits.
版本历史
- d6d24d6 当前 2026-11-02 19:33


