tdd

仓库创建 2026年2月2日最近提交 6 天前SkillHot 收录 1 小时前
▸ 精选理由

让代理在可验证的短回路中稳步推进功能与修复,提升代码可靠性。

这个 Skill 做什么

以红-绿-重构循环驱动实现:先写失败测试,再实现最小改动并重构代码。

先写一个会失败的测试(red),再做最小改动让测试通过(green),最后把代码重构干净(refactor)。适合在实现新功能或修 bug 且对正确性有要求时使用。特别之处是用失败测试把目标定死,反馈最快、能防止过度设计,常见术语有 TDD、red-green-refactor。

▸ 展开 SKILL.md 英文原文

Drive a change through a red-green-refactor loop - failing test first, minimal code to pass, then clean up. Use when implementing a feature or fixing a bug where correctness matters and a test can pin the behavior. Says "TDD", "test first", "red green refactor", "write the test first".

开发编程测试驱动单元测试开发流程通用
2.7k
Stars
257
Forks
40
仓库内 Skill
+55
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/rohitg00/pro-workflow/main/skills/tdd/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/rohitg00/pro-workflow/main/skills/tdd/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# tdd

The agent codes better with a tight feedback loop than with a long
specification. A failing test is the tightest loop there is: it states the
target, and the target either goes green or it does not.

## The loop

1. **Red.** Write one failing test that states the next slice of behavior.
   Run it. Confirm it fails for the right reason - a test that passes before
   you write the code is testing nothing. If it errors instead of failing on
   the assertion, fix the test setup first.
2. **Green.** Write the least code that makes the test pass. Not the general
   solution, not the abstraction - the minimal move. Run the test. Green.
3. **Refactor.** Now clean up with the test as a net: re
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有