Objective
Your objective is to break down the "Technical Design Document" into a fine-grained, executable development task list, and generate the "Development Task Plan Document", namely 3_任务规划.md。
Background
We already have clear requirements (docs/{功能名称}/1_需求文档.md) and a detailed design (docs/{功能名称}/2_技术方案.md). Now we need to formulate an execution plan to guide developers (or AI) to complete coding step by step.
Input
docs/{功能名称}/2_技术方案.md(Technical Design Document)docs/{功能名称}/1_需求文档.md(Functional Requirements Document - for acceptance criteria cross-reference)
Guardrails - CRITICAL
Please strictly follow the general guardrail rules:specs/GUARDRAILS.md Current Phase: Planning & Management Phase
Workflow
- Pre-check:
- Confirm whether
docs/{功能名称}/2_技术方案.mdexists and is complete - Confirm whether the acceptance criteria mapping table in the technical solution is complete
- Confirm UI prototype resources: Check whether
docs/{功能名称}/prototypes/ordocs/product_prototypes/contains the corresponding HTML prototype files. - If missing, prompt the user to first complete the technical solution design or UI prototype generation
- Confirm whether
- Task Breakdown:
- Do not create prototype tasks: UI prototypes should be completed before the current phase. The task of this phase is toimplementcode, not to design prototypes.
- Break down each design point in the technical solution into an independent development task
- Each task should be atomic (< 4 hours, single responsibility)
- Task granularity reference:
- Create a database table = 1 task
- Implement an API endpoint = 1 task
- Implement a page component = 1 task
- Write unit tests = 1 task
- Dependency Analysis:
- Identify dependencies between tasks (which tasks must be completed first)
- Mark blocking tasks (critical tasks that multiple tasks depend on)
- Determine the execution order of tasks (backend before frontend, core before peripheral)
- Risk Assessment:
- Identify tasks with high technical difficulty and mark them as "risk tasks"
- Provide additional explanations or suggestions for risk tasks
- Acceptance Criteria Mapping:
- Ensure every acceptance criterion has a corresponding task
- Clearly mark the corresponding acceptance criterion ID in the task
- Effort Estimation:
- Estimate the effort for each task (in hours)
- Calculate the total effort and provide an overall schedule expectation
- Double Confirmation: Before generating the document, confirm with the user:
"Based on the technical solution, I have broken it down into [N] development tasks, with an estimated total effort of [X] hours. Before generating the document, do you have any other requirements? (e.g., priority adjustments, task merging, etc.)"
- Document Generation: Output Markdown content that conforms to the following format.
- Final Deliverable: After the document content is confirmed by the user, save it to
docs/{功能名称}/3_任务规划.md(in the same directory as the requirements document and technical solution).
Output Template (3_Task_Planning.md)
# 开发任务计划: [功能名称]
## 0. 任务概览 (Task Overview)
* **总任务数**: [N] 个
* **预计总工时**: [X] 小时(约 [Y] 个工作日)
* **关键里程碑**:
* 阶段一完成:[日期或工时]
* 阶段二完成:[日期或工时]
* 整体完成:[日期或工时]
* **风险任务**: [列出技术难度高的任务编号]
* **阻塞任务**: [列出被多个任务依赖的关键任务编号]
## 1. 准备工作 (Preparation)
- [ ] **Prep-01**: 创建功能分支 `feature/xxx`
* 说明:从 main/develop 分支创建新分支
* 验证:分支创建成功
- [ ] **Prep-02**: 确认依赖库/环境就绪
* 说明:检查技术方案中提到的新依赖是否已安装
* 验证:项目可正常启动
## 2. 开发任务 (Development Tasks)
> 按依赖顺序排列,每个任务耗时 < 4h
### 阶段一:数据层 (Data Layer)
> 先完成数据库设计和数据访问层
- [ ] **Task-01**: [任务标题]
* **说明**: 创建 xxx 表 / 修改 xxx 表结构
* **涉及文件**: `migrations/xxx.sql` 或 `models/xxx.js`
* **参考**: 技术方案 Sec 3.1
* **对应AC**: AC-001
* **提示词**: "帮我编写 migration 脚本,创建 xxx 表,参考技术方案 Sec 3.1"
* **预估工时**: 1h
* **依赖**: 无
* **验证标准**:
- [ ] 数据库迁移脚本执行成功
- [ ] 表结构符合设计文档
- [ ] **Task-02**: [任务标题]
* **说明**: 实现 xxx 数据访问层(DAO/Repository)
* **涉及文件**: `repositories/xxx.js`
* **参考**: 技术方案 Sec 3.1
* **对应AC**: AC-001
* **预估工时**: 2h
* **依赖**: Task-01
* **验证标准**:
- [ ] 单元测试覆盖 CRUD 操作
- [ ] 测试通过率 100%
### 阶段二:业务逻辑层 (Business Logic Layer)
> 实现核心业务逻辑和 API 接口
- [ ] **Task-03**: [任务标题]
* **说明**: 实现 xxx API 接口
* **涉及文件**: `controllers/xxx.js`, `services/xxx.js`
* **参考**: 技术方案 Sec 2.2
* **对应AC**: AC-002
* **提示词**: "实现 xxx API 接口,参考技术方案 Sec 2.2,注意参数校验"
* **预估工时**: 3h
* **依赖**: Task-02
* **风险标注**: ⚠️ 涉及复杂业务逻辑
* **验证标准**:
- [ ] API 返回格式符合设计文档
- [ ] 正常流程测试通过
- [ ] 异常场景测试通过(参数校验、权限校验)
- [ ] **Task-04**: [任务标题]
* **说明**: 实现 xxx 核心算法
* **涉及文件**: `services/xxx.js`
* **参考**: 技术方案 Sec 4.1
* **对应AC**: AC-003
* **预估工时**: 4h
* **依赖**: Task-03
* **阻塞标注**: 🔒 后续多个任务依赖此任务
* **验证标准**:
- [ ] 算法逻辑正确
- [ ] 边界条件测试通过
- [ ] 性能满足要求(< 200ms)
### 阶段三:表现层 (Presentation Layer)
> **注意**: 必须基于已有的 UI 原型进行开发,禁止在此阶段重新设计原型。
- [ ] **Task-05**: [任务标题]
* **说明**: 实现 xxx 页面组件 (基于现有原型)
* **涉及文件**: `components/xxx.jsx`, `pages/xxx.jsx`
* **UI 来源**: `docs/product_prototypes/[文件名].html` 或 `docs/{功能名称}/prototypes/[文件名].html`
* **参考**: 技术方案 Sec 2.2
* **对应AC**: AC-004
* **提示词**: "读取 docs/.../xxx.html,使用项目约定的技术栈实现组件。注意:完全还原原型布局和样式。"
* **预估工时**: 1h
* **依赖**: Task-03
* **验证标准**: (必须包含 UI 还原度检查)
- [ ] 组件视觉效果与 `[文件名].html` 原型一致
- [ ] 响应式表现符合预期
- [ ] 交互逻辑(点击、跳转)正常
- [ ] **Task-06**: [任务标题]
* **说明**: 实现 xxx 交互逻辑
* **涉及文件**: `components/xxx.jsx`
* **参考**: 技术方案 Sec 2.2
* **对应AC**: AC-005
* **预估工时**: 2h
* **依赖**: Task-05
* **验证标准**:
- [ ] 用户操作流程正常
- [ ] 错误提示显示正确
- [ ] 加载状态显示正常
### 阶段四:异常处理与优化 (Error Handling & Optimization)
> 完善异常处理和性能优化
- [ ] **Task-07**: [任务标题]
* **说明**: 实现异常场景处理
* **涉及文件**: `services/xxx.js`, `components/xxx.jsx`
* **参考**: 技术方案 Sec 5
* **对应AC**: AC-006 (异常场景)
* **预估工时**: 2h
* **依赖**: Task-06
* **验证标准**:
- [ ] 网络失败时显示重试按钮
- [ ] 权限不足时跳转到无权限页
- [ ] 数据为空时显示空状态页
- [ ] **Task-08**: [任务标题]
* **说明**: 性能优化和缓存实现
* **涉及文件**: `services/xxx.js`, `utils/cache.js`
* **参考**: 技术方案 Sec 6
* **对应AC**: 非功能需求
* **预估工时**: 2h
* **依赖**: Task-07
* **验证标准**:
- [ ] 响应时间 < 200ms
- [ ] 缓存命中率 > 80%
### 阶段五:测试与集成 (Testing & Integration)
> 补充测试和联调
- [ ] **Task-09**: 补充单元测试
* **说明**: 为核心逻辑补充单元测试
* **涉及文件**: `tests/unit/xxx.test.js`
* **参考**: 技术方案 Sec 4
* **对应AC**: 所有AC
* **提示词**: "为 xxx 模块编写单元测试,覆盖核心逻辑"
* **预估工时**: 3h
* **依赖**: Task-08
* **验证标准**:
- [ ] 测试覆盖率 > 80%
- [ ] 所有测试通过
- [ ] **Task-10**: 集成测试与联调
* **说明**: 前后端联调,端到端测试
* **涉及文件**: `tests/integration/xxx.test.js`
* **参考**: 需求文档验收标准
* **对应AC**: 所有AC
* **预估工时**: 2h
* **依赖**: Task-09
* **验证标准**:
- [ ] 完整流程走通
- [ ] 所有验收标准通过
- [ ] **Task-11**: Bug 修复与边缘情况处理
* **说明**: 修复测试中发现的问题
* **涉及文件**: 根据 Bug 确定
* **参考**: 测试报告
* **对应AC**: 所有AC
* **预估工时**: 2h
* **依赖**: Task-10
* **验证标准**:
- [ ] 所有已知 Bug 修复
- [ ] 回归测试通过
## 3. 验收标准检查清单 (AC Checklist)
> 确保所有验收标准都有对应的任务
| 验收标准ID | 验收标准描述 | 对应任务 | 状态 |
| :--- | :--- | :--- | :--- |
| AC-001 | [描述] | Task-01, Task-02 | ⬜ 待完成 |
| AC-002 | [描述] | Task-03 | ⬜ 待完成 |
| AC-003 | [描述] | Task-04 | ⬜ 待完成 |
## 4. 验证计划 (Verification Plan)
### 4.1 开发阶段验证
- [ ] 每个任务完成后,运行相关单元测试
- [ ] 每个阶段完成后,进行阶段性集成测试
### 4.2 最终验证
- [ ] 运行全量单元测试(覆盖率 > 80%)
- [ ] 运行集成测试(所有 API 测试通过)
- [ ] 按照验收标准逐项手工验证
- [ ] 性能测试(响应时间、并发量)
- [ ] 安全测试(权限校验、数据校验)
### 4.3 上线前检查
- [ ] 代码审查(Code Review)
- [ ] 文档更新(API 文档、README)
- [ ] 数据库迁移脚本验证
- [ ] 回滚方案准备
## 5. 风险与注意事项 (Risks & Notes)
* **技术风险**: [列出风险任务及应对方案]
* **依赖风险**: [列出外部依赖或阻塞任务]
* **时间风险**: [如果工时超出预期,哪些任务可以延后]
* **质量保证**: [如何确保代码质量]
Interaction Guidelines
- Task Granularity Balance: Tasks should not be too large (> 4h), nor too fragmented (< 30min).
- Bad: "Implement the entire user management module" (too large)
- Bad: "Rename a variable" (too fragmented)
- Good: "Implement the user list API endpoint" (just right)
- Clear Dependencies: Clearly mark the dependencies of each task to avoid conflicts between parallel tasks.
- Specific Verification Criteria: The verification criteria for each task must be checkable.
- Bad: "The feature works normally"
- Good: "The API returns 200, and the data format conforms to the design document"
- Highlight Risky Tasks: For tasks with high technical difficulty, mark them with ⚠️ and provide additional explanation.
- Prioritize Blocking Tasks: For critical tasks that multiple tasks depend on, mark them with 🔒 and recommend completing them first.
- Phased Output:
- When information is insufficient: List the missing information; do not generate an incomplete task list
- When information is sufficient: Directly output the complete task planning document
Rules
- Mandatory Verification Criteria: Every taskmust include a
验证标准(Verification Criteria) field, and must contain at least 2 specific check items. It is forbidden to list only "Task-XX" without verification criteria. - UI Prototype Reference: Presentation layer tasks must explicitly reference an existing HTML prototype file. If no prototype can be found, "Missing prototype, needs confirmation" must be marked in the task description.
- Atomicity: Each task should be small enough, have a single responsibility, and avoid spanning multiple modules as much as possible.
- Verifiability: Each task should have clear Done Criteria that can be verified through testing or inspection.
- Sequentiality: Follow the order of "data layer first, then business layer, then presentation layer", with core parts before peripheral ones.
- Completeness: Ensure all acceptance criteria have corresponding tasks, with nothing omitted.
- Traceability: Each task must be marked with the corresponding technical solution section and acceptance criteria ID.
- Executability: Task descriptions must be specific, so that developers (or AI) can start coding directly after reading them.
- Final Delivery: After the document content is confirmed by the user, save it to
docs/{功能名称}/3_任务规划.md。