关于 generate-tdd-tasks
将项目需求整理为 TDD 任务清单的技能。它会识别仓库约定,按测试优先流程拆分实现工作,并在保存前检查文档与评审任务等要求。
主要功能
- 01识别语言与项目约定
- 02将需求拆分为实现任务
- 03采用 RED、GREEN 和 REFACTOR 循环
- 04强制执行任务清单检查门槛
- 05规定输出路径与必需章节
适用场景
- 01根据功能请求规划实现
- 02为现有仓库准备测试优先工作
- 03检查生成的任务清单是否包含必需步骤
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ igmarin/ ruby-core-skills --skill generate-tdd-tasks安装后在 Claude Code 中输入/generate-tdd-tasks确认已加载。
详细介绍
生成 TDD 任务
核心流程
步骤 1:项目检测
生成任务前,检测并列出项目约定:
- 测试命令 — 检查配置文件。Ruby:如果
Gemfile中包含rspec,使用bundle exec rspec。Python:pytest。JS/TS:npm test/yarn test。Rust:cargo test。Go:go test ./...。 - 源代码目录 —
lib/(Ruby)、src/(大多数其他语言)。 - 测试目录 —
spec/(RSpec)、test/(Minitest/pytest/unittest/Go 标准测试)。 - 文档工具 — YARD(Ruby)、JSDoc(JS/TS)、rustdoc(Rust)、pydoc(Python)。
- 语言/框架 — 根据
Gemfile、Cargo.toml、package.json、go.mod、pyproject.toml检测。
步骤 2:需求分析
将功能/PRD 拆分为实现任务:
- 识别用户可见的行为 — 功能、端点、数据流。
- 应用首个切片启发式:
- Web 应用 / API:从请求/集成测试开始。
- 服务 / 领域逻辑:从服务或单元测试开始。
- 后台任务:从工作器测试开始。
- 外部集成:从客户端层测试开始。
- 库 / SDK:从公共 API 测试开始。
- 将相关行为归入父任务,并采用 TDD 四元组。
步骤 3:生成任务列表
按以下规定的结构创建 tasks/tasks-<feature-name>.md。
步骤 4:验证关卡(硬性关卡)
保存输出前,以下每项关卡都必须通过:
1. Task 0.0 is the feature branch creation — mandatory, must be first.
2. Every implementation task uses the TDD quadruplet (RED → fail → GREEN → pass → REFACTOR).
3. Public API documentation, update existing documentation, and code review tasks are present — do not omit them.
4. Guidance Used section explains what conventions/guides/skills drove the breakdown.
5. Relevant Files section lists detected source and test directories and key files.
6. Output is saved to tasks/tasks-<feature-name>.md unless user specifies otherwise.
如果任何关卡未通过,请在保存前修正任务列表。
任务列表模板
# Task List: <Feature Name>
Based on: <prd or requirement source>
## Guidance Used
- <Skill or convention that guided this breakdown — e.g. tdd-process, test-planning-process, project conventions>
- <Specific decisions: why first slice chosen, why certain boundary selected>
## Relevant Files
- Source directory: `<detected source dir>/`
- Test directory: `<detected test dir>/`
- `<path/to/file.ext>` — <why it's relevant>
- `<path/to/test.ext>` — <test coverage>
---
## Tasks
- [ ] **0.0 Create feature branch**
`git checkout -b feature/<feature-name>`
- [ ] **1.0 <Behavior Description> (TDD Quadruplet)**
- [ ] 1.1 Write failing test for `<behavior>`
`<test-dir>/path/to/test.ext`
- [ ] 1.2 Run test — verify failure
`<test-command>` → expected failure
- [ ] 1.3 Implement minimal code to pass
`<source-dir>/path/to/impl.ext`
- [ ] 1.4 Run test — verify success
`<test-command>` → green
- [ ] 1.5 REFACTOR: Clean up implementation
- [ ] **2.0 <Next Behavior> (TDD Quadruplet)**
- [ ] 2.1 ... (same pattern as 1.1-1.5)
- [ ] **3.0 <Next Behavior> (TDD Quadruplet)**
- [ ] 3.1 ...
- [ ] **N.0 Public API Documentation**
- [ ] N.1 Add YARD/JSDoc/rustdoc/pydoc comments to all new public methods
`<source-dir>/path/to/file.ext`
- [ ] **N+1.0 Update Existing Documentation**
- [ ] N+1.1 Update README or relevant docs for any changed behavior
- [ ] **N+2.0 Code Review**
- [ ] N+2.1 Self-review diff before creating PR
- [ ] N+2.2 Run full test suite — all green
集成
| 上下文 | 后续技能 |
|---|---|
| 执行 TDD 循环 | tdd-process |
| 选择第一个失败的测试 | test-planning-process |
| 编写公共 API 文档 | write-yard-docs |
| 审查最终变更集 | review-process |
| PRD 或需求来源 | create-prd(agnostic-planning-skills) |
| 优化单个工单 | plan-tickets(agnostic-planning-skills) |
评论
支持 Markdown