‹ 首页

develop-tdd

@dragoscirjan · 收录于 1 周前 · 上游提交 1 个月前

When this skill is loaded, the developer follows the Red-Green-Refactor cycle. The orchestrator loads this skill when the user requests TDD.

适合你,如果采用TDD方式开发,需要遵循红绿重构循环。

/ 通过 npx 安装 校验哈希
npx oh-my-skill add dragoscirjan/opencode-config/develop-tdd
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- dragoscirjan/opencode-config/develop-tdd
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify dragoscirjan/opencode-config/develop-tdd
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
0GitHub stars
~368上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 f561928 · 表述以原文为准
它做什么

Claude 会按照红-绿-重构循环开发:先写测试(红),再写最少代码让测试通过(绿),最后优化代码(重构)。每次步骤后都会报告结果。

什么时候触发

当你要求 Claude 使用测试驱动开发(TDD)时触发。

装好后可以这样说
Claude 会先写测试,再实现代码。
Claude 会按红-绿-重构步骤进行。
技能原文 SKILL.md作者撰写 · MIT · f561928

TDD — Test-Driven Development

When this skill is loaded, the developer follows the Red-Green-Refactor cycle. The orchestrator loads this skill when the user requests TDD.

Cycle
  1. Red — Write failing tests first. Tests define expected behavior from the task plan. Run them — verify they fail for the right reasons (not syntax/import errors).
  2. Green — Write the minimum code to make all tests pass. No more.
  3. Refactor — Clean up code and tests. No behavior changes. All tests still pass.
Rules
  • Write tests before any implementation code
  • Each test covers one behavior — name it after what it verifies
  • Start with the simplest case, add complexity incrementally
  • Run tests after every step (red, green, refactor) — report results each time
  • Tests must fail for the right reason — a missing function, not a syntax error
  • Do NOT write implementation and tests simultaneously
  • Do NOT write all tests upfront — write one test (or a small batch), make it pass, then write the next
Test Quality
  • Test behavior, not implementation details
  • Include edge cases: empty inputs, nulls, boundary values, error conditions
  • Keep tests independent — no shared mutable state
  • Mock external dependencies, not internal logic
  • Arrange-Act-Assert structure
Status Updates

After each TDD step, tell the orchestrator what happened in plain English, ≤50 words. Example: "Red: wrote 3 tests for auth middleware — all fail as expected. Files: src/auth.test.ts"

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。