@zeyue0329/xiaoma-cli 1.0.48 → 1.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -300,6 +300,7 @@ commands:
300
300
  - create-brownfield-architecture: 使用 create-doc 和 brownfield-architecture-tmpl.yaml
301
301
  - create-front-end-architecture: 使用 create-doc 和 front-end-architecture-tmpl.yaml
302
302
  - create-full-stack-architecture: 使用 create-doc 和 fullstack-architecture-tmpl.yaml
303
+ - create-incremental-architecture: 基于知识库和PRD进行架构增量设计 (任务 create-incremental-architecture.md,模板 incremental-architecture-tmpl.yaml)
303
304
  - doc-out: 将完整文档输出到当前目标文件
304
305
  - document-project: 执行任务 document-project.md
305
306
  - execute-checklist {checklist}: 运行任务 execute-checklist (默认为->architect-checklist)
@@ -316,6 +317,7 @@ dependencies:
316
317
  tasks:
317
318
  - create-deep-research-prompt.md
318
319
  - create-doc.md
320
+ - create-incremental-architecture.md
319
321
  - document-project.md
320
322
  - execute-checklist.md
321
323
  - shard-doc.md
@@ -324,6 +326,7 @@ dependencies:
324
326
  - brownfield-architecture-tmpl.yaml
325
327
  - front-end-architecture-tmpl.yaml
326
328
  - fullstack-architecture-tmpl.yaml
329
+ - incremental-architecture-tmpl.yaml
327
330
  ```
328
331
  ==================== END: .xiaoma-core/agents/architect.md ====================
329
332
 
@@ -709,9 +712,20 @@ persona:
709
712
  core_principles:
710
713
  - 关键提示: 除了您在启动命令期间加载的内容外,故事(Story)中已包含您需要的所有信息。除非故事笔记中明确指示或用户直接命令,否则绝不加载 PRD/架构/其他文档文件。
711
714
  - 关键提示: 在开始您的故事任务之前,务必检查当前的文件夹结构,如果工作目录已存在,请勿创建新的。当您确定这是一个全新的项目时,才创建一个新的。
712
- - 关键提示: 仅更新故事文件中的 Dev Agent Record 部分 (复选框/Debug Log/Completion Notes/Change Log)
713
- - 关键提示: 当用户告诉您实施故事时,请遵循 develop-story 命令
715
+ - 关键提示: 仅更新故事文件中的 Dev Agent Record 部分 (复选框/Debug Log/Completion Notes/Change Log/Knowledge References)
716
+ - 关键提示: 当用户告诉您实施故事时,请遵循 develop-story 或 develop-story-with-rag 命令
714
717
  - 编号选项 - 向用户呈现选择时,始终使用编号列表
718
+ - 知识库对接规则: 当使用 develop-story-with-rag 命令时,必须加载并遵循知识库中的技术规范
719
+ - 知识库文件路径:
720
+ - 架构增量设计: docs/architecture-increment.md
721
+ - 编码规范: docs/rag/technical/coding-standards/
722
+ - 模块结构: docs/rag/technical/module-structure.md
723
+ - 数据模型: docs/rag/technical/data-model.md
724
+ - 中间件规范: docs/rag/technical/middleware/
725
+ - SQL规范: docs/rag/technical/sql-standards/
726
+ - 安全约束: docs/rag/constraints/security.md
727
+ - 性能约束: docs/rag/constraints/performance.md
728
+ - 知识引用记录: 开发完成后必须在故事文件的 Knowledge References 部分记录引用的知识文件
715
729
  commands:
716
730
  - help: 显示以下命令的编号列表以供选择
717
731
  - develop-story:
@@ -723,17 +737,71 @@ commands:
723
737
  - blocking: 在以下情况暂停:需要未经批准的依赖项,与用户确认 | 检查故事后发现内容模糊 | 尝试实现或修复某问题连续失败3次 | 缺少配置 | 回归测试失败
724
738
  - ready-for-review: 代码符合需求 + 所有验证通过 + 遵循标准 + File List 已完成
725
739
  - completion: '所有任务和子任务都标记为 [x] 并且有测试→验证和完整回归测试通过 (不要偷懒,执行所有测试并确认)→确保 File List 已完成→为清单 story-dod-checklist 运行任务 execute-checklist→设置故事状态为: ''Ready for Review''→暂停'
740
+ - develop-story-with-rag:
741
+ - description: 基于知识库和架构增量设计开发用户故事 (任务 develop-story-with-rag.md)
742
+ - order-of-execution: |
743
+ 1. 加载知识上下文
744
+ - 读取架构增量设计 (docs/architecture-increment.md)
745
+ - 读取相关编码规范 (docs/rag/technical/coding-standards/)
746
+ - 读取模块结构 (docs/rag/technical/module-structure.md)
747
+ - 按需读取中间件规范 (docs/rag/technical/middleware/)
748
+ - 按需读取SQL规范 (docs/rag/technical/sql-standards/)
749
+ - 按需读取约束条件 (docs/rag/constraints/)
750
+ 2. 读取当前任务,分析任务类型,匹配相关规范
751
+ 3. 按照知识库规范实现任务(命名、分层、异常处理、日志等)
752
+ 4. 参考中间件代码示例实现缓存/消息/定时任务
753
+ 5. 编写测试,执行验证
754
+ 6. 更新故事文件,记录 Knowledge References
755
+ 7. 重复直至完成所有任务
756
+ - knowledge-loading-strategy:
757
+ - 按需加载: 仅加载当前任务所需的规范文件
758
+ - 优先级: 编码规范 > 架构设计 > 中间件规范 > SQL规范 > 约束条件
759
+ - 任务类型匹配:
760
+ - 数据模型任务: docs/rag/technical/sql-standards/, docs/architecture-increment.md#数据模型增量设计
761
+ - 接口开发任务: docs/rag/technical/coding-standards/, docs/architecture-increment.md#接口增量设计
762
+ - 业务逻辑任务: docs/rag/technical/coding-standards/, docs/rag/technical/module-structure.md
763
+ - 中间件任务: docs/rag/technical/middleware/redis.md, docs/rag/technical/middleware/mq.md, docs/rag/technical/middleware/scheduler.md
764
+ - story-file-updates-ONLY:
765
+ - 关键提示: 仅使用对下述部分的更新来更新故事文件。请勿修改任何其他部分。
766
+ - 关键提示: 您仅被授权编辑故事文件的这些特定部分 - Tasks / Subtasks 复选框, Dev Agent Record 部分及其所有子部分, Agent Model Used, Debug Log References, Completion Notes List, File List, Knowledge References, Change Log, Status
767
+ - Knowledge References 格式: |
768
+ ## Knowledge References
769
+ | 知识文件 | 引用内容 | 应用位置 |
770
+ |----------|----------|----------|
771
+ | docs/rag/technical/coding-standards/naming.md | 类命名规范 | XxxController.java |
772
+ - blocking: 在以下情况暂停:架构增量设计与故事任务严重不一致 | 知识库规范相互冲突 | 安全约束无法满足 | 连续3次实现失败 | 需要未批准的依赖
773
+ - ready-for-review: 代码符合需求 + 所有验证通过 + 遵循知识库规范 + File List 已完成 + Knowledge References 已记录
774
+ - completion: 所有任务标记为 [x] + 测试通过→确保 File List 和 Knowledge References 已完成→执行 story-dod-checklist→设置状态为 'Ready for Review'→暂停
726
775
  - explain: 详细地教我你刚才做了什么以及为什么这么做,以便我能学习。请像培训初级工程师一样向我解释。
727
776
  - review-qa: 运行任务 `apply-qa-fixes.md`
728
777
  - run-tests: 执行代码规范检查和测试
778
+ - load-knowledge: 手动加载指定的知识库文件,用于查阅规范或代码示例
729
779
  - exit: 作为开发人员道别,然后放弃扮演此角色
730
780
  dependencies:
731
781
  checklists:
732
782
  - story-dod-checklist.md
733
783
  tasks:
734
784
  - apply-qa-fixes.md
785
+ - develop-story-with-rag.md
735
786
  - execute-checklist.md
736
787
  - validate-next-story.md
788
+ knowledge-files:
789
+ description: 知识库文件路径(按需加载,非启动时加载)
790
+ architecture:
791
+ - docs/architecture-increment.md
792
+ technical:
793
+ - docs/rag/technical/architecture.md
794
+ - docs/rag/technical/tech-stack.md
795
+ - docs/rag/technical/module-structure.md
796
+ - docs/rag/technical/data-model.md
797
+ - docs/rag/technical/coding-standards/
798
+ - docs/rag/technical/middleware/redis.md
799
+ - docs/rag/technical/middleware/mq.md
800
+ - docs/rag/technical/middleware/scheduler.md
801
+ - docs/rag/technical/sql-standards/
802
+ constraints:
803
+ - docs/rag/constraints/security.md
804
+ - docs/rag/constraints/performance.md
737
805
  ```
738
806
  ==================== END: .xiaoma-core/agents/dev.md ====================
739
807
 
@@ -1241,6 +1309,7 @@ commands:
1241
1309
  - create-brownfield-story: 运行任务 brownfield-create-story.md
1242
1310
  - create-epic: 为现有项目项目创建模块 (任务 brownfield-create-epic)
1243
1311
  - create-prd: 使用模板 prd-tmpl.yaml 运行任务 create-doc.md
1312
+ - create-prd-from-rag: 基于Analyst需求分析产出物生成PRD (任务 create-prd-from-rag.md,模板 prd-from-rag-tmpl.yaml)
1244
1313
  - create-story: 从需求创建用户故事 (任务 brownfield-create-story)
1245
1314
  - doc-out: 将完整文档输出到当前目标文件
1246
1315
  - shard-prd: 为提供的 prd.md 运行任务 shard-doc.md (如果未找到则询问)
@@ -1258,11 +1327,13 @@ dependencies:
1258
1327
  - correct-course.md
1259
1328
  - create-deep-research-prompt.md
1260
1329
  - create-doc.md
1330
+ - create-prd-from-rag.md
1261
1331
  - execute-checklist.md
1262
1332
  - shard-doc.md
1263
1333
  templates:
1264
1334
  - brownfield-prd-tmpl.yaml
1265
1335
  - prd-tmpl.yaml
1336
+ - prd-from-rag-tmpl.yaml
1266
1337
  ```
1267
1338
  ==================== END: .xiaoma-core/agents/pm.md ====================
1268
1339
 
@@ -1417,16 +1488,56 @@ persona:
1417
1488
  role: 技术 Scrum Master - 故事准备专家
1418
1489
  style: 任务导向、高效、精确、专注于清晰的开发者交接
1419
1490
  identity: 为 AI 开发者准备详细、可操作故事的故事创建专家
1420
- focus: 创建清晰明了的故事,以便“愚笨的”AI 智能体可以毫无困惑地实施
1491
+ focus: 创建清晰明了的故事,以便"愚笨的"AI 智能体可以毫无困惑地实施
1421
1492
  core_principles:
1422
- - 严格遵循 `create-next-story` 流程来生成详细的用户故事
1423
- - 将确保所有信息都来自 PRD 和架构文档,以指导“愚笨的”开发智能体
1493
+ - 严格遵循 `create-next-story` 或 `create-story-with-rag` 流程来生成详细的用户故事
1494
+ - 将确保所有信息都来自 PRD、架构文档和知识库,以指导"愚笨的"开发智能体
1424
1495
  - 你绝对不允许实施故事或修改任何代码!
1496
+ - 知识库对接规则: 当使用 draft-with-rag 命令时,必须融合知识库中的业务规则、技术规范和架构增量设计
1497
+ - 知识库文件路径:
1498
+ - 需求分析报告: docs/rag/_analysis-report.md
1499
+ - 业务规则: docs/rag/business/rules-*.md
1500
+ - 架构增量设计: docs/architecture-increment.md
1501
+ - 编码规范: docs/rag/technical/coding-standards/
1502
+ - 模块结构: docs/rag/technical/module-structure.md
1503
+ - 中间件规范: docs/rag/technical/middleware/
1504
+ - 安全约束: docs/rag/constraints/security.md
1505
+ - 性能约束: docs/rag/constraints/performance.md
1506
+ - 知识引用记录: 故事创建后必须在 Knowledge References 部分记录引用的知识文件
1425
1507
  commands:
1426
1508
  - help: 显示以下命令的编号列表以供选择
1427
1509
  - correct-course: 执行任务 correct-course.md
1428
1510
  - draft: 执行任务 create-next-story.md
1429
1511
  - draft-enhanced: 执行任务 create-enhanced-story-with-database.md (增强版用户故事,包含数据库和API设计)
1512
+ - draft-with-rag:
1513
+ - description: 基于知识库和架构增量设计创建用户故事 (任务 create-story-with-rag.md)
1514
+ - workflow: |
1515
+ 1. 加载知识上下文
1516
+ - 读取架构增量设计 (docs/architecture-increment.md)
1517
+ - 读取需求分析报告 (docs/rag/_analysis-report.md)
1518
+ - 读取业务规则 (docs/rag/business/rules-*.md)
1519
+ - 读取编码规范 (docs/rag/technical/coding-standards/)
1520
+ - 读取约束条件 (docs/rag/constraints/)
1521
+ 2. 识别下一个 Story,提取 Epic 中的 Story 定义
1522
+ 3. 知识融合生成:
1523
+ - AC增强: 融合业务规则和约束条件
1524
+ - 任务生成: 基于架构增量设计生成详细任务
1525
+ - Dev Notes: 整合架构设计、编码规范、中间件示例
1526
+ 4. 生成 Story 文件,记录 Knowledge References
1527
+ 5. 执行 story-draft-checklist 验证
1528
+ - knowledge-sources:
1529
+ - docs/architecture-increment.md
1530
+ - docs/rag/_analysis-report.md
1531
+ - docs/rag/business/rules-*.md
1532
+ - docs/rag/technical/coding-standards/
1533
+ - docs/rag/technical/module-structure.md
1534
+ - docs/rag/technical/middleware/
1535
+ - docs/rag/constraints/
1536
+ - output-enhancements:
1537
+ - AC增强: 融合业务规则细节和技术约束
1538
+ - 任务详细化: 每个任务带有架构设计参考
1539
+ - Dev Notes: 包含完整的技术上下文和代码示例参考
1540
+ - Knowledge References: 记录所有引用的知识文件
1430
1541
  - story-checklist: 使用清单 story-draft-checklist.md 执行任务 execute-checklist.md
1431
1542
  - exit: 作为 Scrum Master 道别,然后放弃扮演此角色
1432
1543
  dependencies:
@@ -1436,11 +1547,29 @@ dependencies:
1436
1547
  - correct-course.md
1437
1548
  - create-next-story.md
1438
1549
  - create-enhanced-story-with-database.md
1550
+ - create-story-with-rag.md
1439
1551
  - execute-checklist.md
1440
1552
  templates:
1441
1553
  - story-tmpl.yaml
1554
+ - story-with-rag-tmpl.yaml
1442
1555
  - enhanced-story-with-database-tmpl.yaml
1443
1556
  - api-design-tmpl.yaml
1557
+ knowledge-files:
1558
+ description: 知识库文件路径(按需加载,执行 draft-with-rag 时使用)
1559
+ analysis:
1560
+ - docs/rag/_analysis-report.md
1561
+ - docs/rag/_requirement-parsing.yaml
1562
+ business:
1563
+ - docs/rag/business/rules-*.md
1564
+ architecture:
1565
+ - docs/architecture-increment.md
1566
+ technical:
1567
+ - docs/rag/technical/coding-standards/
1568
+ - docs/rag/technical/module-structure.md
1569
+ - docs/rag/technical/middleware/
1570
+ constraints:
1571
+ - docs/rag/constraints/security.md
1572
+ - docs/rag/constraints/performance.md
1444
1573
  ```
1445
1574
  ==================== END: .xiaoma-core/agents/sm.md ====================
1446
1575
 
@@ -9043,6 +9172,534 @@ sections:
9043
9172
  20. **Question Storming**: Generate questions instead of answers first
9044
9173
  ==================== END: .xiaoma-core/data/brainstorming-techniques.md ====================
9045
9174
 
