asiaostrich/universal-dev-standards/tdd-assistant
Claude Code and agent skill by asiaostrich/universal-dev-standards
- community
Checking that the SKILL.md file is still in the repository.
[UDS] 测试驱动开发(TDD)的参考资料:红-绿-重构循环、FIRST 原则与 Arrange-Act-Assert 结构。 Use when: 在实现前先写一个会失败的测试、用 Arrange-Act-Assert 组织测试、以 FIRST 检视既有测试。 Not for: 交互式地驱动 RED/GREEN 循环——该部分已移至采用层(XSPEC-095);测量测试覆盖了多少代码——请用 /coverage。 Keywords: TDD, test first, Red Green Refactor, FIRST, Arrange Act Assert, unit test, 测试驱动开发, 红绿重构, 单元测试.
Install
npx vskill@latest install asiaostrich/universal-dev-standards/tdd-assistantSKILL.md
The same SKILL.md was published earlier as asiaostrich/universal-dev-standards/tdd-assistant.
TDD 助手
语言: English | 简体中文
⚠️ 状态:参考(仅供参考,非可执行流程) — TDD 流程协调(RED→GREEN→REFACTOR 循环、测试执行 gates)已于 2026-04-28 移至 采用层(adoption layer,XSPEC-095)。此处保留 TDD 原则、FIRST 规则、AAA 格式、语言范例、流程指南供参考。生命周期协调已移至采用层(XSPEC-095);本文档仅供参考。如需强制执行,请使用你的采用层工具链。
引导测试驱动开发(TDD)流程:红-绿-重构。
TDD 循环
工作流程
📖 以下为流程的参考结构,非可执行步骤;自动化/强制执行请用采用层工具链(XSPEC-095)。
阶段 1:RED - 撰写失败测试
- 撰写描述期望行为的测试
- 执行测试 - 确认它因正确的原因失败
- 使用 AAA 模式(Arrange-Act-Assert)
阶段 2:GREEN - 让测试通过
- 撰写最少的代码使测试通过
- 此阶段可以接受硬编码
- 执行测试 - 确认它通过
阶段 3:REFACTOR - 改善代码
- 消除重复(DRY)
- 改善命名和结构
- 每次修改后都执行测试
- 不新增功能
FIRST 原则
| 原则 | 说明 | Description | |
|---|---|---|---|
| Fast | 测试快速执行(< 100ms/单元) | Tests run quickly | |
| Independent | 测试间无共享状态 | No shared state between tests | |
| Repeatable | 每次结果相同 | Same result every time | |
| Self-validating | 明确的通过/失败结果 | Clear pass/fail result | |
| Timely | 在产品代码之前撰写 | Written before production code |
使用方式
/tdd- 开始互动式 TDD 工作阶段/tdd calculateTotal- 对特定函数进行 TDD/tdd "user can login"- 对用户故事进行 TDD
下一步引导
/tdd 完成后,AI 助手应建议:
TDD 循环完成。建议下一步:- 执行/checkin通过品质关卡 ⭐ 推荐- 执行/coverage确认测试覆盖率- 执行/code-review自我审查代码
参考
- TDD 语言范例 — 需要某个特定语言的实际范例时读它。
- TDD 工作流程指南 — 要完整跑一轮红-绿-重构时读它。
- 详细指南:guide.md
- 核心规范:test-driven-development.md
AI 代理行为
完整的 AI 行为定义请参阅对应的命令文件:`/tdd`
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinglocales/zh-CN/skills/tdd-assistant/SKILL.md
Popularity
- Repository stars
- 80
- Repository forks
- 14
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 27 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/asiaostrich/universal-dev-standards/tdd-assistant)