9175
+ ==================== START: .xiaoma-core/tasks/create-incremental-architecture.md ====================
9176
+ # 基于知识库的架构增量设计任务
9177
+
9178
+ ## Purpose
9179
+
9180
+ 基于 Analyst 智能体的技术知识库产出(`docs/rag/technical/`)和 PM 智能体生成的 PRD/Epic 文档,进行架构增量设计。通过对比现有技术架构与新需求,识别技术变动点,生成架构增量设计文档。
9181
+
9182
+ ## 上游交接物
9183
+
9184
+ ```yaml
9185
+ 必需输入:
9186
+ PRD/Epic文档:
9187
+ - docs/prd.md # PM生成的PRD文档
9188
+ - 或 docs/epic-{name}.md # PM生成的Epic文档
9189
+
9190
+ 技术知识库:
9191
+ - docs/rag/technical/architecture.md # 现有技术架构
9192
+ - docs/rag/technical/tech-stack.md # 技术栈详情
9193
+ - docs/rag/technical/module-structure.md # 模块结构
9194
+ - docs/rag/technical/data-model.md # 数据模型
9195
+
9196
+ 可选输入:
9197
+ 分析报告:
9198
+ - docs/rag/_analysis-report.md # 需求分析报告(技术分析章节)
9199
+
9200
+ 编码规范:
9201
+ - docs/rag/technical/coding-standards/ # 编码规范目录
9202
+ - docs/rag/technical/middleware/ # 中间件规范目录
9203
+
9204
+ 约束条件:
9205
+ - docs/rag/constraints/security.md # 安全要求
9206
+ - docs/rag/constraints/performance.md # 性能要求
9207
+ ```
9208
+
9209
+ ## Workflow Overview
9210
+
9211
+ ```
9212
+ 技术知识库 + PRD → 架构差异分析 → 变动点识别 → 增量设计 → 影响评估 → 架构增量文档
9213
+ ```
9214
+
9215
+ ---
9216
+
9217
+ ## Phase 1: 输入验证与上下文加载
9218
+
9219
+ ### 1.1 验证上游交接物
9220
+
9221
+ ```yaml
9222
+ 执行步骤:
9223
+ 步骤1_检查PRD文档:
9224
+ 动作: 检查 docs/prd.md 或 docs/epic-{name}.md 是否存在
9225
+ 缺失处理: |
9226
+ 如果缺失PRD文档,提示用户:
9227
+ "未找到PRD文档。请先执行 PM 智能体的 *create-prd-from-rag 命令生成PRD。"
9228
+
9229
+ 步骤2_检查技术知识库:
9230
+ 动作: 检查 docs/rag/technical/ 目录是否存在核心文件
9231
+ 核心文件:
9232
+ - architecture.md (现有架构)
9233
+ - data-model.md (数据模型)
9234
+ 缺失处理: |
9235
+ 如果技术知识库不完整,提示用户:
9236
+ "技术知识库不完整。建议先执行 Analyst 智能体完善技术知识:
9237
+ - 缺少 architecture.md:需要补充整体技术架构信息
9238
+ - 缺少 data-model.md:需要补充现有数据模型信息"
9239
+
9240
+ 步骤3_加载现有架构:
9241
+ 动作: 读取并解析技术知识库
9242
+ 提取内容:
9243
+ - 整体架构模式(单体/微服务/DDD等)
9244
+ - 技术栈详情(框架、数据库、中间件)
9245
+ - 模块结构(包结构、分层规范)
9246
+ - 现有数据模型(表结构、实体关系)
9247
+ - 编码规范(命名、注释、异常处理)
9248
+ - 中间件使用方式(Redis、MQ、ES等)
9249
+
9250
+ 步骤4_加载PRD需求:
9251
+ 动作: 读取并解析PRD文档
9252
+ 提取内容:
9253
+ - 功能性需求(FR列表)
9254
+ - 非功能性需求(NFR列表)
9255
+ - 数据实体与关系
9256
+ - 技术约束
9257
+ - Epic/Story结构
9258
+ ```
9259
+
9260
+ ### 1.2 上下文整合视图
9261
+
9262
+ ```yaml
9263
+ 整合输出:
9264
+ 现有架构视图:
9265
+ 架构模式: {从architecture.md提取}
9266
+ 技术栈:
9267
+ 后端: {框架、版本}
9268
+ 数据库: {类型、版本}
9269
+ 缓存: {类型、用途}
9270
+ 消息队列: {类型、用途}
9271
+ 模块结构: {包结构、分层}
9272
+ 数据模型: {现有实体、关系}
9273
+
9274
+ 新需求视图:
9275
+ 功能需求: {FR列表}
9276
+ 数据需求: {新增/修改实体}
9277
+ 性能需求: {NFR中的性能要求}
9278
+ 安全需求: {NFR中的安全要求}
9279
+ ```
9280
+
9281
+ ---
9282
+
9283
+ ## Phase 2: 架构差异分析
9284
+
9285
+ ### 2.1 技术变动检测
9286
+
9287
+ ```yaml
9288
+ 检测维度:
9289
+ 架构层面变动:
9290
+ 检测项:
9291
+ - 是否需要新增模块/服务
9292
+ - 是否需要调整分层结构
9293
+ - 是否需要引入新的架构模式
9294
+ 判定标准:
9295
+ 无变动: 完全遵循现有模块结构
9296
+ 小变动: 在现有模块内新增包/类
9297
+ 中变动: 新增独立模块
9298
+ 大变动: 需要调整整体架构
9299
+
9300
+ 技术栈变动:
9301
+ 检测项:
9302
+ - 是否需要引入新框架/库
9303
+ - 是否需要升级现有依赖版本
9304
+ - 是否需要新增中间件
9305
+ 判定标准:
9306
+ 无变动: 使用现有技术栈
9307
+ 小变动: 新增工具类库
9308
+ 中变动: 引入新中间件
9309
+ 大变动: 核心框架变更
9310
+
9311
+ 数据模型变动:
9312
+ 检测项:
9313
+ - 新增数据实体
9314
+ - 修改现有实体(字段增减)
9315
+ - 新增实体关系
9316
+ - 索引变更
9317
+ 判定标准:
9318
+ 无变动: 完全使用现有表结构
9319
+ 小变动: 现有表新增字段
9320
+ 中变动: 新增表/修改关联关系
9321
+ 大变动: 数据模型重构
9322
+
9323
+ 接口变动:
9324
+ 检测项:
9325
+ - 新增API端点
9326
+ - 修改现有API
9327
+ - 新增外部系统集成
9328
+ 判定标准:
9329
+ 无变动: 无接口变更
9330
+ 小变动: 新增内部API
9331
+ 中变动: 修改公开API/新增集成
9332
+ 大变动: API版本升级
9333
+
9334
+ 中间件变动:
9335
+ 检测项:
9336
+ - Redis使用变化(新增key类型、缓存策略)
9337
+ - MQ使用变化(新增Topic/Queue)
9338
+ - 定时任务变化
9339
+ - ES索引变化
9340
+ 判定标准:
9341
+ 无变动: 遵循现有使用方式
9342
+ 小变动: 新增使用场景
9343
+ 中变动: 新增配置/调整策略
9344
+ 大变动: 中间件架构调整
9345
+ ```
9346
+
9347
+ ### 2.2 变动分析报告
9348
+
9349
+ ```yaml
9350
+ 分析输出格式:
9351
+ 变动总览:
9352
+ 总体变动等级: 无/小/中/大
9353
+ 主要变动领域: [列表]
9354
+ 风险等级: 低/中/高
9355
+
9356
+ 详细变动清单:
9357
+ - 变动ID: CHG-001
9358
+ 领域: 数据模型
9359
+ 类型: 新增
9360
+ 描述: 新增订单实体
9361
+ 影响范围: order模块
9362
+ 关联需求: FR1, FR2
9363
+ 风险等级: 低
9364
+
9365
+ 兼容性分析:
9366
+ 向后兼容: 是/否
9367
+ 需要迁移: 是/否
9368
+ 影响范围: [受影响的模块/服务]
9369
+ ```
9370
+
9371
+ ---
9372
+
9373
+ ## Phase 3: 架构增量设计
9374
+
9375
+ ### 3.1 设计原则
9376
+
9377
+ ```yaml
9378
+ 设计原则:
9379
+ 最小变动原则:
9380
+ - 优先在现有架构内扩展
9381
+ - 避免不必要的重构
9382
+ - 保持与现有代码风格一致
9383
+
9384
+ 渐进演进原则:
9385
+ - 设计可分阶段实施的方案
9386
+ - 支持增量部署和回滚
9387
+ - 考虑向后兼容性
9388
+
9389
+ 知识复用原则:
9390
+ - 复用知识库中的编码规范
9391
+ - 遵循现有中间件使用模式
9392
+ - 参考已有代码示例
9393
+ ```
9394
+
9395
+ ### 3.2 增量设计内容
9396
+
9397
+ ```yaml
9398
+ 设计内容:
9399
+ 模块增量设计:
9400
+ 新增模块:
9401
+ - 模块名称
9402
+ - 职责描述
9403
+ - 包结构(遵循现有规范)
9404
+ - 与现有模块的关系
9405
+ 修改模块:
9406
+ - 模块名称
9407
+ - 修改内容
9408
+ - 修改理由
9409
+ - 影响评估
9410
+
9411
+ 数据模型增量设计:
9412
+ 新增实体:
9413
+ - 实体名称
9414
+ - 表名(遵循命名规范)
9415
+ - 字段定义(遵循字段规范)
9416
+ - 索引设计
9417
+ - DDL语句
9418
+ 修改实体:
9419
+ - 实体名称
9420
+ - 修改字段
9421
+ - 迁移脚本
9422
+ - 兼容性说明
9423
+
9424
+ 接口增量设计:
9425
+ 新增API:
9426
+ - 接口路径(遵循URL规范)
9427
+ - 请求方法
9428
+ - 请求参数(遵循参数规范)
9429
+ - 响应格式(遵循响应规范)
9430
+ - 错误码定义
9431
+ 修改API:
9432
+ - 接口路径
9433
+ - 变更内容
9434
+ - 版本策略
9435
+ - 兼容性说明
9436
+
9437
+ 中间件增量设计:
9438
+ Redis:
9439
+ - 新增Key定义(遵循Key命名规范)
9440
+ - 数据结构选择
9441
+ - 过期策略
9442
+ - 代码示例(参考知识库)
9443
+ MQ:
9444
+ - 新增Topic/Queue
9445
+ - 消息格式
9446
+ - 消费者配置
9447
+ - 代码示例(参考知识库)
9448
+ 定时任务:
9449
+ - 任务名称
9450
+ - 执行周期
9451
+ - 实现方式
9452
+ - 代码示例(参考知识库)
9453
+ ```
9454
+
9455
+ ### 3.3 知识库规范引用
9456
+
9457
+ ```yaml
9458
+ 规范引用:
9459
+ 编码规范引用:
9460
+ 来源: docs/rag/technical/coding-standards/
9461
+ 引用内容:
9462
+ - 命名规范 → 类/方法/变量命名
9463
+ - 分层规范 → Controller/Service/DAO实现
9464
+ - 异常处理 → 错误处理方式
9465
+ - 日志规范 → 日志打印方式
9466
+
9467
+ 中间件规范引用:
9468
+ 来源: docs/rag/technical/middleware/
9469
+ 引用内容:
9470
+ - Redis规范 → 缓存实现参考
9471
+ - MQ规范 → 消息处理参考
9472
+ - 定时任务规范 → 任务实现参考
9473
+
9474
+ SQL规范引用:
9475
+ 来源: docs/rag/technical/sql-standards/
9476
+ 引用内容:
9477
+ - 表设计规范 → DDL编写
9478
+ - 查询规范 → SQL编写
9479
+ - 性能规范 → 索引设计
9480
+ ```
9481
+
9482
+ ---
9483
+
9484
+ ## Phase 4: 影响评估与风险分析
9485
+
9486
+ ### 4.1 影响评估
9487
+
9488
+ ```yaml
9489
+ 评估维度:
9490
+ 代码影响:
9491
+ - 新增代码量估算
9492
+ - 修改代码范围
9493
+ - 测试代码需求
9494
+
9495
+ 数据影响:
9496
+ - 数据迁移需求
9497
+ - 数据一致性风险
9498
+ - 备份恢复策略
9499
+
9500
+ 性能影响:
9501
+ - 新增负载评估
9502
+ - 资源需求变化
9503
+ - 性能测试要求
9504
+
9505
+ 部署影响:
9506
+ - 部署步骤变更
9507
+ - 配置变更
9508
+ - 回滚方案
9509
+ ```
9510
+
9511
+ ### 4.2 风险分析
9512
+
9513
+ ```yaml
9514
+ 风险分析:
9515
+ 技术风险:
9516
+ - 新技术引入风险
9517
+ - 兼容性风险
9518
+ - 性能风险
9519
+
9520
+ 业务风险:
9521
+ - 功能影响范围
9522
+ - 数据安全风险
9523
+ - 服务可用性风险
9524
+
9525
+ 实施风险:
9526
+ - 实施复杂度
9527
+ - 团队技能匹配
9528
+ - 时间约束
9529
+
9530
+ 缓解措施:
9531
+ - 每个风险的缓解方案
9532
+ - 监控和告警策略
9533
+ - 应急预案
9534
+ ```
9535
+
9536
+ ---
9537
+
9538
+ ## Phase 5: 输出架构增量文档
9539
+
9540
+ ### 5.1 文档结构
9541
+
9542
+ ```yaml
9543
+ 文档结构:
9544
+ 元信息:
9545
+ - 文档版本
9546
+ - 生成时间
9547
+ - 关联PRD
9548
+ - 关联知识库版本
9549
+
9550
+ 变动总览:
9551
+ - 变动等级
9552
+ - 主要变动领域
9553
+ - 风险等级
9554
+
9555
+ 详细设计:
9556
+ - 模块增量设计
9557
+ - 数据模型增量设计
9558
+ - 接口增量设计
9559
+ - 中间件增量设计
9560
+
9561
+ 实施指南:
9562
+ - 实施顺序
9563
+ - 依赖关系
9564
+ - 检查点
9565
+
9566
+ 知识引用:
9567
+ - 引用的规范文档
9568
+ - 代码示例来源
9569
+
9570
+ 下游交接:
9571
+ - 开发者交接
9572
+ - QA交接
9573
+ ```
9574
+
9575
+ ### 5.2 输出文件
9576
+
9577
+ ```yaml
9578
+ 主输出:
9579
+ 架构增量文档:
9580
+ 路径: docs/architecture-increment.md
9581
+ 格式: Markdown
9582
+
9583
+ 辅助输出:
9584
+ 变动清单:
9585
+ 路径: docs/architecture-changes.yaml
9586
+ 格式: YAML
9587
+ 内容: 结构化的变动清单,便于追踪
9588
+
9589
+ DDL脚本:
9590
+ 路径: docs/ddl/
9591
+ 格式: SQL
9592
+ 内容: 数据库变更脚本
9593
+
9594
+ 知识引用索引:
9595
+ 路径: docs/architecture-knowledge-refs.md
9596
+ 内容: 设计中引用的知识库文档清单
9597
+ ```
9598
+
9599
+ ---
9600
+
9601
+ ## Phase 6: 下游交接
9602
+
9603
+ ### 6.1 交接给开发者
9604
+
9605
+ ```yaml
9606
+ 开发者交接:
9607
+ 必读文件:
9608
+ - docs/architecture-increment.md # 架构增量设计
9609
+ - docs/prd.md # PRD文档
9610
+ - docs/rag/technical/coding-standards/ # 编码规范
9611
+
9612
+ 关注点:
9613
+ - 新增模块的包结构
9614
+ - 数据模型变更
9615
+ - 中间件使用方式(含代码示例)
9616
+ - 接口设计规范
9617
+
9618
+ 建议命令: "*start-development docs/architecture-increment.md"
9619
+ ```
9620
+
9621
+ ### 6.2 交接给QA
9622
+
9623
+ ```yaml
9624
+ QA交接:
9625
+ 必读文件:
9626
+ - docs/architecture-increment.md # 架构增量设计(测试策略章节)
9627
+ - docs/prd.md # PRD文档(验收标准)
9628
+
9629
+ 关注点:
9630
+ - 功能测试范围
9631
+ - 集成测试要求
9632
+ - 回归测试范围
9633
+ - 性能测试要求
9634
+
9635
+ 建议命令: "*create-test-plan docs/architecture-increment.md"
9636
+ ```
9637
+
9638
+ ---
9639
+
9640
+ ## 使用说明
9641
+
9642
+ ### 激活命令
9643
+
9644
+ ```
9645
+ *create-incremental-architecture [prd_path] [rag_path]
9646
+ ```
9647
+
9648
+ ### 执行参数
9649
+
9650
+ ```yaml
9651
+ 参数:
9652
+ prd_path: PRD文档路径 (默认: docs/prd.md)
9653
+ rag_path: RAG知识目录路径 (默认: docs/rag/)
9654
+ output_path: 输出路径 (默认: docs/architecture-increment.md)
9655
+ interactive: 交互模式 (默认: true)
9656
+ ```
9657
+
9658
+ ### 交互模式流程
9659
+
9660
+ 1. **验证阶段**: 检查上游交接物完整性
9661
+ 2. **分析阶段**: 展示架构差异分析结果,确认变动点
9662
+ 3. **设计阶段**: 逐模块进行增量设计,关键节点请求确认
9663
+ 4. **评估阶段**: 展示影响评估和风险分析
9664
+ 5. **输出阶段**: 生成架构增量文档,提示下游交接
9665
+
9666
+ ### YOLO模式
9667
+
9668
+ 通过 `*yolo` 命令切换YOLO模式,一次性完成所有步骤,跳过中间确认环节。
9669
+
9670
+ ---
9671
+
9672
+ ## 任务完成标志
9673
+
9674
+ ```yaml
9675
+ 完成条件:
9676
+ 必要输出:
9677
+ - docs/architecture-increment.md
9678
+
9679
+ 完成提示: |
9680
+ ✅ 架构增量设计完成!
9681
+
9682
+ 📄 输出文件: docs/architecture-increment.md
9683
+ 📊 变动等级: {change_level}
9684
+ ⚠️ 风险等级: {risk_level}
9685
+
9686
+ 📋 变动摘要:
9687
+ - 模块变动: {module_changes}
9688
+ - 数据模型变动: {data_model_changes}
9689
+ - 接口变动: {api_changes}
9690
+ - 中间件变动: {middleware_changes}
9691
+
9692
+ 🔄 下一步建议:
9693
+ - 开发实施: *start-development docs/architecture-increment.md
9694
+ - 测试计划: *create-test-plan docs/architecture-increment.md
9695
+
9696
+ 💡 请在开发前确认架构设计,特别关注:
9697
+ - 风险清单中的高风险项
9698
+ - 数据迁移方案
9699
+ - 回滚策略
9700
+ ```
9701
+ ==================== END: .xiaoma-core/tasks/create-incremental-architecture.md ====================
9702
+
9046
9703
  ==================== START: .xiaoma-core/tasks/execute-checklist.md ====================
9047
9704
  <!-- Powered by XIAOMA™ Core -->
9048
9705
 
@@ -11659,52 +12316,656 @@ sections:
11659
12316
  instruction: 在运行检查清单前,提议输出完整的架构文档。一旦用户确认,执行 architect-checklist 并在此处填充结果。
11660
12317
  ==================== END: .xiaoma-core/templates/fullstack-architecture-tmpl.yaml ====================
11661
12318
 
11662
- ==================== START: .xiaoma-core/checklists/architect-checklist.md ====================
11663
- <!-- Powered by XiaoMa™ Core -->
12319
+ ==================== START: .xiaoma-core/templates/incremental-architecture-tmpl.yaml ====================
12320
+ template:
12321
+ id: incremental-architecture-template-v1
12322
+ name: 架构增量设计文档
12323
+ version: 1.0
12324
+ description: 基于知识库和PRD进行架构增量设计,识别技术变动并生成增量架构文档
12325
+ output:
12326
+ format: markdown
12327
+ filename: docs/architecture-increment.md
12328
+ title: "{{project_name}} 架构增量设计文档"
11664
12329
 
11665
- # Architect Solution Validation Checklist
12330
+ workflow:
12331
+ mode: interactive
12332
+ elicitation: advanced-elicitation
12333
+ upstream:
12334
+ agents:
12335
+ - analyst # 提供技术知识库
12336
+ - pm # 提供PRD文档
12337
+ required_files:
12338
+ - docs/prd.md
12339
+ - docs/rag/technical/architecture.md
12340
+ optional_files:
12341
+ - docs/rag/technical/tech-stack.md
12342
+ - docs/rag/technical/data-model.md
12343
+ - docs/rag/technical/module-structure.md
12344
+ - docs/rag/technical/coding-standards/*
12345
+ - docs/rag/technical/middleware/*
12346
+ - docs/rag/constraints/*
11666
12347
 
11667
- This checklist serves as a comprehensive framework for the Architect to validate the technical design and architecture before development execution. The Architect should systematically work through each item, ensuring the architecture is robust, scalable, secure, and aligned with the product requirements.
12348
+ sections:
12349
+ - id: input-validation
12350
+ title: 输入验证
12351
+ internal: true
12352
+ instruction: |
12353
+ 在开始架构设计之前,执行以下验证:
12354
+
12355
+ 1. **检查PRD文档**:
12356
+ - docs/prd.md 或 docs/epic-{name}.md 是否存在
12357
+ - 提取功能需求(FR)、非功能需求(NFR)、数据实体、技术约束
12358
+
12359
+ 2. **检查技术知识库**:
12360
+ - docs/rag/technical/architecture.md (现有架构)
12361
+ - docs/rag/technical/data-model.md (现有数据模型)
12362
+ - docs/rag/technical/coding-standards/ (编码规范)
12363
+ - docs/rag/technical/middleware/ (中间件规范)
12364
+
12365
+ 3. **加载现有架构信息**:
12366
+ - 架构模式、技术栈、模块结构
12367
+ - 现有数据实体和关系
12368
+ - 编码规范和中间件使用方式
12369
+
12370
+ 如果缺少必需文件,提示:
12371
+ "⚠️ 缺少必需的输入文件:
12372
+ - PRD文档:请先执行 PM 智能体 *create-prd-from-rag
12373
+ - 技术知识库:请先执行 Analyst 智能体完善技术知识"
12374
+
12375
+ - id: document-header
12376
+ title: 文档信息
12377
+ sections:
12378
+ - id: meta-info
12379
+ title: 元信息
12380
+ template: |
12381
+ | 属性 | 值 |
12382
+ |------|-----|
12383
+ | 文档版本 | {{version}} |
12384
+ | 生成时间 | {{timestamp}} |
12385
+ | 关联PRD | {{prd_path}} |
12386
+ | 技术知识库版本 | {{rag_version}} |
12387
+ | 架构师 | Architect Agent |
12388
+ - id: changelog
12389
+ title: 变更日志
12390
+ type: table
12391
+ columns: [日期, 版本, 变更内容, 作者]
11668
12392
 
11669
- [[LLM: INITIALIZATION INSTRUCTIONS - REQUIRED ARTIFACTS
12393
+ - id: existing-architecture-summary
12394
+ title: 现有架构概要
12395
+ instruction: |
12396
+ 从技术知识库提取现有架构信息,作为增量设计的基线。
11670
12397
 
11671
- Before proceeding with this checklist, ensure you have access to:
12398
+ **来源**:
12399
+ - docs/rag/technical/architecture.md
12400
+ - docs/rag/technical/tech-stack.md
12401
+ - docs/rag/technical/module-structure.md
12402
+ sections:
12403
+ - id: architecture-pattern
12404
+ title: 架构模式
12405
+ instruction: 从 architecture.md 提取架构模式描述
12406
+ template: |
12407
+ **架构类型**: {{architecture_type}}
12408
+ **分层结构**: {{layer_structure}}
12409
+ **关键特征**: {{key_characteristics}}
12410
+ - id: tech-stack-baseline
12411
+ title: 技术栈基线
12412
+ type: table
12413
+ columns: [类别, 技术, 版本, 用途]
12414
+ instruction: 从 tech-stack.md 提取当前技术栈
12415
+ - id: module-structure-baseline
12416
+ title: 模块结构基线
12417
+ instruction: 从 module-structure.md 提取现有模块结构
12418
+ type: code
12419
+ language: plaintext
12420
+ - id: data-model-baseline
12421
+ title: 数据模型基线
12422
+ instruction: |
12423
+ 从 data-model.md 提取现有数据实体清单。
12424
+ 使用Mermaid ER图展示核心实体关系。
11672
12425
 
11673
- 1. architecture.md - The primary architecture document (check docs/architecture.md)
11674
- 2. prd.md - Product Requirements Document for requirements alignment (check docs/prd.md)
11675
- 3. frontend-architecture.md or fe-architecture.md - If this is a UI project (check docs/frontend-architecture.md)
11676
- 4. Any system diagrams referenced in the architecture
11677
- 5. API documentation if available
11678
- 6. Technology stack details and version specifications
12426
+ - id: requirement-extraction
12427
+ title: 需求提取
12428
+ instruction: |
12429
+ 从PRD文档提取与架构相关的需求。
11679
12430
 
11680
- IMPORTANT: If any required documents are missing or inaccessible, immediately ask the user for their location or content before proceeding.
12431
+ **来源**:
12432
+ - docs/prd.md 或 docs/epic-{name}.md
12433
+ sections:
12434
+ - id: functional-requirements
12435
+ title: 功能性需求摘要
12436
+ type: table
12437
+ columns: [需求ID, 需求描述, 架构影响, 优先级]
12438
+ instruction: |
12439
+ 提取PRD中的功能性需求(FR),评估每个需求的架构影响:
12440
+ - 无影响:完全在现有架构内实现
12441
+ - 小影响:需要新增类/方法
12442
+ - 中影响:需要新增模块/表
12443
+ - 大影响:需要架构调整
12444
+ - id: non-functional-requirements
12445
+ title: 非功能性需求摘要
12446
+ type: table
12447
+ columns: [需求ID, 需求描述, 约束类型, 架构影响]
12448
+ instruction: 提取PRD中的非功能性需求(NFR),特别关注性能、安全、可用性约束
12449
+ - id: data-requirements
12450
+ title: 数据需求摘要
12451
+ type: table
12452
+ columns: [实体名称, 操作类型, 核心属性, 关联实体]
12453
+ instruction: |
12454
+ 从PRD中提取数据实体需求,标注:
12455
+ - 新增:PRD中定义的新实体
12456
+ - 修改:需要变更的现有实体
12457
+ - 复用:直接使用的现有实体
11681
12458
 
11682
- PROJECT TYPE DETECTION:
11683
- First, determine the project type by checking:
12459
+ - id: change-analysis
12460
+ title: 架构变动分析
12461
+ instruction: |
12462
+ 对比现有架构与新需求,识别所有技术变动点。
11684
12463
 
11685
- - Does the architecture include a frontend/UI component?
11686
- - Is there a frontend-architecture.md document?
11687
- - Does the PRD mention user interfaces or frontend requirements?
12464
+ **分析维度**:
12465
+ 1. 架构层面变动
12466
+ 2. 技术栈变动
12467
+ 3. 数据模型变动
12468
+ 4. 接口变动
12469
+ 5. 中间件变动
11688
12470
 
11689
- If this is a backend-only or service-only project:
12471
+ 展示分析结果,请用户确认变动识别是否准确。
12472
+ elicit: true
12473
+ sections:
12474
+ - id: change-overview
12475
+ title: 变动总览
12476
+ template: |
12477
+ | 维度 | 变动等级 | 变动数量 | 主要变动 |
12478
+ |------|----------|----------|----------|
12479
+ | 架构层面 | {{arch_level}} | {{arch_count}} | {{arch_main}} |
12480
+ | 技术栈 | {{tech_level}} | {{tech_count}} | {{tech_main}} |
12481
+ | 数据模型 | {{data_level}} | {{data_count}} | {{data_main}} |
12482
+ | 接口 | {{api_level}} | {{api_count}} | {{api_main}} |
12483
+ | 中间件 | {{mw_level}} | {{mw_count}} | {{mw_main}} |
12484
+
12485
+ **总体变动等级**: {{overall_level}}
12486
+ **风险等级**: {{risk_level}}
12487
+ - id: architecture-changes
12488
+ title: 架构层面变动
12489
+ condition: 存在架构层面变动
12490
+ sections:
12491
+ - id: new-modules
12492
+ title: 新增模块
12493
+ type: table
12494
+ columns: [模块名称, 职责, 所属层, 关联需求]
12495
+ - id: modified-modules
12496
+ title: 修改模块
12497
+ type: table
12498
+ columns: [模块名称, 变更内容, 变更原因, 关联需求]
12499
+ - id: tech-stack-changes
12500
+ title: 技术栈变动
12501
+ condition: 存在技术栈变动
12502
+ sections:
12503
+ - id: new-technologies
12504
+ title: 新增技术
12505
+ type: table
12506
+ columns: [技术名称, 版本, 用途, 引入理由, 替代方案]
12507
+ - id: version-upgrades
12508
+ title: 版本升级
12509
+ type: table
12510
+ columns: [技术名称, 当前版本, 目标版本, 升级原因, 兼容性风险]
12511
+ - id: data-model-changes
12512
+ title: 数据模型变动
12513
+ sections:
12514
+ - id: new-entities
12515
+ title: 新增实体
12516
+ type: table
12517
+ columns: [实体名称, 表名, 核心字段, 关联实体, 关联需求]
12518
+ - id: modified-entities
12519
+ title: 修改实体
12520
+ type: table
12521
+ columns: [实体名称, 变更字段, 变更类型, 兼容性, 关联需求]
12522
+ - id: new-relationships
12523
+ title: 新增关系
12524
+ type: table
12525
+ columns: [源实体, 目标实体, 关系类型, 关联字段, 关联需求]
12526
+ - id: api-changes
12527
+ title: 接口变动
12528
+ condition: 存在接口变动
12529
+ sections:
12530
+ - id: new-apis
12531
+ title: 新增API
12532
+ type: table
12533
+ columns: [接口路径, 方法, 功能描述, 关联需求]
12534
+ - id: modified-apis
12535
+ title: 修改API
12536
+ type: table
12537
+ columns: [接口路径, 变更内容, 兼容性策略, 关联需求]
12538
+ - id: middleware-changes
12539
+ title: 中间件变动
12540
+ condition: 存在中间件变动
12541
+ sections:
12542
+ - id: redis-changes
12543
+ title: Redis变动
12544
+ type: table
12545
+ columns: [Key名称, 数据结构, 用途, 过期策略, 关联需求]
12546
+ - id: mq-changes
12547
+ title: 消息队列变动
12548
+ type: table
12549
+ columns: [Topic/Queue, 消息类型, 生产者, 消费者, 关联需求]
12550
+ - id: scheduler-changes
12551
+ title: 定时任务变动
12552
+ type: table
12553
+ columns: [任务名称, 执行周期, 功能描述, 关联需求]
11690
12554
 
11691
- - Skip sections marked with [[FRONTEND ONLY]]
11692
- - Focus extra attention on API design, service architecture, and integration patterns
11693
- - Note in your final report that frontend sections were skipped due to project type
12555
+ - id: incremental-design
12556
+ title: 增量设计详情
12557
+ instruction: |
12558
+ 为每个变动点提供详细的增量设计方案。
12559
+ 设计必须遵循知识库中的编码规范和中间件使用规范。
12560
+ elicit: true
12561
+ sections:
12562
+ - id: module-design
12563
+ title: 模块增量设计
12564
+ repeatable: true
12565
+ instruction: |
12566
+ 为每个新增/修改的模块提供详细设计。
12567
+ 包结构必须遵循 docs/rag/technical/module-structure.md 中的规范。
12568
+ sections:
12569
+ - id: module-detail
12570
+ title: "{{module_name}}"
12571
+ template: |
12572
+ **模块类型**: 新增 / 修改
12573
+ **职责描述**: {{responsibility}}
12574
+ **所属层**: {{layer}}
12575
+ **关联需求**: {{related_requirements}}
12576
+ sections:
12577
+ - id: package-structure
12578
+ title: 包结构设计
12579
+ instruction: 遵循现有模块结构规范设计包结构
12580
+ type: code
12581
+ language: plaintext
12582
+ - id: class-design
12583
+ title: 核心类设计
12584
+ instruction: |
12585
+ 列出核心类及其职责,命名遵循编码规范:
12586
+ - Controller: {Module}Controller
12587
+ - Service: {Module}Service / {Module}ServiceImpl
12588
+ - DAO: {Module}Mapper / {Module}Repository
12589
+ type: table
12590
+ columns: [类名, 类型, 职责, 依赖]
12591
+ - id: integration-points
12592
+ title: 集成点
12593
+ instruction: 描述与现有模块的集成方式
12594
+ type: bullet-list
11694
12595
 
11695
- VALIDATION APPROACH:
11696
- For each section, you must:
12596
+ - id: data-model-design
12597
+ title: 数据模型增量设计
12598
+ repeatable: true
12599
+ instruction: |
12600
+ 为每个新增/修改的数据实体提供详细设计。
12601
+ 设计必须遵循 docs/rag/technical/sql-standards/ 中的规范。
12602
+ sections:
12603
+ - id: entity-detail
12604
+ title: "{{entity_name}}"
12605
+ template: |
12606
+ **操作类型**: 新增 / 修改
12607
+ **表名**: {{table_name}}
12608
+ **关联需求**: {{related_requirements}}
12609
+ sections:
12610
+ - id: field-design
12611
+ title: 字段设计
12612
+ type: table
12613
+ columns: [字段名, 类型, 长度, 约束, 默认值, 说明]
12614
+ instruction: 字段命名遵循数据库命名规范
12615
+ - id: index-design
12616
+ title: 索引设计
12617
+ type: table
12618
+ columns: [索引名, 类型, 字段, 用途]
12619
+ instruction: 索引命名遵循 idx_{表名}_{字段} 规范
12620
+ - id: ddl-script
12621
+ title: DDL脚本
12622
+ type: code
12623
+ language: sql
12624
+ instruction: |
12625
+ 生成DDL脚本,遵循SQL规范:
12626
+ - 包含完整的字段定义
12627
+ - 包含索引创建
12628
+ - 包含注释
12629
+ - id: migration-script
12630
+ title: 迁移脚本
12631
+ condition: 修改现有表
12632
+ type: code
12633
+ language: sql
12634
+ instruction: 生成安全的迁移脚本,考虑向后兼容性
11697
12635
 
11698
- 1. Deep Analysis - Don't just check boxes, thoroughly analyze each item against the provided documentation
11699
- 2. Evidence-Based - Cite specific sections or quotes from the documents when validating
11700
- 3. Critical Thinking - Question assumptions and identify gaps, not just confirm what's present
11701
- 4. Risk Assessment - Consider what could go wrong with each architectural decision
12636
+ - id: api-design
12637
+ title: 接口增量设计
12638
+ repeatable: true
12639
+ condition: 存在接口变动
12640
+ instruction: |
12641
+ 为每个新增/修改的API提供详细设计。
12642
+ 设计必须遵循现有API规范。
12643
+ sections:
12644
+ - id: api-detail
12645
+ title: "{{api_name}}"
12646
+ template: |
12647
+ **操作类型**: 新增 / 修改
12648
+ **接口路径**: {{api_path}}
12649
+ **请求方法**: {{http_method}}
12650
+ **功能描述**: {{description}}
12651
+ **关联需求**: {{related_requirements}}
12652
+ sections:
12653
+ - id: request-design
12654
+ title: 请求设计
12655
+ sections:
12656
+ - id: request-params
12657
+ title: 请求参数
12658
+ type: table
12659
+ columns: [参数名, 类型, 必填, 说明, 示例]
12660
+ - id: request-body
12661
+ title: 请求体
12662
+ type: code
12663
+ language: json
12664
+ - id: response-design
12665
+ title: 响应设计
12666
+ sections:
12667
+ - id: success-response
12668
+ title: 成功响应
12669
+ type: code
12670
+ language: json
12671
+ - id: error-codes
12672
+ title: 错误码
12673
+ type: table
12674
+ columns: [错误码, 错误信息, 触发场景]
12675
+ - id: controller-skeleton
12676
+ title: Controller骨架代码
12677
+ type: code
12678
+ language: java
12679
+ instruction: |
12680
+ 生成Controller骨架代码,遵循编码规范:
12681
+ - 使用正确的注解
12682
+ - 参数校验
12683
+ - 统一响应格式
12684
+
12685
+ - id: middleware-design
12686
+ title: 中间件增量设计
12687
+ condition: 存在中间件变动
12688
+ instruction: |
12689
+ 为中间件使用提供详细设计。
12690
+ 必须参考 docs/rag/technical/middleware/ 中的规范和代码示例。
12691
+ sections:
12692
+ - id: redis-design
12693
+ title: Redis设计
12694
+ condition: 存在Redis变动
12695
+ repeatable: true
12696
+ sections:
12697
+ - id: redis-detail
12698
+ title: "{{redis_key_name}}"
12699
+ template: |
12700
+ **Key模式**: {{key_pattern}}
12701
+ **数据结构**: {{data_structure}}
12702
+ **用途**: {{purpose}}
12703
+ **过期策略**: {{expiration}}
12704
+ **关联需求**: {{related_requirements}}
12705
+ sections:
12706
+ - id: redis-code-example
12707
+ title: 代码示例
12708
+ type: code
12709
+ language: java
12710
+ instruction: 参考 docs/rag/technical/middleware/redis.md 中的代码示例
12711
+ - id: mq-design
12712
+ title: 消息队列设计
12713
+ condition: 存在MQ变动
12714
+ repeatable: true
12715
+ sections:
12716
+ - id: mq-detail
12717
+ title: "{{topic_name}}"
12718
+ template: |
12719
+ **Topic/Queue**: {{topic_queue}}
12720
+ **消息类型**: {{message_type}}
12721
+ **生产者**: {{producer}}
12722
+ **消费者**: {{consumer}}
12723
+ **关联需求**: {{related_requirements}}
12724
+ sections:
12725
+ - id: message-schema
12726
+ title: 消息格式
12727
+ type: code
12728
+ language: json
12729
+ - id: producer-code
12730
+ title: 生产者代码示例
12731
+ type: code
12732
+ language: java
12733
+ instruction: 参考 docs/rag/technical/middleware/mq.md 中的代码示例
12734
+ - id: consumer-code
12735
+ title: 消费者代码示例
12736
+ type: code
12737
+ language: java
12738
+ - id: scheduler-design
12739
+ title: 定时任务设计
12740
+ condition: 存在定时任务变动
12741
+ repeatable: true
12742
+ sections:
12743
+ - id: scheduler-detail
12744
+ title: "{{task_name}}"
12745
+ template: |
12746
+ **任务名称**: {{task_name}}
12747
+ **执行周期**: {{cron_expression}}
12748
+ **功能描述**: {{description}}
12749
+ **关联需求**: {{related_requirements}}
12750
+ sections:
12751
+ - id: scheduler-code
12752
+ title: 任务代码示例
12753
+ type: code
12754
+ language: java
12755
+ instruction: 参考 docs/rag/technical/middleware/scheduler.md 中的代码示例
12756
+
12757
+ - id: impact-assessment
12758
+ title: 影响评估
12759
+ instruction: 评估架构变动的影响范围和风险
12760
+ elicit: true
12761
+ sections:
12762
+ - id: code-impact
12763
+ title: 代码影响
12764
+ template: |
12765
+ **新增代码量估算**: {{new_code_estimate}}
12766
+ **修改代码范围**: {{modified_code_scope}}
12767
+ **测试代码需求**: {{test_code_requirement}}
12768
+ - id: data-impact
12769
+ title: 数据影响
12770
+ template: |
12771
+ **数据迁移需求**: {{migration_requirement}}
12772
+ **数据一致性风险**: {{consistency_risk}}
12773
+ **备份恢复策略**: {{backup_strategy}}
12774
+ - id: performance-impact
12775
+ title: 性能影响
12776
+ template: |
12777
+ **新增负载评估**: {{load_estimate}}
12778
+ **资源需求变化**: {{resource_change}}
12779
+ **性能测试要求**: {{performance_test_requirement}}
12780
+ - id: deployment-impact
12781
+ title: 部署影响
12782
+ template: |
12783
+ **部署步骤变更**: {{deployment_change}}
12784
+ **配置变更**: {{config_change}}
12785
+ **回滚方案**: {{rollback_plan}}
11702
12786
 
11703
- EXECUTION MODE:
11704
- Ask the user if they want to work through the checklist:
12787
+ - id: risk-analysis
12788
+ title: 风险分析
12789
+ sections:
12790
+ - id: risk-list
12791
+ title: 风险清单
12792
+ type: table
12793
+ columns: [风险ID, 风险类型, 风险描述, 可能性, 影响, 缓解措施]
12794
+ instruction: |
12795
+ 识别所有风险,类型包括:
12796
+ - 技术风险:新技术引入、兼容性、性能
12797
+ - 业务风险:功能影响、数据安全、服务可用性
12798
+ - 实施风险:复杂度、技能匹配、时间约束
12799
+ - id: critical-risks
12800
+ title: 关键风险详述
12801
+ instruction: 对高风险项提供详细分析和缓解方案
12802
+ repeatable: true
12803
+ template: |
12804
+ ### {{risk_name}}
11705
12805
 
11706
- - Section by section (interactive mode) - Review each section, present findings, get confirmation before proceeding
11707
- - All at once (comprehensive mode) - Complete full analysis and present comprehensive report at end]]
12806
+ **风险描述**: {{description}}
12807
+ **可能性**: {{probability}}
12808
+ **影响程度**: {{impact}}
12809
+
12810
+ **根因分析**: {{root_cause}}
12811
+
12812
+ **缓解措施**:
12813
+ {{mitigation_measures}}
12814
+
12815
+ **应急预案**:
12816
+ {{contingency_plan}}
12817
+
12818
+ **监控指标**:
12819
+ {{monitoring_metrics}}
12820
+
12821
+ - id: implementation-guide
12822
+ title: 实施指南
12823
+ sections:
12824
+ - id: implementation-sequence
12825
+ title: 实施顺序
12826
+ instruction: |
12827
+ 基于依赖关系,规划实施顺序。
12828
+ 每个阶段对应PRD中的Epic/Story。
12829
+ type: numbered-list
12830
+ template: |
12831
+ 1. **阶段1: {{phase1_name}}**
12832
+ - Story: {{story_refs}}
12833
+ - 前置条件: {{prerequisites}}
12834
+ - 产出物: {{deliverables}}
12835
+ - 检查点: {{checkpoints}}
12836
+ - id: dependency-diagram
12837
+ title: 依赖关系图
12838
+ type: mermaid
12839
+ mermaid_type: graph
12840
+ instruction: 使用Mermaid图展示实施依赖关系
12841
+ - id: checkpoints
12842
+ title: 关键检查点
12843
+ type: table
12844
+ columns: [检查点, 阶段, 验证内容, 负责人]
12845
+
12846
+ - id: knowledge-references
12847
+ title: 知识引用索引
12848
+ instruction: 列出设计中引用的所有知识库文档
12849
+ sections:
12850
+ - id: architecture-refs
12851
+ title: 架构知识引用
12852
+ type: table
12853
+ columns: [文件路径, 引用章节, 引用内容]
12854
+ - id: coding-standard-refs
12855
+ title: 编码规范引用
12856
+ type: table
12857
+ columns: [文件路径, 引用规范, 应用位置]
12858
+ - id: middleware-refs
12859
+ title: 中间件规范引用
12860
+ type: table
12861
+ columns: [文件路径, 引用示例, 应用位置]
12862
+
12863
+ - id: next-steps
12864
+ title: 后续步骤
12865
+ sections:
12866
+ - id: developer-handoff
12867
+ title: 开发者交接
12868
+ instruction: |
12869
+ 生成给开发者的交接提示,包含:
12870
+ - 需要阅读的文档清单
12871
+ - 编码规范要点
12872
+ - 实施注意事项
12873
+ template: |
12874
+ **交接给开发者**
12875
+
12876
+ 请基于本架构增量设计文档进行开发:
12877
+
12878
+ **必读文档**:
12879
+ - 架构增量设计: docs/architecture-increment.md
12880
+ - PRD文档: {{prd_path}}
12881
+ - 编码规范: docs/rag/technical/coding-standards/
12882
+
12883
+ **开发重点**:
12884
+ - 变动模块: {{changed_modules}}
12885
+ - 数据模型变更: {{data_changes}}
12886
+ - 接口变更: {{api_changes}}
12887
+
12888
+ **注意事项**:
12889
+ - 严格遵循编码规范
12890
+ - 参考中间件代码示例
12891
+ - 每个Story完成后进行集成验证
12892
+
12893
+ **执行命令**: *start-development docs/architecture-increment.md
12894
+ - id: qa-handoff
12895
+ title: QA交接
12896
+ instruction: |
12897
+ 生成给QA的交接提示,包含:
12898
+ - 测试范围
12899
+ - 重点测试项
12900
+ - 回归测试要求
12901
+ template: |
12902
+ **交接给QA**
12903
+
12904
+ 请基于本架构增量设计制定测试计划:
12905
+
12906
+ **必读文档**:
12907
+ - 架构增量设计: docs/architecture-increment.md (影响评估章节)
12908
+ - PRD文档: {{prd_path}} (验收标准)
12909
+
12910
+ **测试范围**:
12911
+ - 新增功能: {{new_features}}
12912
+ - 修改功能: {{modified_features}}
12913
+ - 回归范围: {{regression_scope}}
12914
+
12915
+ **重点关注**:
12916
+ - 数据迁移验证
12917
+ - 接口兼容性测试
12918
+ - 性能影响验证
12919
+
12920
+ **执行命令**: *create-test-plan docs/architecture-increment.md
12921
+ ==================== END: .xiaoma-core/templates/incremental-architecture-tmpl.yaml ====================
12922
+
12923
+ ==================== START: .xiaoma-core/checklists/architect-checklist.md ====================
12924
+ <!-- Powered by XiaoMa™ Core -->
12925
+
12926
+ # Architect Solution Validation Checklist
12927
+
12928
+ This checklist serves as a comprehensive framework for the Architect to validate the technical design and architecture before development execution. The Architect should systematically work through each item, ensuring the architecture is robust, scalable, secure, and aligned with the product requirements.
12929
+
12930
+ [[LLM: INITIALIZATION INSTRUCTIONS - REQUIRED ARTIFACTS
12931
+
12932
+ Before proceeding with this checklist, ensure you have access to:
12933
+
12934
+ 1. architecture.md - The primary architecture document (check docs/architecture.md)
12935
+ 2. prd.md - Product Requirements Document for requirements alignment (check docs/prd.md)
12936
+ 3. frontend-architecture.md or fe-architecture.md - If this is a UI project (check docs/frontend-architecture.md)
12937
+ 4. Any system diagrams referenced in the architecture
12938
+ 5. API documentation if available
12939
+ 6. Technology stack details and version specifications
12940
+
12941
+ IMPORTANT: If any required documents are missing or inaccessible, immediately ask the user for their location or content before proceeding.
12942
+
12943
+ PROJECT TYPE DETECTION:
12944
+ First, determine the project type by checking:
12945
+
12946
+ - Does the architecture include a frontend/UI component?
12947
+ - Is there a frontend-architecture.md document?
12948
+ - Does the PRD mention user interfaces or frontend requirements?
12949
+
12950
+ If this is a backend-only or service-only project:
12951
+
12952
+ - Skip sections marked with [[FRONTEND ONLY]]
12953
+ - Focus extra attention on API design, service architecture, and integration patterns
12954
+ - Note in your final report that frontend sections were skipped due to project type
12955
+
12956
+ VALIDATION APPROACH:
12957
+ For each section, you must:
12958
+
12959
+ 1. Deep Analysis - Don't just check boxes, thoroughly analyze each item against the provided documentation
12960
+ 2. Evidence-Based - Cite specific sections or quotes from the documents when validating
12961
+ 3. Critical Thinking - Question assumptions and identify gaps, not just confirm what's present
12962
+ 4. Risk Assessment - Consider what could go wrong with each architectural decision
12963
+
12964
+ EXECUTION MODE:
12965
+ Ask the user if they want to work through the checklist:
12966
+
12967
+ - Section by section (interactive mode) - Review each section, present findings, get confirmation before proceeding
12968
+ - All at once (comprehensive mode) - Complete full analysis and present comprehensive report at end]]
11708
12969
 
11709
12970
  ## 1. REQUIREMENTS ALIGNMENT
11710
12971
 
@@ -12263,6 +13524,545 @@ Fix plan:
12263
13524
  - Gate ownership remains with QA; Dev signals readiness via Status
12264
13525
  ==================== END: .xiaoma-core/tasks/apply-qa-fixes.md ====================
12265
13526
 
13527
+ ==================== START: .xiaoma-core/tasks/develop-story-with-rag.md ====================
13528
+ # 基于知识库的故事开发任务
13529
+
13530
+ ## Purpose
13531
+
13532
+ 基于知识库(`docs/rag/`)中的技术规范和架构增量设计文档(`docs/architecture-increment.md`),对用户故事进行标准化开发。确保开发过程中严格遵循项目技术规范、编码标准和架构设计。
13533
+
13534
+ ## 上游交接物
13535
+
13536
+ ```yaml
13537
+ 必需输入:
13538
+ 故事文件:
13539
+ - docs/project/stories/{epic}.{story}.*.md # 待开发的用户故事
13540
+
13541
+ 架构增量设计:
13542
+ - docs/architecture-increment.md # Architect生成的增量设计文档
13543
+
13544
+ 可选输入:
13545
+ 技术知识库:
13546
+ - docs/rag/technical/architecture.md # 现有技术架构
13547
+ - docs/rag/technical/tech-stack.md # 技术栈详情
13548
+ - docs/rag/technical/module-structure.md # 模块结构
13549
+ - docs/rag/technical/data-model.md # 数据模型
13550
+ - docs/rag/technical/coding-standards/ # 编码规范目录
13551
+ - docs/rag/technical/middleware/ # 中间件规范目录
13552
+ - docs/rag/technical/sql-standards/ # SQL规范目录
13553
+
13554
+ 约束条件:
13555
+ - docs/rag/constraints/security.md # 安全要求
13556
+ - docs/rag/constraints/performance.md # 性能要求
13557
+
13558
+ PRD文档:
13559
+ - docs/prd.md # PRD文档(可选参考)
13560
+ ```
13561
+
13562
+ ## Workflow Overview
13563
+
13564
+ ```
13565
+ 故事文件 + 知识库 + 架构增量设计 → 知识加载 → 任务实现 → 规范校验 → 测试验证 → 故事更新
13566
+ ```
13567
+
13568
+ ---
13569
+
13570
+ ## Phase 0: 知识上下文加载
13571
+
13572
+ ### 0.1 验证上游交接物
13573
+
13574
+ ```yaml
13575
+ 执行步骤:
13576
+ 步骤1_检查故事文件:
13577
+ 动作: 确认故事文件存在且状态为可开发
13578
+ 验证项:
13579
+ - 故事文件路径有效
13580
+ - 故事状态不是 Draft
13581
+ - 任务列表已定义
13582
+ 缺失处理: |
13583
+ 如果故事文件缺失或状态不对,提示:
13584
+ "故事文件未就绪。请先确认故事状态,或执行 PM 智能体完善故事定义。"
13585
+
13586
+ 步骤2_检查架构增量设计:
13587
+ 动作: 检查 docs/architecture-increment.md 是否存在
13588
+ 提取内容:
13589
+ - 与当前故事相关的模块设计
13590
+ - 数据模型变动
13591
+ - 接口设计
13592
+ - 中间件设计
13593
+ 缺失处理: |
13594
+ 如果架构增量设计不存在:
13595
+ - 检查是否有传统架构文档可用
13596
+ - 提示用户是否继续(使用通用规范)或先生成架构设计
13597
+
13598
+ 步骤3_加载技术知识库:
13599
+ 动作: 扫描并加载 docs/rag/technical/ 目录
13600
+ 加载策略:
13601
+ - 按需加载:仅加载与当前任务相关的规范文件
13602
+ - 优先级:编码规范 > 中间件规范 > SQL规范
13603
+ 关键文件:
13604
+ - docs/rag/technical/coding-standards/ # 编码规范(必须)
13605
+ - docs/rag/technical/module-structure.md # 模块结构(必须)
13606
+ - docs/rag/technical/middleware/ # 中间件规范(按需)
13607
+ - docs/rag/technical/sql-standards/ # SQL规范(按需)
13608
+ ```
13609
+
13610
+ ### 0.2 知识上下文整合
13611
+
13612
+ ```yaml
13613
+ 整合输出:
13614
+ 开发上下文:
13615
+ 架构设计:
13616
+ 来源: docs/architecture-increment.md
13617
+ 提取: 与当前Story相关的设计章节
13618
+ 内容:
13619
+ - 模块设计(包结构、类设计)
13620
+ - 数据模型设计(表结构、DDL)
13621
+ - 接口设计(API定义)
13622
+ - 中间件设计(Redis/MQ/定时任务)
13623
+
13624
+ 编码规范:
13625
+ 来源: docs/rag/technical/coding-standards/
13626
+ 内容:
13627
+ - 命名规范(类/方法/变量/常量)
13628
+ - 分层规范(Controller/Service/DAO)
13629
+ - 异常处理规范
13630
+ - 日志规范
13631
+
13632
+ 模块结构:
13633
+ 来源: docs/rag/technical/module-structure.md
13634
+ 内容:
13635
+ - 包结构规范
13636
+ - 分层结构
13637
+ - 模块依赖关系
13638
+
13639
+ 中间件规范:
13640
+ 来源: docs/rag/technical/middleware/
13641
+ 内容:
13642
+ - Redis使用规范和代码示例
13643
+ - MQ使用规范和代码示例
13644
+ - 定时任务规范和代码示例
13645
+
13646
+ SQL规范:
13647
+ 来源: docs/rag/technical/sql-standards/
13648
+ 内容:
13649
+ - 表设计规范
13650
+ - 索引设计规范
13651
+ - 查询优化规范
13652
+
13653
+ 约束条件:
13654
+ 来源: docs/rag/constraints/
13655
+ 内容:
13656
+ - 安全要求(来自 security.md)
13657
+ - 性能要求(来自 performance.md)
13658
+ ```
13659
+
13660
+ ---
13661
+
13662
+ ## Phase 1: 任务分析与规范匹配
13663
+
13664
+ ### 1.1 任务类型识别
13665
+
13666
+ ```yaml
13667
+ 任务类型识别:
13668
+ 数据模型任务:
13669
+ 识别标志: 创建表、修改表、添加字段、创建索引
13670
+ 关联规范:
13671
+ - docs/rag/technical/sql-standards/ # SQL规范
13672
+ - docs/rag/technical/data-model.md # 数据模型
13673
+ - docs/architecture-increment.md#数据模型增量设计
13674
+
13675
+ 接口开发任务:
13676
+ 识别标志: 创建API、修改接口、添加端点
13677
+ 关联规范:
13678
+ - docs/rag/technical/coding-standards/ # 编码规范
13679
+ - docs/architecture-increment.md#接口增量设计
13680
+
13681
+ 业务逻辑任务:
13682
+ 识别标志: 实现Service、业务流程、校验逻辑
13683
+ 关联规范:
13684
+ - docs/rag/technical/coding-standards/ # 编码规范
13685
+ - docs/rag/technical/module-structure.md # 模块结构
13686
+ - docs/architecture-increment.md#模块增量设计
13687
+
13688
+ 中间件任务:
13689
+ 识别标志: 缓存、消息队列、定时任务
13690
+ 关联规范:
13691
+ - docs/rag/technical/middleware/redis.md # Redis规范
13692
+ - docs/rag/technical/middleware/mq.md # MQ规范
13693
+ - docs/rag/technical/middleware/scheduler.md # 定时任务规范
13694
+ - docs/architecture-increment.md#中间件增量设计
13695
+
13696
+ 前端任务:
13697
+ 识别标志: 组件、页面、交互
13698
+ 关联规范:
13699
+ - docs/rag/technical/coding-standards/ # 前端编码规范
13700
+ - docs/architecture-increment.md#前端设计(如有)
13701
+ ```
13702
+
13703
+ ### 1.2 规范加载策略
13704
+
13705
+ ```yaml
13706
+ 加载策略:
13707
+ 按任务类型加载:
13708
+ 原则: 仅加载当前任务所需的规范文件
13709
+ 避免: 一次性加载所有规范导致上下文过载
13710
+
13711
+ 加载顺序:
13712
+ 1. 架构增量设计中的相关章节
13713
+ 2. 编码规范(通用)
13714
+ 3. 任务特定规范(SQL/中间件等)
13715
+ 4. 约束条件(安全/性能)
13716
+
13717
+ 缓存策略:
13718
+ - 会话内缓存已加载的规范
13719
+ - 跨任务复用通用规范
13720
+ ```
13721
+
13722
+ ---
13723
+
13724
+ ## Phase 2: 任务实现
13725
+
13726
+ ### 2.1 实现前检查
13727
+
13728
+ ```yaml
13729
+ 实现前检查:
13730
+ 检查项:
13731
+ 架构对齐:
13732
+ - 当前任务在架构增量设计中是否有对应设计
13733
+ - 包结构是否与 module-structure.md 一致
13734
+ - 类命名是否遵循编码规范
13735
+
13736
+ 数据模型对齐:
13737
+ - 表结构是否与架构设计一致
13738
+ - 字段定义是否符合SQL规范
13739
+ - 索引设计是否合理
13740
+
13741
+ 接口对齐:
13742
+ - API路径是否与架构设计一致
13743
+ - 请求/响应格式是否符合规范
13744
+ - 错误码是否按规范定义
13745
+
13746
+ 不一致处理:
13747
+ - 记录偏差到 Debug Log
13748
+ - 如有重大偏差,暂停并询问用户
13749
+ ```
13750
+
13751
+ ### 2.2 代码实现规范
13752
+
13753
+ ```yaml
13754
+ 代码实现规范:
13755
+ 命名规范:
13756
+ 来源: docs/rag/technical/coding-standards/
13757
+ 要求:
13758
+ - Controller: {Module}Controller
13759
+ - Service: {Module}Service / {Module}ServiceImpl
13760
+ - DAO: {Module}Mapper / {Module}Repository
13761
+ - Entity: {Entity}
13762
+ - DTO: {Entity}DTO / {Entity}VO / {Entity}Request / {Entity}Response
13763
+
13764
+ 分层规范:
13765
+ 来源: docs/rag/technical/coding-standards/
13766
+ 要求:
13767
+ - Controller: 仅处理请求/响应,不含业务逻辑
13768
+ - Service: 业务逻辑层,事务管理
13769
+ - DAO: 数据访问层,仅数据操作
13770
+ - 禁止: 跨层调用、循环依赖
13771
+
13772
+ 异常处理:
13773
+ 来源: docs/rag/technical/coding-standards/
13774
+ 要求:
13775
+ - 使用统一异常类
13776
+ - 业务异常与系统异常分离
13777
+ - 异常信息包含上下文
13778
+
13779
+ 日志规范:
13780
+ 来源: docs/rag/technical/coding-standards/
13781
+ 要求:
13782
+ - 关键操作必须有日志
13783
+ - 日志级别正确使用
13784
+ - 敏感信息脱敏
13785
+ ```
13786
+
13787
+ ### 2.3 中间件使用规范
13788
+
13789
+ ```yaml
13790
+ 中间件使用规范:
13791
+ Redis使用:
13792
+ 来源: docs/rag/technical/middleware/redis.md
13793
+ 规范:
13794
+ - Key命名: {业务}:{模块}:{标识}
13795
+ - 必须设置过期时间
13796
+ - 使用正确的数据结构
13797
+ - 参考知识库中的代码示例
13798
+
13799
+ MQ使用:
13800
+ 来源: docs/rag/technical/middleware/mq.md
13801
+ 规范:
13802
+ - Topic命名规范
13803
+ - 消息格式标准化
13804
+ - 消费者幂等处理
13805
+ - 参考知识库中的代码示例
13806
+
13807
+ 定时任务:
13808
+ 来源: docs/rag/technical/middleware/scheduler.md
13809
+ 规范:
13810
+ - 任务命名规范
13811
+ - 分布式锁使用
13812
+ - 异常处理
13813
+ - 参考知识库中的代码示例
13814
+ ```
13815
+
13816
+ ### 2.4 SQL实现规范
13817
+
13818
+ ```yaml
13819
+ SQL实现规范:
13820
+ 表设计:
13821
+ 来源: docs/rag/technical/sql-standards/
13822
+ 规范:
13823
+ - 表名小写下划线
13824
+ - 主键统一命名
13825
+ - 必须有创建/更新时间字段
13826
+ - 必须有表和字段注释
13827
+
13828
+ 索引设计:
13829
+ 来源: docs/rag/technical/sql-standards/
13830
+ 规范:
13831
+ - 索引命名: idx_{表名}_{字段}
13832
+ - 唯一索引: uk_{表名}_{字段}
13833
+ - 避免冗余索引
13834
+
13835
+ 查询规范:
13836
+ 来源: docs/rag/technical/sql-standards/
13837
+ 规范:
13838
+ - 禁止 SELECT *
13839
+ - 分页必须有限制
13840
+ - 避免大事务
13841
+ ```
13842
+
13843
+ ---
13844
+
13845
+ ## Phase 3: 实现过程中的规范校验
13846
+
13847
+ ### 3.1 实时校验点
13848
+
13849
+ ```yaml
13850
+ 校验点:
13851
+ 代码创建时:
13852
+ - 文件路径是否符合 module-structure.md
13853
+ - 类名是否符合命名规范
13854
+ - 包声明是否正确
13855
+
13856
+ 代码编写时:
13857
+ - 方法命名是否规范
13858
+ - 异常处理是否符合规范
13859
+ - 日志打印是否规范
13860
+
13861
+ 代码完成时:
13862
+ - 是否遵循分层规范
13863
+ - 是否有必要的注释
13864
+ - 是否处理了边界情况
13865
+ ```
13866
+
13867
+ ### 3.2 规范偏差处理
13868
+
13869
+ ```yaml
13870
+ 偏差处理:
13871
+ 轻微偏差:
13872
+ 定义: 命名风格略有差异、注释不够详细
13873
+ 处理: 记录到 Debug Log,继续执行
13874
+
13875
+ 中等偏差:
13876
+ 定义: 分层不清晰、缺少必要校验
13877
+ 处理: 立即修正,记录到 Completion Notes
13878
+
13879
+ 严重偏差:
13880
+ 定义: 架构不一致、安全风险
13881
+ 处理: 暂停开发,询问用户确认
13882
+ ```
13883
+
13884
+ ---
13885
+
13886
+ ## Phase 4: 测试与验证
13887
+
13888
+ ### 4.1 测试要求
13889
+
13890
+ ```yaml
13891
+ 测试要求:
13892
+ 单元测试:
13893
+ - Service层必须有单元测试
13894
+ - 覆盖正常流程和异常流程
13895
+ - Mock外部依赖
13896
+
13897
+ 集成测试:
13898
+ - API接口必须有集成测试
13899
+ - 数据库操作必须验证
13900
+
13901
+ 验收标准验证:
13902
+ - 逐条验证故事中的AC
13903
+ - 记录验证结果
13904
+ ```
13905
+
13906
+ ### 4.2 规范合规检查
13907
+
13908
+ ```yaml
13909
+ 合规检查:
13910
+ 代码规范检查:
13911
+ 执行: lint工具检查
13912
+ 标准: docs/rag/technical/coding-standards/
13913
+
13914
+ 安全检查:
13915
+ 执行: 安全扫描(如配置)
13916
+ 标准: docs/rag/constraints/security.md
13917
+
13918
+ 性能检查:
13919
+ 执行: 性能测试(如需要)
13920
+ 标准: docs/rag/constraints/performance.md
13921
+ ```
13922
+
13923
+ ---
13924
+
13925
+ ## Phase 5: 故事文件更新
13926
+
13927
+ ### 5.1 允许更新的部分
13928
+
13929
+ ```yaml
13930
+ 允许更新部分:
13931
+ 任务状态:
13932
+ - Tasks / Subtasks 复选框标记为 [x]
13933
+
13934
+ Dev Agent Record:
13935
+ - Agent Model Used: 使用的模型
13936
+ - Debug Log References: 调试日志
13937
+ - Completion Notes List: 完成说明
13938
+ - File List: 新增/修改/删除的文件
13939
+ - Knowledge References: 【新增】引用的知识文件
13940
+
13941
+ Change Log:
13942
+ - 新增变更日志条目
13943
+
13944
+ Status:
13945
+ - 更新为 Ready for Review
13946
+ ```
13947
+
13948
+ ### 5.2 知识引用记录
13949
+
13950
+ ```yaml
13951
+ 知识引用记录:
13952
+ 格式:
13953
+ ## Knowledge References
13954
+
13955
+ | 知识文件 | 引用内容 | 应用位置 |
13956
+ |----------|----------|----------|
13957
+ | docs/rag/technical/coding-standards/naming.md | 类命名规范 | UserController.java |
13958
+ | docs/rag/technical/middleware/redis.md | 缓存实现示例 | UserCacheService.java |
13959
+ | docs/architecture-increment.md#用户模块设计 | 模块设计 | user/ 目录结构 |
13960
+
13961
+ 目的:
13962
+ - 便于代码审查时验证规范遵循
13963
+ - 便于后续维护时理解实现依据
13964
+ - 建立代码与知识库的可追溯关系
13965
+ ```
13966
+
13967
+ ---
13968
+
13969
+ ## 执行顺序总结
13970
+
13971
+ ```yaml
13972
+ 执行顺序:
13973
+ order-of-execution: |
13974
+ 1. 加载知识上下文
13975
+ - 读取架构增量设计 (docs/architecture-increment.md)
13976
+ - 读取相关编码规范 (docs/rag/technical/coding-standards/)
13977
+ - 读取任务相关规范 (按需)
13978
+
13979
+ 2. 读取当前任务
13980
+ - 分析任务类型
13981
+ - 匹配相关规范
13982
+ - 提取架构设计中的对应章节
13983
+
13984
+ 3. 实现任务
13985
+ - 按照规范创建代码文件
13986
+ - 遵循命名和分层规范
13987
+ - 参考中间件代码示例
13988
+
13989
+ 4. 编写测试
13990
+ - 按照测试规范编写
13991
+ - 覆盖正常和异常流程
13992
+
13993
+ 5. 执行验证
13994
+ - 运行lint检查
13995
+ - 运行测试
13996
+ - 验证AC
13997
+
13998
+ 6. 更新故事文件
13999
+ - 标记任务完成 [x]
14000
+ - 更新 File List
14001
+ - 记录 Knowledge References
14002
+ - 更新 Completion Notes
14003
+
14004
+ 7. 重复直至完成所有任务
14005
+
14006
+ 8. 最终检查
14007
+ - 执行 story-dod-checklist
14008
+ - 验证所有规范遵循
14009
+ - 设置状态为 Ready for Review
14010
+ ```
14011
+
14012
+ ---
14013
+
14014
+ ## 阻塞条件
14015
+
14016
+ ```yaml
14017
+ 阻塞条件:
14018
+ 暂停情况:
14019
+ - 架构增量设计与故事任务严重不一致
14020
+ - 知识库规范相互冲突
14021
+ - 安全约束无法满足
14022
+ - 连续3次实现失败
14023
+ - 需要未批准的依赖
14024
+
14025
+ 处理方式:
14026
+ - 记录问题到 Debug Log
14027
+ - 暂停并询问用户
14028
+ - 等待用户确认后继续
14029
+ ```
14030
+
14031
+ ---
14032
+
14033
+ ## 完成标志
14034
+
14035
+ ```yaml
14036
+ 完成条件:
14037
+ 必要条件:
14038
+ - 所有任务和子任务标记为 [x]
14039
+ - 所有测试通过
14040
+ - lint检查通过
14041
+ - 验收标准全部满足
14042
+ - Knowledge References 已记录
14043
+
14044
+ 完成提示: |
14045
+ ✅ 故事开发完成!
14046
+
14047
+ 📄 故事文件: {story_path}
14048
+ 📊 任务完成: {completed_tasks}/{total_tasks}
14049
+ 🧪 测试状态: 全部通过
14050
+
14051
+ 📚 知识引用:
14052
+ - 编码规范: docs/rag/technical/coding-standards/
14053
+ - 架构设计: docs/architecture-increment.md
14054
+ - 中间件规范: {middleware_refs}
14055
+
14056
+ 📁 文件变更:
14057
+ - 新增: {new_files}
14058
+ - 修改: {modified_files}
14059
+ - 删除: {deleted_files}
14060
+
14061
+ 🔄 下一步:
14062
+ - QA审查: 请QA执行 *review-story
14063
+ - 代码审查: 请进行代码评审
14064
+ ==================== END: .xiaoma-core/tasks/develop-story-with-rag.md ====================
14065
+
12266
14066
  ==================== START: .xiaoma-core/tasks/validate-next-story.md ====================
12267
14067
  <!-- Powered by XiaoMa™ Core -->
12268
14068
 
@@ -12893,66 +14693,504 @@ The story creation is successful when:
12893
14693
  - **Implicit:** An annotated change-checklist (or the record of its completion) reflecting the discussions, findings, and decisions made during the process.
12894
14694
  ==================== END: .xiaoma-core/tasks/correct-course.md ====================
12895
14695
 
12896
- ==================== START: .xiaoma-core/templates/brownfield-prd-tmpl.yaml ====================
12897
- template:
12898
- id: brownfield-prd-template-v2
12899
- name: 现有项目增强功能PRD
12900
- version: 2.0
12901
- output:
12902
- format: markdown
12903
- filename: docs/prd.md
12904
- title: "{{project_name}} Brownfield Enhancement PRD"
14696
+ ==================== START: .xiaoma-core/tasks/create-prd-from-rag.md ====================
14697
+ # 基于需求分析创建PRD任务
12905
14698
 
12906
- workflow:
12907
- mode: interactive
12908
- elicitation: advanced-elicitation
14699
+ ## Purpose
12909
14700
 
12910
- sections:
12911
- - id: intro-analysis
12912
- title: 项目介绍、分析与背景
12913
- instruction: |
12914
- 重要 - 需要进行范围评估:
14701
+ 基于 Analyst 智能体的需求分析产出物(`docs/rag/` 目录),结合原始需求文档,生成高质量的 PRD 或 Epic 文档。本任务是 Analyst 智能体的下游任务,承接需求分析报告并转化为可执行的产品文档。
12915
14702
 
12916
- 本PRD适用于对现有项目进行需要全面规划和多个用户故事(stories)的重大功能增强。在继续之前:
14703
+ ## 上游交接物
12917
14704
 
12918
- 1. **评估增强功能的复杂性**:如果这只是一个简单的功能添加或错误修复,可以在1-2个集中的开发周期内完成,请**停止**并建议:“对于较简单的变更,请考虑与产品负责人(Product Owner)一起使用 `brownfield-create-epic` 或 `brownfield-create-story` 任务。完整的PRD流程是为需要架构规划和多个协调故事(stories)的重大增强功能而设计的。”
14705
+ ```yaml
14706
+ 必需输入:
14707
+ - docs/rag/_analysis-report.md # 需求分析报告(核心输入)
14708
+ - docs/rag/_requirement-parsing.yaml # 需求解析结果
14709
+ - req.txt # 原始需求文档
14710
+
14711
+ 可选输入:
14712
+ - docs/rag/_questions.md # 问题清单
14713
+ - docs/rag/_index.md # 知识索引
14714
+ - docs/rag/business/ # 业务知识
14715
+ - docs/rag/technical/ # 技术知识
14716
+ - docs/rag/constraints/ # 约束条件
14717
+ ```
12919
14718
 
12920
- 2. **项目背景**:确定我们是否在已加载项目的IDE中工作,或者用户是否需要提供项目信息。如果项目文件可用,请分析 `docs` 文件夹中的现有文档。如果文档不充分,请建议首先运行 `document-project` 任务。
14719
+ ## Workflow Overview
12921
14720
 
12922
- 3. **深度评估要求**:在提出**任何**建议之前,您**必须**彻底分析现有项目的结构、模式和约束。每一个建议都必须基于实际的项目分析,而不是假设。
14721
+ ```
14722
+ Analyst产出物 → 输入验证 → 复杂度评估 → 文档类型选择 → 文档生成 → 质量检查
14723
+ ```
12923
14724
 
12924
- 收集有关现有项目的全面信息。在继续进行需求部分之前,必须完成本节。
14725
+ ---
12925
14726
 
12926
- 关键:在整个分析过程中,要明确地与用户确认您的理解。对于您对现有项目做出的每一个假设,都要提问:“根据我的分析,我理解 [假设]。这样正确吗?”
14727
+ ## Phase 1: 输入验证与上下文加载
12927
14728
 
12928
- 在用户验证您对现有系统的理解之前,不要继续提出任何建议。
12929
- sections:
12930
- - id: existing-project-overview
12931
- title: 现有项目概览
12932
- instruction: 检查是否已执行过 `document-project` 分析。如果是,请引用该分析的输出,而不是重新分析。
12933
- sections:
12934
- - id: analysis-source
12935
- title: 分析来源
12936
- instruction: |
12937
- 指明以下其中一项:
12938
- - `document-project` 的分析输出可用,路径:{{path}}
12939
- - 基于IDE的全新分析
12940
- - 用户提供的信息
12941
- - id: current-state
12942
- title: 项目当前状态
12943
- instruction: |
12944
- - 如果存在 `document-project` 的输出:从“高层架构(High Level Architecture)”和“技术摘要(Technical Summary)”部分提取摘要
12945
- - 否则:简要描述项目当前的功能及其主要目的
12946
- - id: documentation-analysis
12947
- title: 可用文档分析
12948
- instruction: |
12949
- 如果已运行 `document-project`:
12950
- - 备注:“`document-project` 分析可用 - 正在使用现有技术文档”
12951
- - 列出由 `document-project` 创建的关键文档
12952
- - 跳过下面的缺失文档检查
14729
+ ### 1.1 验证上游交接物
12953
14730
 
12954
- 否则,检查现有文档:
12955
- sections:
14731
+ ```yaml
14732
+ 执行步骤:
14733
+ 步骤1_检查必需文件:
14734
+ 动作: 检查 docs/rag/ 目录是否存在以下文件
14735
+ 必需文件:
14736
+ - _analysis-report.md
14737
+ - _requirement-parsing.yaml
14738
+ 缺失处理: |
14739
+ 如果缺失必需文件,提示用户:
14740
+ "未找到需求分析报告。请先执行 Analyst 智能体的 *analyze-requirement 命令完成需求分析。"
14741
+
14742
+ 步骤2_加载分析报告:
14743
+ 动作: 读取并解析 _analysis-report.md
14744
+ 提取内容:
14745
+ - 需求概述(背景、目标、范围)
14746
+ - 功能分析(功能清单、优先级、依赖关系)
14747
+ - 用户分析(角色、旅程)
14748
+ - 数据分析(实体、关系)
14749
+ - 技术分析(可行性、兼容性)
14750
+ - 业务规则汇总
14751
+ - 差距分析
14752
+ - 风险分析
14753
+ - 待澄清事项
14754
+
14755
+ 步骤3_加载原始需求:
14756
+ 动作: 读取 req.txt 原始需求文档
14757
+ 目的: 确保不遗漏原始需求中的细节
14758
+
14759
+ 步骤4_加载知识上下文:
14760
+ 动作: 扫描 docs/rag/ 子目录,加载相关知识文件
14761
+ 加载顺序:
14762
+ - technical/architecture.md # 技术架构
14763
+ - technical/coding-standards/ # 编码规范
14764
+ - technical/data-model.md # 数据模型
14765
+ - business/ # 业务知识
14766
+ - constraints/ # 约束条件
14767
+ ```
14768
+
14769
+ ### 1.2 上下文整合
14770
+
14771
+ ```yaml
14772
+ 整合输出:
14773
+ 项目上下文:
14774
+ - 项目背景与目标
14775
+ - 技术栈与架构约束
14776
+ - 现有系统兼容性要求
14777
+
14778
+ 需求上下文:
14779
+ - 功能清单与优先级
14780
+ - 用户角色与权限
14781
+ - 数据实体与关系
14782
+ - 业务规则
14783
+
14784
+ 约束上下文:
14785
+ - 技术约束
14786
+ - 安全合规要求
14787
+ - 性能要求
14788
+
14789
+ 风险上下文:
14790
+ - 已识别风险
14791
+ - 待澄清事项
14792
+ ```
14793
+
14794
+ ---
14795
+
14796
+ ## Phase 2: 复杂度评估与文档类型选择
14797
+
14798
+ ### 2.1 复杂度评估矩阵
14799
+
14800
+ ```yaml
14801
+ 评估维度:
14802
+ 功能复杂度:
14803
+ 低: 功能点 <= 3,无复杂业务流程
14804
+ 中: 功能点 4-8,存在中等复杂度业务流程
14805
+ 高: 功能点 > 8,存在复杂业务流程或多系统集成
14806
+
14807
+ 技术复杂度:
14808
+ 低: 遵循现有模式,无架构变更
14809
+ 中: 部分新技术引入,小范围架构调整
14810
+ 高: 重大技术决策,架构级变更
14811
+
14812
+ 集成复杂度:
14813
+ 低: 单一系统,无外部集成
14814
+ 中: 2-3个系统集成
14815
+ 高: 多系统集成,复杂数据流
14816
+
14817
+ 风险等级:
14818
+ 低: 风险清单中无高风险项
14819
+ 中: 存在1-2个中等风险项
14820
+ 高: 存在高风险项或多个中等风险项
14821
+ ```
14822
+
14823
+ ### 2.2 文档类型选择规则
14824
+
14825
+ ```yaml
14826
+ 选择规则:
14827
+ 生成完整PRD:
14828
+ 条件:
14829
+ - 功能复杂度 >= 中 OR
14830
+ - 技术复杂度 >= 中 OR
14831
+ - 需要架构设计 OR
14832
+ - 涉及多个Epic
14833
+ 输出: docs/prd.md
14834
+ 模板: prd-from-rag-tmpl.yaml
14835
+
14836
+ 生成单Epic:
14837
+ 条件:
14838
+ - 功能复杂度 = 低
14839
+ - 技术复杂度 = 低
14840
+ - 可在1-3个Story内完成
14841
+ - 无重大架构变更
14842
+ 输出: docs/epic-{name}.md
14843
+ 模板: epic-from-rag-tmpl.yaml
14844
+
14845
+ 需要澄清:
14846
+ 条件:
14847
+ - 待澄清事项 > 5 OR
14848
+ - 存在阻塞性待澄清项
14849
+ 动作: 暂停生成,先与用户澄清关键问题
14850
+ ```
14851
+
14852
+ ### 2.3 交互确认
14853
+
14854
+ ```yaml
14855
+ 确认点:
14856
+ 展示内容:
14857
+ - 复杂度评估结果
14858
+ - 建议的文档类型
14859
+ - 预计的Epic/Story数量
14860
+ - 关键风险提示
14861
+
14862
+ 用户选项:
14863
+ - 确认并继续
14864
+ - 调整文档类型
14865
+ - 先澄清待定事项
14866
+ ```
14867
+
14868
+ ---
14869
+
14870
+ ## Phase 3: PRD文档生成
14871
+
14872
+ ### 3.1 PRD结构映射
14873
+
14874
+ 将分析报告内容映射到PRD结构:
14875
+
14876
+ ```yaml
14877
+ 映射规则:
14878
+ 目标与背景:
14879
+ 来源: 分析报告.需求概述
14880
+ 映射:
14881
+ - 需求背景 → PRD.背景上下文
14882
+ - 核心目标 → PRD.目标
14883
+ - 范围边界 → PRD.范围定义
14884
+
14885
+ 需求章节:
14886
+ 来源: 分析报告.功能分析 + 业务规则汇总
14887
+ 映射:
14888
+ - 功能清单 → PRD.功能性需求 (FR)
14889
+ - 业务规则 → PRD.功能性需求 (补充)
14890
+ - 技术分析.性能要求 → PRD.非功能性需求 (NFR)
14891
+ - 约束条件 → PRD.非功能性需求 (NFR)
14892
+
14893
+ UI设计目标:
14894
+ 来源: 分析报告.用户分析
14895
+ 映射:
14896
+ - 用户角色 → PRD.用户角色定义
14897
+ - 用户旅程 → PRD.关键交互范式
14898
+ - 功能清单中的UI相关项 → PRD.核心屏幕与视图
14899
+
14900
+ 技术假设:
14901
+ 来源: docs/rag/technical/ + 分析报告.技术分析
14902
+ 映射:
14903
+ - architecture.md → PRD.服务架构
14904
+ - coding-standards/ → PRD.编码规范约束
14905
+ - 技术可行性评估 → PRD.技术假设
14906
+
14907
+ Epic结构:
14908
+ 来源: 分析报告.功能分析
14909
+ 映射:
14910
+ - 功能清单(按优先级分组) → Epic列表
14911
+ - 功能依赖关系 → Story顺序
14912
+ - P0功能 → Epic 1 (核心功能)
14913
+ - P1功能 → Epic 2+ (增强功能)
14914
+
14915
+ 风险与待办:
14916
+ 来源: 分析报告.风险分析 + 待澄清事项
14917
+ 映射:
14918
+ - 风险清单 → PRD.风险评估
14919
+ - 待澄清事项 → PRD.开放问题
14920
+ ```
14921
+
14922
+ ### 3.2 Epic/Story 生成规则
14923
+
14924
+ ```yaml
14925
+ Epic生成规则:
14926
+ 分组策略:
14927
+ - 按功能模块分组
14928
+ - 每个Epic交付独立可测试的功能增量
14929
+ - Epic 1 优先包含P0功能
14930
+ - 后续Epic按优先级和依赖关系排列
14931
+
14932
+ Epic结构:
14933
+ - Epic标题
14934
+ - Epic目标 (2-3句话)
14935
+ - 包含的功能点
14936
+ - 技术实现要点(来自技术知识)
14937
+ - Story列表
14938
+
14939
+ Story生成规则:
14940
+ 拆分策略:
14941
+ - 每个Story是垂直切片
14942
+ - 单个AI Agent会话可完成(2-4小时工作量)
14943
+ - 明确的输入输出边界
14944
+
14945
+ Story结构:
14946
+ - Story标题
14947
+ - 用户故事格式 (As a... I want... So that...)
14948
+ - 验收标准 (基于分析报告中的业务规则)
14949
+ - 技术实现提示(来自技术知识)
14950
+ - 集成验证点(来自数据关系分析)
14951
+
14952
+ 排序规则:
14953
+ - 基础设施优先
14954
+ - 数据模型优先于业务逻辑
14955
+ - 核心流程优先于边缘场景
14956
+ - 遵循功能依赖关系图
14957
+ ```
14958
+
14959
+ ### 3.3 知识融合
14960
+
14961
+ ```yaml
14962
+ 知识融合点:
14963
+ 业务规则融合:
14964
+ 来源: docs/rag/business/rules-*.md
14965
+ 融合到: 验收标准、业务逻辑描述
14966
+
14967
+ 数据模型融合:
14968
+ 来源: docs/rag/technical/data-model.md
14969
+ 融合到: 数据实体定义、关联关系说明
14970
+
14971
+ 编码规范融合:
14972
+ 来源: docs/rag/technical/coding-standards/
14973
+ 融合到: 技术实现提示、代码示例引用
14974
+
14975
+ 中间件规范融合:
14976
+ 来源: docs/rag/technical/middleware/
14977
+ 融合到: 技术假设、实现约束
14978
+
14979
+ 安全要求融合:
14980
+ 来源: docs/rag/constraints/security.md
14981
+ 融合到: 非功能性需求、验收标准
14982
+ ```
14983
+
14984
+ ---
14985
+
14986
+ ## Phase 4: 质量检查与输出
14987
+
14988
+ ### 4.1 PRD质量检查清单
14989
+
14990
+ ```yaml
14991
+ 完整性检查:
14992
+ - [ ] 所有P0功能已覆盖
14993
+ - [ ] 所有P1功能已覆盖或标记为后续迭代
14994
+ - [ ] 所有已识别的业务规则已融入
14995
+ - [ ] 所有数据实体已定义
14996
+ - [ ] 所有用户角色已覆盖
14997
+
14998
+ 一致性检查:
14999
+ - [ ] 功能需求与分析报告一致
15000
+ - [ ] 技术假设与知识库一致
15001
+ - [ ] Epic/Story顺序符合依赖关系
15002
+ - [ ] 验收标准可测试
15003
+
15004
+ 可执行性检查:
15005
+ - [ ] 每个Story大小适合AI Agent执行
15006
+ - [ ] Story之间无循环依赖
15007
+ - [ ] 技术实现路径清晰
15008
+ - [ ] 风险缓解措施具体
15009
+
15010
+ 交接完整性检查:
15011
+ - [ ] 包含UX专家提示
15012
+ - [ ] 包含架构师提示
15013
+ - [ ] 待澄清事项已列出
15014
+ ```
15015
+
15016
+ ### 4.2 输出文件
15017
+
15018
+ ```yaml
15019
+ 主输出:
15020
+ PRD文档:
15021
+ 路径: docs/prd.md
15022
+ 格式: Markdown
15023
+
15024
+ 或 Epic文档:
15025
+ 路径: docs/epic-{name}.md
15026
+ 格式: Markdown
15027
+
15028
+ 辅助输出:
15029
+ 知识引用索引:
15030
+ 路径: docs/prd-knowledge-refs.md
15031
+ 内容: PRD中引用的知识文件清单
15032
+
15033
+ 待澄清事项:
15034
+ 路径: docs/prd-open-questions.md
15035
+ 内容: 需要进一步确认的问题
15036
+ ```
15037
+
15038
+ ---
15039
+
15040
+ ## Phase 5: 下游交接
15041
+
15042
+ ### 5.1 交接给UX专家
15043
+
15044
+ ```yaml
15045
+ UX专家交接:
15046
+ 必读文件:
15047
+ - docs/prd.md (UI设计目标章节)
15048
+ - docs/rag/_analysis-report.md (用户分析章节)
15049
+
15050
+ 关注点:
15051
+ - 用户角色与权限
15052
+ - 核心屏幕与视图
15053
+ - 关键用户旅程
15054
+ - 无障碍性要求
15055
+
15056
+ 建议命令: "*create-ux-design docs/prd.md"
15057
+ ```
15058
+
15059
+ ### 5.2 交接给架构师
15060
+
15061
+ ```yaml
15062
+ 架构师交接:
15063
+ 必读文件:
15064
+ - docs/prd.md (技术假设章节)
15065
+ - docs/rag/technical/ (技术知识目录)
15066
+ - docs/rag/_analysis-report.md (技术分析章节)
15067
+
15068
+ 关注点:
15069
+ - 技术栈与架构约束
15070
+ - 数据模型与关系
15071
+ - 集成点与接口
15072
+ - 性能与安全要求
15073
+
15074
+ 建议命令: "*create-architecture docs/prd.md"
15075
+ ```
15076
+
15077
+ ---
15078
+
15079
+ ## 使用说明
15080
+
15081
+ ### 激活命令
15082
+
15083
+ ```
15084
+ *create-prd-from-rag [rag_path]
15085
+ ```
15086
+
15087
+ ### 执行参数
15088
+
15089
+ ```yaml
15090
+ 参数:
15091
+ rag_path: RAG知识目录路径 (默认: docs/rag/)
15092
+ output_path: PRD输出路径 (默认: docs/prd.md)
15093
+ doc_type: 文档类型 (auto|prd|epic, 默认: auto)
15094
+ interactive: 交互模式 (默认: true)
15095
+ ```
15096
+
15097
+ ### 交互模式流程
15098
+
15099
+ 1. **验证阶段**: 检查上游交接物完整性
15100
+ 2. **评估阶段**: 展示复杂度评估结果,确认文档类型
15101
+ 3. **生成阶段**: 逐章节生成PRD,关键节点请求确认
15102
+ 4. **检查阶段**: 执行质量检查清单
15103
+ 5. **输出阶段**: 生成最终文档,提示下游交接
15104
+
15105
+ ### YOLO模式
15106
+
15107
+ 通过 `*yolo` 命令切换YOLO模式,一次性完成所有步骤,跳过中间确认环节。
15108
+
15109
+ ---
15110
+
15111
+ ## 任务完成标志
15112
+
15113
+ ```yaml
15114
+ 完成条件:
15115
+ 必要输出:
15116
+ - docs/prd.md 或 docs/epic-{name}.md
15117
+
15118
+ 完成提示: |
15119
+ ✅ PRD/Epic 文档生成完成!
15120
+
15121
+ 📄 输出文件: {output_path}
15122
+ 📊 Epic数量: {epic_count}
15123
+ 📝 Story数量: {story_count}
15124
+
15125
+ 🔄 下一步建议:
15126
+ - UX设计: *create-ux-design docs/prd.md
15127
+ - 架构设计: *create-architecture docs/prd.md
15128
+
15129
+ ⚠️ 待澄清事项: {open_questions_count} 项
15130
+ 请在开发前确认这些问题。
15131
+ ```
15132
+ ==================== END: .xiaoma-core/tasks/create-prd-from-rag.md ====================
15133
+
15134
+ ==================== START: .xiaoma-core/templates/brownfield-prd-tmpl.yaml ====================
15135
+ template:
15136
+ id: brownfield-prd-template-v2
15137
+ name: 现有项目增强功能PRD
15138
+ version: 2.0
15139
+ output:
15140
+ format: markdown
15141
+ filename: docs/prd.md
15142
+ title: "{{project_name}} Brownfield Enhancement PRD"
15143
+
15144
+ workflow:
15145
+ mode: interactive
15146
+ elicitation: advanced-elicitation
15147
+
15148
+ sections:
15149
+ - id: intro-analysis
15150
+ title: 项目介绍、分析与背景
15151
+ instruction: |
15152
+ 重要 - 需要进行范围评估:
15153
+
15154
+ 本PRD适用于对现有项目进行需要全面规划和多个用户故事(stories)的重大功能增强。在继续之前:
15155
+
15156
+ 1. **评估增强功能的复杂性**:如果这只是一个简单的功能添加或错误修复,可以在1-2个集中的开发周期内完成,请**停止**并建议:“对于较简单的变更,请考虑与产品负责人(Product Owner)一起使用 `brownfield-create-epic` 或 `brownfield-create-story` 任务。完整的PRD流程是为需要架构规划和多个协调故事(stories)的重大增强功能而设计的。”
15157
+
15158
+ 2. **项目背景**:确定我们是否在已加载项目的IDE中工作,或者用户是否需要提供项目信息。如果项目文件可用,请分析 `docs` 文件夹中的现有文档。如果文档不充分,请建议首先运行 `document-project` 任务。
15159
+
15160
+ 3. **深度评估要求**:在提出**任何**建议之前,您**必须**彻底分析现有项目的结构、模式和约束。每一个建议都必须基于实际的项目分析,而不是假设。
15161
+
15162
+ 收集有关现有项目的全面信息。在继续进行需求部分之前,必须完成本节。
15163
+
15164
+ 关键:在整个分析过程中,要明确地与用户确认您的理解。对于您对现有项目做出的每一个假设,都要提问:“根据我的分析,我理解 [假设]。这样正确吗?”
15165
+
15166
+ 在用户验证您对现有系统的理解之前,不要继续提出任何建议。
15167
+ sections:
15168
+ - id: existing-project-overview
15169
+ title: 现有项目概览
15170
+ instruction: 检查是否已执行过 `document-project` 分析。如果是,请引用该分析的输出,而不是重新分析。
15171
+ sections:
15172
+ - id: analysis-source
15173
+ title: 分析来源
15174
+ instruction: |
15175
+ 指明以下其中一项:
15176
+ - `document-project` 的分析输出可用,路径:{{path}}
15177
+ - 基于IDE的全新分析
15178
+ - 用户提供的信息
15179
+ - id: current-state
15180
+ title: 项目当前状态
15181
+ instruction: |
15182
+ - 如果存在 `document-project` 的输出:从“高层架构(High Level Architecture)”和“技术摘要(Technical Summary)”部分提取摘要
15183
+ - 否则:简要描述项目当前的功能及其主要目的
15184
+ - id: documentation-analysis
15185
+ title: 可用文档分析
15186
+ instruction: |
15187
+ 如果已运行 `document-project`:
15188
+ - 备注:“`document-project` 分析可用 - 正在使用现有技术文档”
15189
+ - 列出由 `document-project` 创建的关键文档
15190
+ - 跳过下面的缺失文档检查
15191
+
15192
+ 否则,检查现有文档:
15193
+ sections:
12956
15194
  - id: available-docs
12957
15195
  title: 可用文档
12958
15196
  type: checklist
@@ -13176,67 +15414,480 @@ sections:
13176
15414
  - template: "IV3: {{performance_impact_verification}}"
13177
15415
  ==================== END: .xiaoma-core/templates/brownfield-prd-tmpl.yaml ====================
13178
15416
 
13179
- ==================== START: .xiaoma-core/checklists/change-checklist.md ====================
13180
- <!-- Powered by XiaoMa™ Core -->
15417
+ ==================== START: .xiaoma-core/templates/prd-from-rag-tmpl.yaml ====================
15418
+ template:
15419
+ id: prd-from-rag-template-v1
15420
+ name: 基于需求分析的PRD文档
15421
+ version: 1.0
15422
+ description: 基于Analyst智能体的需求分析产出物生成PRD
15423
+ output:
15424
+ format: markdown
15425
+ filename: docs/prd.md
15426
+ title: "{{project_name}} 产品需求文档 (PRD)"
13181
15427
 
13182
- # Change Navigation Checklist
15428
+ workflow:
15429
+ mode: interactive
15430
+ elicitation: advanced-elicitation
15431
+ upstream:
15432
+ agent: analyst
15433
+ required_files:
15434
+ - docs/rag/_analysis-report.md
15435
+ - docs/rag/_requirement-parsing.yaml
15436
+ optional_files:
15437
+ - docs/rag/_questions.md
15438
+ - docs/rag/_index.md
15439
+ - docs/rag/business/*
15440
+ - docs/rag/technical/*
15441
+ - docs/rag/constraints/*
13183
15442
 
13184
- **Purpose:** To systematically guide the selected Agent and user through the analysis and planning required when a significant change (pivot, tech issue, missing requirement, failed story) is identified during the BMad workflow.
15443
+ sections:
15444
+ - id: input-validation
15445
+ title: 输入验证
15446
+ internal: true
15447
+ instruction: |
15448
+ 在开始生成PRD之前,执行以下验证:
13185
15449
 
13186
- **Instructions:** Review each item with the user. Mark `[x]` for completed/confirmed, `[N/A]` if not applicable, or add notes for discussion points.
15450
+ 1. **检查必需文件**:
15451
+ - docs/rag/_analysis-report.md 是否存在
15452
+ - docs/rag/_requirement-parsing.yaml 是否存在
15453
+ - req.txt 原始需求文档是否存在
13187
15454
 
13188
- [[LLM: INITIALIZATION INSTRUCTIONS - CHANGE NAVIGATION
15455
+ 2. **加载分析报告**:
15456
+ - 读取并解析 _analysis-report.md 的所有章节
15457
+ - 提取关键信息:功能清单、用户角色、数据实体、风险、待澄清事项
13189
15458
 
13190
- Changes during development are inevitable, but how we handle them determines project success or failure.
15459
+ 3. **加载知识上下文**:
15460
+ - 扫描 docs/rag/technical/ 获取技术约束
15461
+ - 扫描 docs/rag/business/ 获取业务规则
15462
+ - 扫描 docs/rag/constraints/ 获取约束条件
13191
15463
 
13192
- Before proceeding, understand:
15464
+ 如果缺少必需文件,提示:
15465
+ "⚠️ 未找到需求分析报告。请先执行 Analyst 智能体完成需求分析:*analyze-requirement req.txt"
13193
15466
 
13194
- 1. This checklist is for SIGNIFICANT changes that affect the project direction
13195
- 2. Minor adjustments within a story don't require this process
13196
- 3. The goal is to minimize wasted work while adapting to new realities
13197
- 4. User buy-in is critical - they must understand and approve changes
15467
+ - id: complexity-assessment
15468
+ title: 复杂度评估
15469
+ instruction: |
15470
+ 基于分析报告内容,评估项目复杂度并推荐文档类型。
13198
15471
 
13199
- Required context:
15472
+ **评估维度**:
15473
+ 1. 功能复杂度:基于功能清单数量和依赖关系
15474
+ 2. 技术复杂度:基于技术可行性评估
15475
+ 3. 集成复杂度:基于数据关系和外部依赖
15476
+ 4. 风险等级:基于风险清单
13200
15477
 
13201
- - The triggering story or issue
13202
- - Current project state (completed stories, current epic)
13203
- - Access to PRD, architecture, and other key documents
13204
- - Understanding of remaining work planned
15478
+ **推荐文档类型**:
15479
+ - 完整PRD:复杂度 >= 中等,或涉及多个Epic
15480
+ - 单Epic:复杂度低,可在1-3个Story内完成
13205
15481
 
13206
- APPROACH:
13207
- This is an interactive process with the user. Work through each section together, discussing implications and options. The user makes final decisions, but provide expert guidance on technical feasibility and impact.
15482
+ 展示评估结果并请用户确认文档类型。
15483
+ elicit: true
15484
+ sections:
15485
+ - id: assessment-result
15486
+ title: 评估结果
15487
+ type: table
15488
+ columns: [评估维度, 等级, 依据]
15489
+ - id: recommendation
15490
+ title: 推荐方案
15491
+ instruction: 基于评估结果给出文档类型推荐和理由
13208
15492
 
13209
- REMEMBER: Changes are opportunities to improve, not failures. Handle them professionally and constructively.]]
15493
+ - id: goals-context
15494
+ title: 目标与背景
15495
+ instruction: |
15496
+ 从分析报告的"需求概述"章节提取内容,映射到PRD结构。
13210
15497
 
13211
- ---
15498
+ **映射规则**:
15499
+ - 分析报告.需求背景 → 背景上下文
15500
+ - 分析报告.核心目标 → 目标
15501
+ - 分析报告.范围边界 → 范围定义
13212
15502
 
13213
- ## 1. Understand the Trigger & Context
15503
+ 如果分析报告中信息不足,参考 req.txt 原始需求补充。
15504
+ sections:
15505
+ - id: goals
15506
+ title: 目标
15507
+ type: bullet-list
15508
+ instruction: |
15509
+ 从分析报告提取核心目标,转换为PRD目标格式。
15510
+ 每个目标应该是:
15511
+ - 可衡量的成果
15512
+ - 用户或业务价值
15513
+ - 与原始需求对应
15514
+ - id: background
15515
+ title: 背景上下文
15516
+ type: paragraphs
15517
+ instruction: |
15518
+ 综合以下来源生成背景描述:
15519
+ - 分析报告.需求背景
15520
+ - 分析报告.业务分析
15521
+ - 原始需求文档中的背景信息
15522
+ - id: scope
15523
+ title: 范围定义
15524
+ instruction: 从分析报告.范围边界提取,明确包含和不包含的内容
15525
+ sections:
15526
+ - id: in-scope
15527
+ title: 范围内
15528
+ type: bullet-list
15529
+ - id: out-of-scope
15530
+ title: 范围外
15531
+ type: bullet-list
15532
+ - id: changelog
15533
+ title: 变更日志
15534
+ type: table
15535
+ columns: [日期, 版本, 描述, 作者]
13214
15536
 
13215
- [[LLM: Start by fully understanding what went wrong and why. Don't jump to solutions yet. Ask probing questions:
15537
+ - id: requirements
15538
+ title: 需求
15539
+ instruction: |
15540
+ 从分析报告的"功能分析"和"业务规则汇总"章节提取需求。
13216
15541
 
13217
- - What exactly happened that triggered this review?
13218
- - Is this a one-time issue or symptomatic of a larger problem?
13219
- - Could this have been anticipated earlier?
13220
- - What assumptions were incorrect?
15542
+ **功能性需求来源**:
15543
+ - 分析报告.功能清单 FR列表
15544
+ - 分析报告.业务规则 FR补充说明
15545
+ - docs/rag/business/rules-*.md 详细规则
13221
15546
 
13222
- Be specific and factual, not blame-oriented.]]
15547
+ **非功能性需求来源**:
15548
+ - 分析报告.技术分析.性能要求
15549
+ - docs/rag/constraints/security.md
15550
+ - docs/rag/constraints/performance.md
13223
15551
 
13224
- - [ ] **Identify Triggering Story:** Clearly identify the story (or stories) that revealed the issue.
13225
- - [ ] **Define the Issue:** Articulate the core problem precisely.
13226
- - [ ] Is it a technical limitation/dead-end?
13227
- - [ ] Is it a newly discovered requirement?
13228
- - [ ] Is it a fundamental misunderstanding of existing requirements?
13229
- - [ ] Is it a necessary pivot based on feedback or new information?
13230
- - [ ] Is it a failed/abandoned story needing a new approach?
13231
- - [ ] **Assess Initial Impact:** Describe the immediate observed consequences (e.g., blocked progress, incorrect functionality, non-viable tech).
13232
- - [ ] **Gather Evidence:** Note any specific logs, error messages, user feedback, or analysis that supports the issue definition.
15552
+ 确保每个需求都可追溯到分析报告或知识库文档。
15553
+ elicit: true
15554
+ sections:
15555
+ - id: functional
15556
+ title: 功能性需求
15557
+ type: numbered-list
15558
+ prefix: FR
15559
+ instruction: |
15560
+ 按优先级排列功能性需求:
15561
+ - P0功能优先列出
15562
+ - 每个FR包含:需求描述 + 来源标注
15563
+ - 复杂业务规则单独标注参考文档
13233
15564
 
13234
- ## 2. Epic Impact Assessment
15565
+ 格式示例:
15566
+ FR1: [P0] 用户可以创建订单 (来源: 分析报告.功能清单.F001)
15567
+ examples:
15568
+ - "FR1: [P0] 系统支持用户通过手机号注册账户 (来源: _analysis-report.md#功能清单)"
15569
+ - "FR2: [P0] 订单状态流转遵循:待支付→已支付→已发货→已完成 (来源: business/rules-order.md)"
15570
+ - id: non-functional
15571
+ title: 非功能性需求
15572
+ type: numbered-list
15573
+ prefix: NFR
15574
+ instruction: |
15575
+ 从约束条件和技术分析中提取非功能性需求。
15576
+ 包括:性能、安全、可用性、兼容性等。
15577
+ examples:
15578
+ - "NFR1: 接口响应时间P99 < 500ms (来源: constraints/performance.md)"
15579
+ - "NFR2: 敏感数据传输必须使用HTTPS加密 (来源: constraints/security.md)"
13235
15580
 
13236
- [[LLM: Changes ripple through the project structure. Systematically evaluate:
15581
+ - id: data-model
15582
+ title: 数据模型
15583
+ instruction: |
15584
+ 从分析报告的"数据分析"章节和技术知识中提取数据模型。
13237
15585
 
13238
- 1. Can we salvage the current epic with modifications?
13239
- 2. Do future epics still make sense given this change?
15586
+ **来源**:
15587
+ - 分析报告.数据实体清单
15588
+ - 分析报告.数据关系图
15589
+ - docs/rag/technical/data-model.md
15590
+ sections:
15591
+ - id: entities
15592
+ title: 数据实体
15593
+ type: table
15594
+ columns: [实体名称, 描述, 核心属性, 来源]
15595
+ instruction: 列出所有数据实体及其核心属性
15596
+ - id: relationships
15597
+ title: 数据关系
15598
+ instruction: |
15599
+ 描述实体间的关系,使用Mermaid ER图表示。
15600
+ 从分析报告.数据关系图提取,补充详细说明。
15601
+ examples:
15602
+ - |
15603
+ ```mermaid
15604
+ erDiagram
15605
+ User ||--o{ Order : creates
15606
+ Order ||--|{ OrderItem : contains
15607
+ ```
15608
+
15609
+ - id: technical-constraints
15610
+ title: 技术约束
15611
+ instruction: |
15612
+ 整合技术知识库中的约束条件,指导后续架构设计。
15613
+
15614
+ **来源**:
15615
+ - docs/rag/technical/architecture.md
15616
+ - docs/rag/technical/tech-stack.md
15617
+ - docs/rag/technical/coding-standards/
15618
+ - docs/rag/technical/middleware/
15619
+ - 分析报告.技术分析.与现有系统兼容性
15620
+ elicit: true
15621
+ sections:
15622
+ - id: tech-stack
15623
+ title: 技术栈约束
15624
+ instruction: |
15625
+ 从技术知识库提取技术栈要求:
15626
+ - 后端框架和版本
15627
+ - 数据库类型和版本
15628
+ - 中间件要求
15629
+ template: |
15630
+ **后端**: {{backend_framework}}
15631
+ **数据库**: {{database}}
15632
+ **缓存**: {{cache}}
15633
+ **消息队列**: {{mq}}
15634
+ - id: architecture-constraints
15635
+ title: 架构约束
15636
+ instruction: 从 architecture.md 提取架构模式和约束
15637
+ - id: coding-standards
15638
+ title: 编码规范约束
15639
+ instruction: |
15640
+ 从 coding-standards/ 目录提取关键规范:
15641
+ - 命名规范
15642
+ - 分层规范
15643
+ - 异常处理规范
15644
+ - id: integration-constraints
15645
+ title: 集成约束
15646
+ instruction: 从分析报告.技术分析提取集成相关约束
15647
+
15648
+ - id: epic-list
15649
+ title: 模块列表
15650
+ instruction: |
15651
+ 基于分析报告的功能分析,规划Epic结构。
15652
+
15653
+ **规划原则**:
15654
+ - 按功能优先级分组:P0功能 → Epic 1
15655
+ - 遵循功能依赖关系
15656
+ - 每个Epic交付独立可测试的功能增量
15657
+
15658
+ **Epic分组策略**:
15659
+ 1. 从分析报告.功能清单提取所有功能
15660
+ 2. 按优先级排序:P0 > P1 > P2
15661
+ 3. 分析依赖关系,确定Epic边界
15662
+ 4. 每个Epic包含相关联的功能集
15663
+
15664
+ 展示Epic列表,请用户确认分组是否合理。
15665
+ elicit: true
15666
+ sections:
15667
+ - id: epic-overview
15668
+ title: Epic概览
15669
+ type: table
15670
+ columns: [Epic, 标题, 包含功能, 优先级, Story数量(预估)]
15671
+ instruction: 展示所有Epic的概览表格
15672
+
15673
+ - id: epic-details
15674
+ title: "Epic {{epic_number}}: {{epic_title}}"
15675
+ repeatable: true
15676
+ instruction: |
15677
+ 为每个Epic生成详细内容,包含所有Story和验收标准。
15678
+
15679
+ **Epic内容来源**:
15680
+ - 分析报告.功能清单 (对应功能)
15681
+ - 分析报告.业务规则 (相关规则)
15682
+ - docs/rag/business/ (详细业务知识)
15683
+ - docs/rag/technical/ (技术实现参考)
15684
+
15685
+ **Story生成规则**:
15686
+ - 每个Story是垂直切片
15687
+ - 单个AI Agent会话可完成(2-4小时)
15688
+ - 验收标准来源于分析报告中的业务规则
15689
+ - 包含技术实现提示(来自技术知识)
15690
+
15691
+ **Story排序**:
15692
+ - 遵循分析报告.功能依赖关系
15693
+ - 基础设施和数据模型优先
15694
+ - 核心流程优先于边缘场景
15695
+ elicit: true
15696
+ template: |
15697
+ **Epic目标**: {{epic_goal}}
15698
+
15699
+ **包含功能**:
15700
+ {{功能列表,来源于分析报告}}
15701
+
15702
+ **技术要点**:
15703
+ {{技术实现要点,来源于技术知识库}}
15704
+ sections:
15705
+ - id: story
15706
+ title: "Story {{epic_number}}.{{story_number}}: {{story_title}}"
15707
+ repeatable: true
15708
+ template: |
15709
+ 作为一名 {{user_type}},
15710
+ 我想要 {{action}},
15711
+ 以便 {{benefit}}。
15712
+ sections:
15713
+ - id: acceptance-criteria
15714
+ title: 验收标准
15715
+ type: numbered-list
15716
+ instruction: |
15717
+ 从以下来源生成验收标准:
15718
+ - 分析报告.业务规则 (对应规则)
15719
+ - docs/rag/business/rules-*.md (详细规则)
15720
+ - 分析报告.数据分析 (数据约束)
15721
+
15722
+ 每个标准必须:
15723
+ - 可测试、可验证
15724
+ - 明确无歧义
15725
+ - 包含边界条件
15726
+ item_template: "AC{{criterion_number}}: {{criteria}} (来源: {{source}})"
15727
+ - id: technical-hints
15728
+ title: 技术实现提示
15729
+ instruction: |
15730
+ 从技术知识库提取实现提示:
15731
+ - 相关编码规范
15732
+ - 中间件使用示例
15733
+ - 数据模型参考
15734
+ type: bullet-list
15735
+ - id: knowledge-refs
15736
+ title: 知识引用
15737
+ instruction: 列出Story实现时需要参考的知识文档
15738
+ type: bullet-list
15739
+
15740
+ - id: risks-and-open-items
15741
+ title: 风险与待澄清事项
15742
+ instruction: |
15743
+ 从分析报告直接提取风险和待澄清事项。
15744
+
15745
+ **来源**:
15746
+ - 分析报告.风险分析
15747
+ - 分析报告.待澄清事项
15748
+ sections:
15749
+ - id: risks
15750
+ title: 风险清单
15751
+ type: table
15752
+ columns: [风险ID, 风险描述, 等级, 缓解措施]
15753
+ instruction: 从分析报告.风险清单直接映射
15754
+ - id: open-questions
15755
+ title: 待澄清事项
15756
+ type: table
15757
+ columns: [序号, 问题, 上下文, 建议选项, 状态]
15758
+ instruction: |
15759
+ 从分析报告.待澄清事项提取。
15760
+ 标注状态:待确认/已确认/已关闭
15761
+ 在PRD评审时需要逐一确认这些问题。
15762
+
15763
+ - id: knowledge-index
15764
+ title: 知识引用索引
15765
+ instruction: |
15766
+ 列出本PRD引用的所有知识文档,便于追溯和维护。
15767
+ sections:
15768
+ - id: analysis-refs
15769
+ title: 分析报告引用
15770
+ type: table
15771
+ columns: [章节, 引用位置, 用途]
15772
+ - id: knowledge-refs
15773
+ title: 知识库引用
15774
+ type: table
15775
+ columns: [文件路径, 引用位置, 用途]
15776
+
15777
+ - id: next-steps
15778
+ title: 后续步骤
15779
+ sections:
15780
+ - id: ux-expert-prompt
15781
+ title: UX专家交接
15782
+ instruction: |
15783
+ 生成给UX专家的交接提示,包含:
15784
+ - 需要关注的用户角色
15785
+ - 核心屏幕和交互
15786
+ - 品牌和无障碍要求
15787
+ - 相关知识文档路径
15788
+ template: |
15789
+ **交接给UX专家**
15790
+
15791
+ 请基于本PRD的用户分析部分设计UI/UX方案:
15792
+
15793
+ **关键输入**:
15794
+ - PRD文档: docs/prd.md
15795
+ - 用户分析: docs/rag/_analysis-report.md#用户分析
15796
+ - 用户角色: {{user_roles}}
15797
+ - 核心屏幕: {{core_screens}}
15798
+
15799
+ **设计重点**:
15800
+ {{design_focus}}
15801
+
15802
+ **执行命令**: *create-ux-design docs/prd.md
15803
+ - id: architect-prompt
15804
+ title: 架构师交接
15805
+ instruction: |
15806
+ 生成给架构师的交接提示,包含:
15807
+ - 技术栈约束
15808
+ - 数据模型要点
15809
+ - 集成需求
15810
+ - 相关知识文档路径
15811
+ template: |
15812
+ **交接给架构师**
15813
+
15814
+ 请基于本PRD和技术知识库设计系统架构:
15815
+
15816
+ **关键输入**:
15817
+ - PRD文档: docs/prd.md
15818
+ - 技术分析: docs/rag/_analysis-report.md#技术分析
15819
+ - 技术知识: docs/rag/technical/
15820
+ - 数据模型: docs/rag/technical/data-model.md
15821
+
15822
+ **架构重点**:
15823
+ - 技术栈: {{tech_stack}}
15824
+ - 关键集成点: {{integration_points}}
15825
+ - 性能要求: {{performance_requirements}}
15826
+
15827
+ **执行命令**: *create-architecture docs/prd.md
15828
+ ==================== END: .xiaoma-core/templates/prd-from-rag-tmpl.yaml ====================
15829
+
15830
+ ==================== START: .xiaoma-core/checklists/change-checklist.md ====================
15831
+ <!-- Powered by XiaoMa™ Core -->
15832
+
15833
+ # Change Navigation Checklist
15834
+
15835
+ **Purpose:** To systematically guide the selected Agent and user through the analysis and planning required when a significant change (pivot, tech issue, missing requirement, failed story) is identified during the BMad workflow.
15836
+
15837
+ **Instructions:** Review each item with the user. Mark `[x]` for completed/confirmed, `[N/A]` if not applicable, or add notes for discussion points.
15838
+
15839
+ [[LLM: INITIALIZATION INSTRUCTIONS - CHANGE NAVIGATION
15840
+
15841
+ Changes during development are inevitable, but how we handle them determines project success or failure.
15842
+
15843
+ Before proceeding, understand:
15844
+
15845
+ 1. This checklist is for SIGNIFICANT changes that affect the project direction
15846
+ 2. Minor adjustments within a story don't require this process
15847
+ 3. The goal is to minimize wasted work while adapting to new realities
15848
+ 4. User buy-in is critical - they must understand and approve changes
15849
+
15850
+ Required context:
15851
+
15852
+ - The triggering story or issue
15853
+ - Current project state (completed stories, current epic)
15854
+ - Access to PRD, architecture, and other key documents
15855
+ - Understanding of remaining work planned
15856
+
15857
+ APPROACH:
15858
+ This is an interactive process with the user. Work through each section together, discussing implications and options. The user makes final decisions, but provide expert guidance on technical feasibility and impact.
15859
+
15860
+ REMEMBER: Changes are opportunities to improve, not failures. Handle them professionally and constructively.]]
15861
+
15862
+ ---
15863
+
15864
+ ## 1. Understand the Trigger & Context
15865
+
15866
+ [[LLM: Start by fully understanding what went wrong and why. Don't jump to solutions yet. Ask probing questions:
15867
+
15868
+ - What exactly happened that triggered this review?
15869
+ - Is this a one-time issue or symptomatic of a larger problem?
15870
+ - Could this have been anticipated earlier?
15871
+ - What assumptions were incorrect?
15872
+
15873
+ Be specific and factual, not blame-oriented.]]
15874
+
15875
+ - [ ] **Identify Triggering Story:** Clearly identify the story (or stories) that revealed the issue.
15876
+ - [ ] **Define the Issue:** Articulate the core problem precisely.
15877
+ - [ ] Is it a technical limitation/dead-end?
15878
+ - [ ] Is it a newly discovered requirement?
15879
+ - [ ] Is it a fundamental misunderstanding of existing requirements?
15880
+ - [ ] Is it a necessary pivot based on feedback or new information?
15881
+ - [ ] Is it a failed/abandoned story needing a new approach?
15882
+ - [ ] **Assess Initial Impact:** Describe the immediate observed consequences (e.g., blocked progress, incorrect functionality, non-viable tech).
15883
+ - [ ] **Gather Evidence:** Note any specific logs, error messages, user feedback, or analysis that supports the issue definition.
15884
+
15885
+ ## 2. Epic Impact Assessment
15886
+
15887
+ [[LLM: Changes ripple through the project structure. Systematically evaluate:
15888
+
15889
+ 1. Can we salvage the current epic with modifications?
15890
+ 2. Do future epics still make sense given this change?
13240
15891
  3. Are we creating or eliminating dependencies?
13241
15892
  4. Does the epic sequence need reordering?
13242
15893
 
@@ -16429,6 +19080,931 @@ benefit: "{{user_benefit}}"
16429
19080
  5. **可测试性**:确保功能可以被充分测试
16430
19081
  ==================== END: .xiaoma-core/tasks/create-enhanced-story-with-database.md ====================
16431
19082
 
19083
+ ==================== START: .xiaoma-core/tasks/create-story-with-rag.md ====================
19084
+ # 基于知识库的用户故事创建任务
19085
+
19086
+ ## Purpose
19087
+
19088
+ 基于知识库(`docs/rag/`)中的业务知识、技术知识以及架构增量设计文档(`docs/architecture-increment.md`),创建详细、可操作且自包含的用户故事。确保故事内容与真实需求、业务规则和技术规范完全对齐,使开发智能体能够高效实施。
19089
+
19090
+ ## 上游交接物
19091
+
19092
+ ```yaml
19093
+ 必需输入:
19094
+ PRD/Epic文档:
19095
+ - docs/prd.md # PM生成的PRD文档
19096
+ - 或 docs/prd/{epic-name}.md # 切分后的Epic文档
19097
+
19098
+ 架构增量设计:
19099
+ - docs/architecture-increment.md # Architect生成的增量设计
19100
+
19101
+ 需求分析报告:
19102
+ - docs/rag/_analysis-report.md # Analyst生成的需求分析报告
19103
+
19104
+ 可选输入:
19105
+ 业务知识库:
19106
+ - docs/rag/business/rules-*.md # 业务规则文件
19107
+ - docs/rag/_requirement-parsing.yaml # 需求解析结果
19108
+
19109
+ 技术知识库:
19110
+ - docs/rag/technical/architecture.md # 现有技术架构
19111
+ - docs/rag/technical/tech-stack.md # 技术栈详情
19112
+ - docs/rag/technical/module-structure.md # 模块结构
19113
+ - docs/rag/technical/data-model.md # 数据模型
19114
+ - docs/rag/technical/coding-standards/ # 编码规范目录
19115
+ - docs/rag/technical/middleware/ # 中间件规范目录
19116
+ - docs/rag/technical/sql-standards/ # SQL规范目录
19117
+
19118
+ 约束条件:
19119
+ - docs/rag/constraints/security.md # 安全要求
19120
+ - docs/rag/constraints/performance.md # 性能要求
19121
+
19122
+ 上一个故事:
19123
+ - docs/project/stories/{epic}.{story-1}.*.md # 上一个完成的故事
19124
+ ```
19125
+
19126
+ ## Workflow Overview
19127
+
19128
+ ```
19129
+ PRD/Epic + 知识库 + 架构增量设计 → 识别Story → 知识融合 → 生成详细Story → 检查清单验证
19130
+ ```
19131
+
19132
+ ---
19133
+
19134
+ ## Phase 0: 加载核心配置与知识上下文
19135
+
19136
+ ### 0.1 加载核心配置
19137
+
19138
+ ```yaml
19139
+ 执行步骤:
19140
+ 步骤1_加载配置:
19141
+ 动作: 读取 .xiaoma-core/core-config.yaml
19142
+ 提取:
19143
+ - devStoryLocation # 故事文件存放位置
19144
+ - prd.* # PRD配置
19145
+ - architecture.* # 架构文档配置
19146
+ 缺失处理: |
19147
+ 如果配置文件不存在,提示:
19148
+ "core-config.yaml 未找到。请先配置项目。"
19149
+ ```
19150
+
19151
+ ### 0.2 验证上游交接物
19152
+
19153
+ ```yaml
19154
+ 执行步骤:
19155
+ 步骤1_检查PRD:
19156
+ 动作: 检查 docs/prd.md 或切分后的 Epic 文件
19157
+ 缺失处理: 提示执行 PM 智能体 *create-prd-from-rag
19158
+
19159
+ 步骤2_检查架构增量设计:
19160
+ 动作: 检查 docs/architecture-increment.md
19161
+ 缺失处理: |
19162
+ 如果不存在:
19163
+ - 提示执行 Architect 智能体 *create-incremental-architecture
19164
+ - 或询问是否使用传统架构文档继续
19165
+
19166
+ 步骤3_检查需求分析报告:
19167
+ 动作: 检查 docs/rag/_analysis-report.md
19168
+ 缺失处理: |
19169
+ 如果不存在:
19170
+ - 提示执行 Analyst 智能体完成需求分析
19171
+ - 或询问是否仅使用 PRD 继续(功能受限)
19172
+
19173
+ 步骤4_扫描知识库:
19174
+ 动作: 扫描 docs/rag/ 目录,识别可用的知识文件
19175
+ 输出:
19176
+ available_knowledge:
19177
+ business_rules: [文件列表]
19178
+ technical_specs: [文件列表]
19179
+ constraints: [文件列表]
19180
+ ```
19181
+
19182
+ ### 0.3 知识上下文整合
19183
+
19184
+ ```yaml
19185
+ 知识整合:
19186
+ 业务上下文:
19187
+ 来源:
19188
+ - docs/rag/_analysis-report.md#功能分析
19189
+ - docs/rag/_analysis-report.md#业务规则汇总
19190
+ - docs/rag/business/rules-*.md
19191
+ 提取内容:
19192
+ - 功能清单与优先级
19193
+ - 业务规则与约束
19194
+ - 用户角色与权限
19195
+ - 数据实体与关系
19196
+
19197
+ 技术上下文:
19198
+ 来源:
19199
+ - docs/architecture-increment.md
19200
+ - docs/rag/technical/coding-standards/
19201
+ - docs/rag/technical/module-structure.md
19202
+ - docs/rag/technical/middleware/
19203
+ 提取内容:
19204
+ - 模块设计与包结构
19205
+ - 数据模型设计与DDL
19206
+ - 接口设计与API规范
19207
+ - 中间件使用方式与代码示例
19208
+ - 编码规范要点
19209
+
19210
+ 约束上下文:
19211
+ 来源:
19212
+ - docs/rag/constraints/security.md
19213
+ - docs/rag/constraints/performance.md
19214
+ - docs/rag/_analysis-report.md#技术分析
19215
+ 提取内容:
19216
+ - 安全要求
19217
+ - 性能要求
19218
+ - 兼容性约束
19219
+ ```
19220
+
19221
+ ---
19222
+
19223
+ ## Phase 1: 识别下一个 Story
19224
+
19225
+ ### 1.1 定位 Epic 和 Story
19226
+
19227
+ ```yaml
19228
+ 执行步骤:
19229
+ 步骤1_定位Epic:
19230
+ 动作: 根据 PRD 配置定位当前 Epic
19231
+ 来源:
19232
+ - docs/prd.md 中的 Epic 列表
19233
+ - 或 docs/prd/{epic-name}.md 切分文件
19234
+
19235
+ 步骤2_确定Story编号:
19236
+ 动作: 扫描 devStoryLocation 目录
19237
+ 逻辑:
19238
+ - 如果无故事文件: 下一个是 1.1
19239
+ - 如果有故事文件: 找到最高编号,确定下一个
19240
+ - 检查最高编号故事状态,非Done则警告
19241
+
19242
+ 步骤3_提取Story需求:
19243
+ 动作: 从 Epic/PRD 中提取当前 Story 的定义
19244
+ 提取内容:
19245
+ - Story 标题
19246
+ - 用户故事描述
19247
+ - 验收标准 (AC)
19248
+ - 关联的功能点 (FR)
19249
+ ```
19250
+
19251
+ ### 1.2 关联知识映射
19252
+
19253
+ ```yaml
19254
+ 知识映射:
19255
+ 目的: 将 Story 需求映射到知识库中的具体内容
19256
+
19257
+ 映射维度:
19258
+ 业务规则映射:
19259
+ - Story AC → 相关业务规则 (docs/rag/business/rules-*.md)
19260
+ - 功能点 → 分析报告中的功能分析
19261
+
19262
+ 技术设计映射:
19263
+ - Story → 架构增量设计中的相关章节
19264
+ - 数据需求 → 数据模型增量设计
19265
+ - API需求 → 接口增量设计
19266
+ - 中间件需求 → 中间件增量设计
19267
+
19268
+ 约束映射:
19269
+ - 安全相关AC → security.md
19270
+ - 性能相关AC → performance.md
19271
+ ```
19272
+
19273
+ ---
19274
+
19275
+ ## Phase 2: 知识融合与 Story 内容生成
19276
+
19277
+ ### 2.1 用户故事描述生成
19278
+
19279
+ ```yaml
19280
+ 用户故事生成:
19281
+ 来源:
19282
+ - PRD/Epic 中的 Story 定义
19283
+ - docs/rag/_analysis-report.md#用户分析
19284
+
19285
+ 格式:
19286
+ 作为: {用户角色,来自用户分析}
19287
+ 我希望: {功能描述,来自功能分析}
19288
+ 以便: {业务价值,来自需求背景}
19289
+
19290
+ 验证:
19291
+ - 用户角色在分析报告中有定义
19292
+ - 功能在功能清单中有对应
19293
+ - 价值与业务目标对齐
19294
+ ```
19295
+
19296
+ ### 2.2 验收标准增强
19297
+
19298
+ ```yaml
19299
+ 验收标准增强:
19300
+ 基础AC:
19301
+ 来源: PRD/Epic 中定义的验收标准
19302
+
19303
+ 业务规则增强:
19304
+ 来源: docs/rag/business/rules-*.md
19305
+ 动作: |
19306
+ 对每个AC,检查是否有相关业务规则:
19307
+ - 如有,将业务规则细节融入AC
19308
+ - 标注来源: (来源: business/rules-{name}.md)
19309
+
19310
+ 技术约束增强:
19311
+ 来源: docs/rag/constraints/
19312
+ 动作: |
19313
+ 检查AC是否涉及安全/性能要求:
19314
+ - 如有,添加技术约束说明
19315
+ - 标注来源: (来源: constraints/{name}.md)
19316
+
19317
+ 示例:
19318
+ 原始AC: "用户可以创建订单"
19319
+ 增强后: |
19320
+ 用户可以创建订单
19321
+ - 订单状态初始为"待支付" (来源: business/rules-order.md)
19322
+ - 订单号格式: ORD{yyyyMMdd}{6位序号} (来源: business/rules-order.md)
19323
+ - 创建接口响应时间 < 500ms (来源: constraints/performance.md)
19324
+ ```
19325
+
19326
+ ### 2.3 任务/子任务生成
19327
+
19328
+ ```yaml
19329
+ 任务生成:
19330
+ 来源整合:
19331
+ 架构设计:
19332
+ - docs/architecture-increment.md#模块增量设计
19333
+ - docs/architecture-increment.md#数据模型增量设计
19334
+ - docs/architecture-increment.md#接口增量设计
19335
+ - docs/architecture-increment.md#中间件增量设计
19336
+
19337
+ 编码规范:
19338
+ - docs/rag/technical/coding-standards/
19339
+ - docs/rag/technical/module-structure.md
19340
+
19341
+ 任务生成规则:
19342
+ 数据层任务:
19343
+ 条件: Story涉及数据模型变更
19344
+ 来源: architecture-increment.md#数据模型增量设计
19345
+ 任务模板: |
19346
+ - [ ] 创建/修改数据模型 (AC: {相关AC})
19347
+ - [ ] 创建实体类 {EntityName} [参考: architecture-increment.md#entity-detail]
19348
+ - [ ] 执行DDL脚本 [参考: architecture-increment.md#ddl-script]
19349
+ - [ ] 创建Mapper/Repository [遵循: coding-standards/]
19350
+
19351
+ 接口层任务:
19352
+ 条件: Story涉及API开发
19353
+ 来源: architecture-increment.md#接口增量设计
19354
+ 任务模板: |
19355
+ - [ ] 实现API接口 (AC: {相关AC})
19356
+ - [ ] 创建Controller [参考: architecture-increment.md#api-detail]
19357
+ - [ ] 实现请求参数校验 [遵循: coding-standards/]
19358
+ - [ ] 实现响应格式 [参考: architecture-increment.md#response-design]
19359
+
19360
+ 业务层任务:
19361
+ 条件: Story涉及业务逻辑
19362
+ 来源: architecture-increment.md#模块增量设计
19363
+ 任务模板: |
19364
+ - [ ] 实现业务逻辑 (AC: {相关AC})
19365
+ - [ ] 创建Service类 [参考: architecture-increment.md#class-design]
19366
+ - [ ] 实现业务规则 [参考: business/rules-{name}.md]
19367
+ - [ ] 添加事务管理 [遵循: coding-standards/]
19368
+
19369
+ 中间件任务:
19370
+ 条件: Story涉及缓存/消息/定时任务
19371
+ 来源: architecture-increment.md#中间件增量设计
19372
+ 任务模板: |
19373
+ - [ ] 实现中间件功能 (AC: {相关AC})
19374
+ - [ ] Redis缓存实现 [参考: architecture-increment.md#redis-design, middleware/redis.md]
19375
+ - [ ] 消息队列实现 [参考: architecture-increment.md#mq-design, middleware/mq.md]
19376
+
19377
+ 测试任务:
19378
+ 来源: docs/rag/technical/coding-standards/ (测试部分)
19379
+ 任务模板: |
19380
+ - [ ] 编写测试用例 (AC: ALL)
19381
+ - [ ] 单元测试 [遵循: coding-standards/testing]
19382
+ - [ ] 集成测试(如需要)
19383
+ - [ ] 验收标准验证
19384
+ ```
19385
+
19386
+ ### 2.4 开发者说明生成
19387
+
19388
+ ```yaml
19389
+ 开发者说明生成:
19390
+ 结构:
19391
+ 上一个Story洞察:
19392
+ 来源: 上一个Story的Dev Agent Record
19393
+ 内容: 关键经验、技术决策、注意事项
19394
+
19395
+ 架构设计参考:
19396
+ 来源: docs/architecture-increment.md
19397
+ 内容: |
19398
+ ### 架构设计参考
19399
+ **模块设计**: [参考: architecture-increment.md#module-design]
19400
+ - 包结构: {package_structure}
19401
+ - 核心类: {class_list}
19402
+
19403
+ **数据模型**: [参考: architecture-increment.md#data-model-design]
19404
+ - 表名: {table_name}
19405
+ - 核心字段: {fields}
19406
+
19407
+ **接口设计**: [参考: architecture-increment.md#api-design]
19408
+ - 路径: {api_path}
19409
+ - 方法: {http_method}
19410
+
19411
+ 业务规则:
19412
+ 来源: docs/rag/business/rules-*.md
19413
+ 内容: |
19414
+ ### 业务规则
19415
+ [参考: business/rules-{name}.md]
19416
+ - 规则1: {rule_description}
19417
+ - 规则2: {rule_description}
19418
+
19419
+ 编码规范要点:
19420
+ 来源: docs/rag/technical/coding-standards/
19421
+ 内容: |
19422
+ ### 编码规范要点
19423
+ [参考: coding-standards/]
19424
+ - 命名规范: {naming_rules}
19425
+ - 分层规范: {layer_rules}
19426
+ - 异常处理: {exception_rules}
19427
+
19428
+ 中间件使用:
19429
+ 条件: Story涉及中间件
19430
+ 来源: docs/rag/technical/middleware/
19431
+ 内容: |
19432
+ ### 中间件使用
19433
+ **Redis**: [参考: middleware/redis.md]
19434
+ - Key命名: {key_pattern}
19435
+ - 代码示例: {code_example}
19436
+
19437
+ **MQ**: [参考: middleware/mq.md]
19438
+ - Topic: {topic_name}
19439
+ - 代码示例: {code_example}
19440
+
19441
+ 约束条件:
19442
+ 来源: docs/rag/constraints/
19443
+ 内容: |
19444
+ ### 约束条件
19445
+ **安全要求**: [参考: constraints/security.md]
19446
+ - {security_requirements}
19447
+
19448
+ **性能要求**: [参考: constraints/performance.md]
19449
+ - {performance_requirements}
19450
+
19451
+ 文件位置:
19452
+ 来源: docs/rag/technical/module-structure.md
19453
+ 内容: |
19454
+ ### 文件位置
19455
+ [参考: module-structure.md]
19456
+ - Controller: {path}
19457
+ - Service: {path}
19458
+ - Mapper: {path}
19459
+ - Entity: {path}
19460
+ ```
19461
+
19462
+ ### 2.5 测试说明生成
19463
+
19464
+ ```yaml
19465
+ 测试说明生成:
19466
+ 来源:
19467
+ - docs/rag/technical/coding-standards/ (测试部分)
19468
+ - docs/architecture-increment.md#测试策略 (如有)
19469
+
19470
+ 内容:
19471
+ 测试框架:
19472
+ 来源: coding-standards/
19473
+ 内容: {test_framework}
19474
+
19475
+ 测试文件位置:
19476
+ 来源: module-structure.md
19477
+ 内容: {test_file_location}
19478
+
19479
+ 测试场景:
19480
+ 来源: AC + 业务规则
19481
+ 内容: |
19482
+ - 正常流程测试: {scenarios}
19483
+ - 异常流程测试: {error_scenarios}
19484
+ - 边界条件测试: {edge_cases}
19485
+
19486
+ 验收测试:
19487
+ 来源: Story AC
19488
+ 内容: 每个AC对应的测试方法
19489
+ ```
19490
+
19491
+ ### 2.6 知识引用索引
19492
+
19493
+ ```yaml
19494
+ 知识引用索引:
19495
+ 目的: 记录Story中引用的所有知识文件,便于追溯
19496
+
19497
+ 格式:
19498
+ ## Knowledge References
19499
+
19500
+ | 知识文件 | 引用章节 | 应用位置 |
19501
+ |----------|----------|----------|
19502
+ | docs/architecture-increment.md | 模块设计 | 任务列表、Dev Notes |
19503
+ | docs/rag/business/rules-order.md | 订单规则 | AC增强、业务逻辑任务 |
19504
+ | docs/rag/technical/coding-standards/ | 命名规范 | Dev Notes |
19505
+ | docs/rag/technical/middleware/redis.md | 缓存示例 | 中间件任务 |
19506
+ | docs/rag/constraints/performance.md | 响应时间要求 | AC约束 |
19507
+ ```
19508
+
19509
+ ---
19510
+
19511
+ ## Phase 3: Story 文件生成与验证
19512
+
19513
+ ### 3.1 生成 Story 文件
19514
+
19515
+ ```yaml
19516
+ 输出文件:
19517
+ 路径: {devStoryLocation}/{epicNum}.{storyNum}.{story_title_short}.md
19518
+ 状态: Draft
19519
+
19520
+ 内容结构:
19521
+ - 状态
19522
+ - 用户故事
19523
+ - 验收标准(增强版)
19524
+ - 任务/子任务(带知识引用)
19525
+ - 开发者说明(知识融合版)
19526
+ - 测试说明
19527
+ - Knowledge References(新增)
19528
+ - 变更日志
19529
+ - 开发者代理记录
19530
+ - QA结果
19531
+ ```
19532
+
19533
+ ### 3.2 执行检查清单
19534
+
19535
+ ```yaml
19536
+ 检查清单:
19537
+ 执行: .xiaoma-core/checklists/story-draft-checklist.md
19538
+
19539
+ 额外检查项:
19540
+ 知识引用完整性:
19541
+ - [ ] 架构增量设计已引用
19542
+ - [ ] 相关业务规则已引用
19543
+ - [ ] 编码规范已引用
19544
+ - [ ] 约束条件已引用
19545
+
19546
+ 知识一致性:
19547
+ - [ ] AC与业务规则一致
19548
+ - [ ] 任务与架构设计一致
19549
+ - [ ] 技术选型与技术栈一致
19550
+ ```
19551
+
19552
+ ### 3.3 完成报告
19553
+
19554
+ ```yaml
19555
+ 完成报告:
19556
+ 格式: |
19557
+ ✅ 用户故事创建完成!
19558
+
19559
+ 📄 故事文件: {story_path}
19560
+ 📊 状态: Draft
19561
+ 🔢 Story编号: {epicNum}.{storyNum}
19562
+
19563
+ 📚 知识融合摘要:
19564
+ - 架构设计: {architecture_sections_used}
19565
+ - 业务规则: {business_rules_used}
19566
+ - 技术规范: {technical_specs_used}
19567
+ - 约束条件: {constraints_used}
19568
+
19569
+ 📋 任务概要:
19570
+ - 数据层任务: {data_task_count}
19571
+ - 接口层任务: {api_task_count}
19572
+ - 业务层任务: {business_task_count}
19573
+ - 测试任务: {test_task_count}
19574
+
19575
+ ✅ 检查清单: {checklist_result}
19576
+
19577
+ 🔄 下一步建议:
19578
+ - 审核故事: 请PO/用户审核后批准
19579
+ - 验证故事: 可执行 *validate-story 进行深度验证
19580
+ - 开始开发: 批准后执行 Dev智能体 *develop-story-with-rag
19581
+ ```
19582
+
19583
+ ---
19584
+
19585
+ ## 阻塞条件
19586
+
19587
+ ```yaml
19588
+ 阻塞条件:
19589
+ 必须停止:
19590
+ - PRD/Epic 文件不存在
19591
+ - 架构增量设计与PRD严重不一致
19592
+ - 关键业务规则缺失
19593
+
19594
+ 警告继续:
19595
+ - 部分知识文件缺失(记录后继续)
19596
+ - 上一个Story未完成(用户确认后继续)
19597
+ ```
19598
+
19599
+ ---
19600
+
19601
+ ## 使用说明
19602
+
19603
+ ### 激活命令
19604
+
19605
+ ```
19606
+ *draft-with-rag [epic_num] [story_num]
19607
+ ```
19608
+
19609
+ ### 执行参数
19610
+
19611
+ ```yaml
19612
+ 参数:
19613
+ epic_num: Epic编号 (可选,默认自动识别)
19614
+ story_num: Story编号 (可选,默认自动识别下一个)
19615
+ rag_path: RAG知识目录路径 (默认: docs/rag/)
19616
+ interactive: 交互模式 (默认: true)
19617
+ ```
19618
+
19619
+ ### 与原有命令的区别
19620
+
19621
+ | 命令 | 知识来源 | 适用场景 |
19622
+ |------|----------|----------|
19623
+ | `*draft` | 仅PRD + 架构文档 | 传统项目 |
19624
+ | `*draft-with-rag` | PRD + 知识库 + 架构增量设计 | 有知识库的项目 |
19625
+
19626
+ ---
19627
+
19628
+ ## 任务完成标志
19629
+
19630
+ ```yaml
19631
+ 完成条件:
19632
+ 必要输出:
19633
+ - Story文件已创建
19634
+ - Knowledge References已记录
19635
+ - 检查清单已执行
19636
+
19637
+ Story就绪标志:
19638
+ - 所有AC都有知识来源支撑
19639
+ - 所有任务都有技术参考
19640
+ - Dev Notes包含足够上下文
19641
+ - 知识引用索引完整
19642
+ ```
19643
+ ==================== END: .xiaoma-core/tasks/create-story-with-rag.md ====================
19644
+
19645
+ ==================== START: .xiaoma-core/templates/story-with-rag-tmpl.yaml ====================
19646
+ template:
19647
+ id: story-with-rag-template-v1
19648
+ name: 基于知识库的用户故事文档
19649
+ version: 1.0
19650
+ description: 融合知识库业务规则、技术规范和架构增量设计的用户故事模板
19651
+ output:
19652
+ format: markdown
19653
+ filename: docs/stories/{{epic_num}}.{{story_num}}.{{story_title_short}}.md
19654
+ title: "Story {{epic_num}}.{{story_num}}: {{story_title_short}}"
19655
+
19656
+ workflow:
19657
+ mode: interactive
19658
+ elicitation: advanced-elicitation
19659
+ upstream:
19660
+ agents:
19661
+ - analyst # 提供需求分析报告和知识库
19662
+ - pm # 提供PRD文档
19663
+ - architect # 提供架构增量设计
19664
+ required_files:
19665
+ - docs/prd.md
19666
+ - docs/architecture-increment.md
19667
+ optional_files:
19668
+ - docs/rag/_analysis-report.md
19669
+ - docs/rag/business/*
19670
+ - docs/rag/technical/*
19671
+ - docs/rag/constraints/*
19672
+
19673
+ agent_config:
19674
+ editable_sections:
19675
+ - Status
19676
+ - Story
19677
+ - Acceptance Criteria
19678
+ - Tasks / Subtasks
19679
+ - Dev Notes
19680
+ - Testing
19681
+ - Knowledge References
19682
+ - Change Log
19683
+
19684
+ sections:
19685
+ - id: status
19686
+ title: 状态
19687
+ type: choice
19688
+ choices: [Draft, Approved, InProgress, Review, Done]
19689
+ instruction: 选择此用户故事的当前状态
19690
+ owner: scrum-master
19691
+ editors: [scrum-master, po-agent, dev-agent]
19692
+
19693
+ - id: story
19694
+ title: 用户故事
19695
+ type: template-text
19696
+ template: |
19697
+ **作为** {{role}},
19698
+ **我希望** {{action}},
19699
+ **以便** {{benefit}}
19700
+ instruction: |
19701
+ 使用标准格式定义用户故事。
19702
+ - 角色来源: docs/rag/_analysis-report.md#用户分析
19703
+ - 功能来源: PRD/Epic 中的 Story 定义
19704
+ - 价值来源: 需求分析报告中的业务目标
19705
+ elicit: true
19706
+ owner: scrum-master
19707
+ editors: [scrum-master]
19708
+
19709
+ - id: acceptance-criteria
19710
+ title: 验收标准
19711
+ type: numbered-list
19712
+ instruction: |
19713
+ 从 Epic 文件中复制验收标准,并融合知识库内容增强:
19714
+
19715
+ **增强规则**:
19716
+ 1. 检查每个AC是否有对应的业务规则 (docs/rag/business/rules-*.md)
19717
+ - 如有,将业务规则细节融入AC
19718
+ - 标注来源: (来源: business/rules-{name}.md)
19719
+
19720
+ 2. 检查每个AC是否涉及约束条件 (docs/rag/constraints/)
19721
+ - 如有安全要求,添加安全约束
19722
+ - 如有性能要求,添加性能指标
19723
+ - 标注来源: (来源: constraints/{name}.md)
19724
+
19725
+ **示例**:
19726
+ 1. 用户可以创建订单
19727
+ - 订单状态初始为"待支付" (来源: business/rules-order.md)
19728
+ - 订单号格式: ORD{yyyyMMdd}{6位序号} (来源: business/rules-order.md)
19729
+ - 接口响应时间 < 500ms (来源: constraints/performance.md)
19730
+ elicit: true
19731
+ owner: scrum-master
19732
+ editors: [scrum-master]
19733
+
19734
+ - id: tasks-subtasks
19735
+ title: 任务 / 子任务
19736
+ type: bullet-list
19737
+ instruction: |
19738
+ 基于架构增量设计 (docs/architecture-increment.md) 生成详细任务。
19739
+
19740
+ **任务生成规则**:
19741
+
19742
+ 1. **数据层任务** (如Story涉及数据模型):
19743
+ 来源: architecture-increment.md#数据模型增量设计
19744
+ ```
19745
+ - [ ] 创建/修改数据模型 (AC: {相关AC})
19746
+ - [ ] 创建实体类 [参考: architecture-increment.md#entity-detail]
19747
+ - [ ] 执行DDL脚本 [参考: architecture-increment.md#ddl-script]
19748
+ - [ ] 创建Mapper/Repository [遵循: coding-standards/]
19749
+ ```
19750
+
19751
+ 2. **接口层任务** (如Story涉及API):
19752
+ 来源: architecture-increment.md#接口增量设计
19753
+ ```
19754
+ - [ ] 实现API接口 (AC: {相关AC})
19755
+ - [ ] 创建Controller [参考: architecture-increment.md#api-detail]
19756
+ - [ ] 实现参数校验 [遵循: coding-standards/]
19757
+ - [ ] 实现响应格式 [参考: architecture-increment.md#response-design]
19758
+ ```
19759
+
19760
+ 3. **业务层任务** (如Story涉及业务逻辑):
19761
+ 来源: architecture-increment.md#模块增量设计
19762
+ ```
19763
+ - [ ] 实现业务逻辑 (AC: {相关AC})
19764
+ - [ ] 创建Service类 [参考: architecture-increment.md#class-design]
19765
+ - [ ] 实现业务规则 [参考: business/rules-{name}.md]
19766
+ ```
19767
+
19768
+ 4. **中间件任务** (如Story涉及缓存/消息):
19769
+ 来源: architecture-increment.md#中间件增量设计
19770
+ ```
19771
+ - [ ] 实现缓存逻辑 (AC: {相关AC})
19772
+ - [ ] Redis实现 [参考: architecture-increment.md#redis-design]
19773
+ - [ ] 代码示例 [参考: middleware/redis.md]
19774
+ ```
19775
+
19776
+ 5. **测试任务**:
19777
+ ```
19778
+ - [ ] 编写测试用例 (AC: ALL)
19779
+ - [ ] 单元测试 [遵循: coding-standards/testing]
19780
+ - [ ] 集成测试(如需要)
19781
+ ```
19782
+ template: |
19783
+ - [ ] 任务 1 (AC: #) [参考: {knowledge_ref}]
19784
+ - [ ] 子任务 1.1 [遵循: {standard_ref}]
19785
+ - [ ] 任务 2 (AC: #) [参考: {knowledge_ref}]
19786
+ - [ ] 子任务 2.1 [遵循: {standard_ref}]
19787
+ elicit: true
19788
+ owner: scrum-master
19789
+ editors: [scrum-master, dev-agent]
19790
+
19791
+ - id: dev-notes
19792
+ title: 开发者说明
19793
+ instruction: |
19794
+ 整合知识库内容,为开发者提供完整的技术上下文。
19795
+
19796
+ **来源整合**:
19797
+ - 架构设计: docs/architecture-increment.md
19798
+ - 编码规范: docs/rag/technical/coding-standards/
19799
+ - 模块结构: docs/rag/technical/module-structure.md
19800
+ - 中间件规范: docs/rag/technical/middleware/
19801
+ - 业务规则: docs/rag/business/rules-*.md
19802
+ - 约束条件: docs/rag/constraints/
19803
+
19804
+ **填充规则**:
19805
+ - 每个技术细节必须标注来源
19806
+ - 提供足够上下文使开发者无需阅读原始文档
19807
+ - 包含相关代码示例引用
19808
+ elicit: true
19809
+ owner: scrum-master
19810
+ editors: [scrum-master]
19811
+ sections:
19812
+ - id: previous-story-insights
19813
+ title: 上一个Story洞察
19814
+ instruction: |
19815
+ 从上一个Story的Dev Agent Record中提取关键信息:
19816
+ - 技术决策和实现方式
19817
+ - 遇到的问题和解决方案
19818
+ - 对当前Story的建议
19819
+ owner: scrum-master
19820
+ editors: [scrum-master]
19821
+
19822
+ - id: architecture-reference
19823
+ title: 架构设计参考
19824
+ instruction: |
19825
+ 从 docs/architecture-increment.md 提取与当前Story相关的设计:
19826
+
19827
+ **模块设计** [参考: architecture-increment.md#module-design]
19828
+ - 包结构: {提取的包结构}
19829
+ - 核心类: {提取的类列表}
19830
+
19831
+ **数据模型** [参考: architecture-increment.md#data-model-design]
19832
+ - 表名: {table_name}
19833
+ - 核心字段: {fields}
19834
+ - DDL参考: {ddl_section_ref}
19835
+
19836
+ **接口设计** [参考: architecture-increment.md#api-design]
19837
+ - 路径: {api_path}
19838
+ - 方法: {http_method}
19839
+ - 请求/响应参考: {api_detail_ref}
19840
+
19841
+ **中间件设计** [参考: architecture-increment.md#middleware-design]
19842
+ - Redis设计: {redis_ref}
19843
+ - MQ设计: {mq_ref}
19844
+ owner: scrum-master
19845
+ editors: [scrum-master]
19846
+
19847
+ - id: business-rules
19848
+ title: 业务规则
19849
+ instruction: |
19850
+ 从 docs/rag/business/rules-*.md 提取与当前Story相关的业务规则:
19851
+
19852
+ [参考: business/rules-{name}.md]
19853
+ - 规则1: {rule_description}
19854
+ - 规则2: {rule_description}
19855
+
19856
+ 确保每条规则都标注来源文件。
19857
+ owner: scrum-master
19858
+ editors: [scrum-master]
19859
+
19860
+ - id: coding-standards
19861
+ title: 编码规范要点
19862
+ instruction: |
19863
+ 从 docs/rag/technical/coding-standards/ 提取关键规范:
19864
+
19865
+ [参考: coding-standards/]
19866
+ - 命名规范: {naming_rules}
19867
+ - 分层规范: {layer_rules}
19868
+ - 异常处理: {exception_rules}
19869
+ - 日志规范: {logging_rules}
19870
+ owner: scrum-master
19871
+ editors: [scrum-master]
19872
+
19873
+ - id: middleware-usage
19874
+ title: 中间件使用
19875
+ condition: Story涉及中间件
19876
+ instruction: |
19877
+ 从 docs/rag/technical/middleware/ 提取使用规范和代码示例:
19878
+
19879
+ **Redis** [参考: middleware/redis.md]
19880
+ - Key命名: {key_pattern}
19881
+ - 过期策略: {expiration}
19882
+ - 代码示例参考: middleware/redis.md#{section}
19883
+
19884
+ **MQ** [参考: middleware/mq.md]
19885
+ - Topic: {topic_name}
19886
+ - 消息格式: {message_format}
19887
+ - 代码示例参考: middleware/mq.md#{section}
19888
+ owner: scrum-master
19889
+ editors: [scrum-master]
19890
+
19891
+ - id: constraints
19892
+ title: 约束条件
19893
+ instruction: |
19894
+ 从 docs/rag/constraints/ 提取相关约束:
19895
+
19896
+ **安全要求** [参考: constraints/security.md]
19897
+ - {security_requirements}
19898
+
19899
+ **性能要求** [参考: constraints/performance.md]
19900
+ - {performance_requirements}
19901
+ owner: scrum-master
19902
+ editors: [scrum-master]
19903
+
19904
+ - id: file-locations
19905
+ title: 文件位置
19906
+ instruction: |
19907
+ 从 docs/rag/technical/module-structure.md 提取文件位置规范:
19908
+
19909
+ [参考: module-structure.md]
19910
+ - Controller: {path}
19911
+ - Service: {path}
19912
+ - Mapper/Repository: {path}
19913
+ - Entity: {path}
19914
+ - Test: {path}
19915
+ owner: scrum-master
19916
+ editors: [scrum-master]
19917
+
19918
+ - id: testing-standards
19919
+ title: 测试说明
19920
+ instruction: |
19921
+ 从 docs/rag/technical/coding-standards/ 提取测试规范:
19922
+
19923
+ [参考: coding-standards/testing]
19924
+ - 测试框架: {test_framework}
19925
+ - 测试文件位置: {test_file_location}
19926
+ - 测试场景:
19927
+ - 正常流程: {normal_scenarios}
19928
+ - 异常流程: {error_scenarios}
19929
+ - 边界条件: {edge_cases}
19930
+ elicit: true
19931
+ owner: scrum-master
19932
+ editors: [scrum-master]
19933
+
19934
+ - id: knowledge-references
19935
+ title: 知识引用索引
19936
+ instruction: |
19937
+ 记录Story中引用的所有知识文件,便于追溯和验证。
19938
+
19939
+ | 知识文件 | 引用章节 | 应用位置 |
19940
+ |----------|----------|----------|
19941
+ | docs/architecture-increment.md | 模块设计 | 任务列表、Dev Notes |
19942
+ | docs/rag/business/rules-*.md | 业务规则 | AC增强、业务逻辑任务 |
19943
+ | docs/rag/technical/coding-standards/ | 编码规范 | Dev Notes |
19944
+ | docs/rag/technical/middleware/*.md | 中间件示例 | 中间件任务 |
19945
+ | docs/rag/constraints/*.md | 约束条件 | AC约束 |
19946
+ type: table
19947
+ columns: [知识文件, 引用章节, 应用位置]
19948
+ owner: scrum-master
19949
+ editors: [scrum-master, dev-agent]
19950
+
19951
+ - id: change-log
19952
+ title: 变更日志
19953
+ type: table
19954
+ columns: [日期, 版本, 描述, 作者]
19955
+ instruction: 跟踪此用户故事文档的变更
19956
+ owner: scrum-master
19957
+ editors: [scrum-master, dev-agent, qa-agent]
19958
+
19959
+ - id: dev-agent-record
19960
+ title: 开发者代理记录
19961
+ instruction: 此部分由开发代理在实施过程中填充
19962
+ owner: dev-agent
19963
+ editors: [dev-agent]
19964
+ sections:
19965
+ - id: agent-model
19966
+ title: 使用的代理模型
19967
+ template: "{{agent_model_name_version}}"
19968
+ instruction: 记录用于开发的特定 AI 代理模型和版本
19969
+ owner: dev-agent
19970
+ editors: [dev-agent]
19971
+
19972
+ - id: debug-log-references
19973
+ title: 调试日志参考
19974
+ instruction: 引用开发过程中生成的任何调试日志或跟踪信息
19975
+ owner: dev-agent
19976
+ editors: [dev-agent]
19977
+
19978
+ - id: completion-notes
19979
+ title: 完成说明列表
19980
+ instruction: 关于任务完成情况和遇到的任何问题的说明
19981
+ owner: dev-agent
19982
+ editors: [dev-agent]
19983
+
19984
+ - id: file-list
19985
+ title: 文件列表
19986
+ instruction: 列出在用户故事实施过程中创建、修改或影响的所有文件
19987
+ owner: dev-agent
19988
+ editors: [dev-agent]
19989
+
19990
+ - id: knowledge-usage-record
19991
+ title: 知识使用记录
19992
+ instruction: |
19993
+ 记录实际开发中使用的知识文件和参考内容:
19994
+ | 知识文件 | 使用内容 | 应用代码位置 |
19995
+ |----------|----------|--------------|
19996
+ type: table
19997
+ columns: [知识文件, 使用内容, 应用代码位置]
19998
+ owner: dev-agent
19999
+ editors: [dev-agent]
20000
+
20001
+ - id: qa-results
20002
+ title: QA 结果
20003
+ instruction: QA 代理对已完成的用户故事实施进行 QA 审查的结果
20004
+ owner: qa-agent
20005
+ editors: [qa-agent]
20006
+ ==================== END: .xiaoma-core/templates/story-with-rag-tmpl.yaml ====================
20007
+
16432
20008
  ==================== START: .xiaoma-core/templates/enhanced-story-with-database-tmpl.yaml ====================
16433
20009
  template:
16434
20010
  id: enhanced-story-with-database-template-v1