@zeyue0329/xiaoma-cli 1.0.42 → 1.0.44

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.
Files changed (37) hide show
  1. package/.idea/workspace.xml +2 -7
  2. package/JAVA-BACKEND-COMMANDS-REFERENCE.md +2 -2
  3. package/JAVA-BACKEND-ITERATION-GUIDE.md +31 -31
  4. package/dist/agents/analyst.txt +1514 -0
  5. package/dist/agents/architect.txt +1 -1
  6. package/dist/agents/pm.txt +20 -20
  7. package/dist/agents/po.txt +1 -1
  8. package/dist/agents/sm.txt +1 -1
  9. package/dist/agents/workflow-executor.txt +22 -22
  10. package/dist/agents/xiaoma-master.txt +20 -20
  11. package/dist/teams/team-all.txt +1640 -331
  12. package/dist/teams/team-fullstack-with-database.txt +1616 -307
  13. package/dist/teams/team-fullstack.txt +1618 -309
  14. package/dist/teams/team-ide-minimal.txt +2 -2
  15. package/dist/teams/team-no-ui.txt +1618 -309
  16. package/docs/architecture-sharding-modification.md +4 -4
  17. package/docs/automated-requirements-analysis-outputs.md +29 -29
  18. package/docs/prd/workflow-coordinator-prd.md +2 -2
  19. package/package.json +1 -1
  20. package/xiaoma-core/agents/analyst.md +8 -0
  21. package/xiaoma-core/agents/pm.md +1 -1
  22. package/xiaoma-core/agents/po.md +1 -1
  23. package/xiaoma-core/agents/requirements-coverage-auditor.yaml +1 -1
  24. package/xiaoma-core/agents/sm.md +1 -1
  25. package/xiaoma-core/agents/workflow-executor.md +22 -22
  26. package/xiaoma-core/tasks/batch-story-generation.md +1 -1
  27. package/xiaoma-core/tasks/requirement-analysis-with-rag.md +352 -0
  28. package/xiaoma-core/tasks/requirements-coverage-audit.md +5 -5
  29. package/xiaoma-core/templates/fullstack-architecture-tmpl.yaml +1 -1
  30. package/xiaoma-core/templates/prd-tmpl.yaml +19 -19
  31. package/xiaoma-core/templates/rag-knowledge-tmpl.yaml +569 -0
  32. package/xiaoma-core/templates/rag-questions-tmpl.yaml +371 -0
  33. package/xiaoma-core/templates/requirements-coverage-audit.yaml +6 -6
  34. package/xiaoma-core/workflows/automated-requirements-analysis.yaml +90 -90
  35. package/xiaoma-core/workflows/automated-requirements-development.yaml +10 -10
  36. package/xiaoma-core/workflows/enhanced-fullstack-with-qa-loop.yaml +1 -1
  37. package/xiaoma-core/workflows/full-requirement-automation.yaml +1 -1
@@ -235,6 +235,10 @@ commands:
235
235
  - elicit: 运行任务 advanced-elicitation
236
236
  - perform-market-research: 使用任务 create-doc 和 market-research-tmpl.yaml
237
237
  - research-prompt {topic}: 执行任务 create-deep-research-prompt.md
238
+ - analyze-requirement {req_file}: 基于需求文档进行RAG增强的需求分析 (运行任务 requirement-analysis-with-rag.md)
239
+ - generate-rag-questions {req_file}: 根据需求文档生成知识库查询问题清单 (使用模板 rag-questions-tmpl.yaml)
240
+ - land-knowledge: 将知识库返回的内容结构化存储到docs/rag目录 (使用模板 rag-knowledge-tmpl.yaml)
241
+ - create-prd-from-rag: 基于docs/rag知识和需求文档生成PRD (使用任务 create-doc 和 prd-tmpl.yaml)
238
242
  - yolo: 切换 Yolo 模式
239
243
  - exit: 作为业务分析师道别,然后放弃扮演此角色
240
244
  dependencies:
@@ -247,11 +251,15 @@ dependencies:
247
251
  - create-doc.md
248
252
  - document-project.md
249
253
  - facilitate-brainstorming-session.md
254
+ - requirement-analysis-with-rag.md
250
255
  templates:
251
256
  - brainstorming-output-tmpl.yaml
252
257
  - competitor-analysis-tmpl.yaml
253
258
  - market-research-tmpl.yaml
254
259
  - project-brief-tmpl.yaml
260
+ - rag-questions-tmpl.yaml
261
+ - rag-knowledge-tmpl.yaml
262
+ - prd-tmpl.yaml
255
263
  ```
256
264
  ==================== END: .xiaoma-core/agents/analyst.md ====================
257
265
 
@@ -292,7 +300,7 @@ commands:
292
300
  - create-brownfield-epic: 运行任务 brownfield-create-epic.md
293
301
  - create-brownfield-prd: 使用模板 brownfield-prd-tmpl.yaml 运行任务 create-doc.md
294
302
  - create-brownfield-story: 运行任务 brownfield-create-story.md
295
- - create-epic: 为现有项目项目创建史诗 (任务 brownfield-create-epic)
303
+ - create-epic: 为现有项目项目创建模块 (任务 brownfield-create-epic)
296
304
  - create-prd: 使用模板 prd-tmpl.yaml 运行任务 create-doc.md
297
305
  - create-story: 从需求创建用户故事 (任务 brownfield-create-story)
298
306
  - doc-out: 将完整文档输出到当前目标文件
@@ -472,7 +480,7 @@ persona:
472
480
  commands:
473
481
  - help: 显示以下命令的编号列表以供选择
474
482
  - correct-course: 执行 correct-course 任务
475
- - create-epic: 为现有项目项目创建史诗 (任务 brownfield-create-epic)
483
+ - create-epic: 为现有项目项目创建模块 (任务 brownfield-create-epic)
476
484
  - create-story: 从需求创建用户故事 (任务 brownfield-create-story)
477
485
  - doc-out: 将完整文档输出到当前目标文件
478
486
  - execute-checklist-po: 运行任务 execute-checklist (清单 po-master-checklist)
@@ -2619,6 +2627,361 @@ Generate structured document with these sections:
2619
2627
  - Respect their process and timing
2620
2628
  ==================== END: .xiaoma-core/tasks/facilitate-brainstorming-session.md ====================
2621
2629
 
2630
+ ==================== START: .xiaoma-core/tasks/requirement-analysis-with-rag.md ====================
2631
+ <!-- Powered by XiaoMa™ Core -->
2632
+
2633
+ # 基于知识库的需求分析任务
2634
+
2635
+ ## Purpose
2636
+
2637
+ 通过结合外部需求文档(req.txt)和知识库(RAG/MCP)进行深度需求分析,生成高质量的PRD文档。
2638
+
2639
+ ## Workflow Overview
2640
+
2641
+ ```
2642
+ req.txt → 问题生成 → 知识库查询 → 知识落地(docs/rag/) → 需求分析 → PRD生成
2643
+ ```
2644
+
2645
+ ## Phase 1: 需求文档解析与问题生成
2646
+
2647
+ ### 1.1 需求文档初步解析
2648
+
2649
+ 首先读取并分析 req.txt 文档,识别以下关键信息:
2650
+
2651
+ ```yaml
2652
+ 解析维度:
2653
+ 业务领域: 识别需求所属的业务领域和子领域
2654
+ 核心功能: 提取需求描述的主要功能点
2655
+ 用户角色: 识别涉及的用户类型和角色
2656
+ 业务流程: 提取隐含或显式的业务流程
2657
+ 数据实体: 识别涉及的数据对象和关系
2658
+ 集成点: 识别与外部系统的交互需求
2659
+ 约束条件: 提取技术、业务、时间等约束
2660
+ 模糊点: 标记需要澄清的不明确内容
2661
+ ```
2662
+
2663
+ ### 1.2 知识库问题生成框架
2664
+
2665
+ 基于解析结果,生成以下类别的问题向知识库查询:
2666
+
2667
+ ---
2668
+
2669
+ ## Phase 2: 知识库提问清单模板
2670
+
2671
+ ### 类别 A: 业务知识查询
2672
+
2673
+ #### A1. 业务领域背景
2674
+ ```
2675
+ 问题模板:
2676
+ - "关于[业务领域],现有系统中有哪些相关的业务规则和约束?"
2677
+ - "[业务流程名称]的完整流程是什么?包括哪些步骤和参与者?"
2678
+ - "在[业务场景]中,有哪些已知的边界情况和异常处理逻辑?"
2679
+ - "[业务概念A]和[业务概念B]之间的关系是什么?"
2680
+ ```
2681
+
2682
+ #### A2. 现有功能调研
2683
+ ```
2684
+ 问题模板:
2685
+ - "系统中是否已存在类似[功能描述]的功能?如果有,实现方式是什么?"
2686
+ - "[模块名称]目前支持哪些操作?有什么限制?"
2687
+ - "用户当前如何完成[业务目标]?现有流程有什么痛点?"
2688
+ ```
2689
+
2690
+ #### A3. 业务规则确认
2691
+ ```
2692
+ 问题模板:
2693
+ - "[数据实体]的业务规则有哪些?例如:必填字段、取值范围、状态流转规则"
2694
+ - "[操作A]在什么条件下可以执行?有哪些前置条件?"
2695
+ - "不同[用户角色]在[功能]上的权限差异是什么?"
2696
+ ```
2697
+
2698
+ ---
2699
+
2700
+ ### 类别 B: 技术知识查询
2701
+
2702
+ #### B1. 系统架构
2703
+ ```
2704
+ 问题模板:
2705
+ - "现有系统的技术架构是什么?使用了哪些核心框架和技术栈?"
2706
+ - "[模块名称]的代码结构和目录组织是怎样的?"
2707
+ - "系统的数据库设计采用什么模式?主要的数据表有哪些?"
2708
+ - "系统中有哪些公共组件和工具类可以复用?"
2709
+ ```
2710
+
2711
+ #### B2. 接口与集成
2712
+ ```
2713
+ 问题模板:
2714
+ - "与[外部系统]的集成接口是什么?数据格式和协议是什么?"
2715
+ - "系统提供了哪些API接口?[功能相关]的接口规范是什么?"
2716
+ - "现有的消息队列/事件机制是如何设计的?"
2717
+ ```
2718
+
2719
+ #### B3. 数据模型
2720
+ ```
2721
+ 问题模板:
2722
+ - "[数据实体]在数据库中的表结构是什么?包含哪些字段?"
2723
+ - "[实体A]和[实体B]之间的数据库关系是怎样的?"
2724
+ - "系统中有哪些枚举值或字典表与[业务领域]相关?"
2725
+ ```
2726
+
2727
+ #### B4. 代码实现参考
2728
+ ```
2729
+ 问题模板:
2730
+ - "类似[功能]的实现在代码中是如何组织的?请提供示例代码位置"
2731
+ - "[技术方案]在现有代码中有没有参考实现?"
2732
+ - "系统中处理[技术问题]的通用模式是什么?"
2733
+ ```
2734
+
2735
+ ---
2736
+
2737
+ ### 类别 C: 历史需求与变更
2738
+
2739
+ #### C1. 相关需求追溯
2740
+ ```
2741
+ 问题模板:
2742
+ - "之前有没有类似[需求描述]的需求?实现情况如何?"
2743
+ - "[功能模块]的历史变更记录有哪些?最近的改动是什么?"
2744
+ - "有没有与[需求]相关的已知问题或技术债务?"
2745
+ ```
2746
+
2747
+ #### C2. 决策记录
2748
+ ```
2749
+ 问题模板:
2750
+ - "[技术方案]为什么选择了当前的实现方式?有什么历史背景?"
2751
+ - "[设计决策]有没有相关的ADR(架构决策记录)?"
2752
+ ```
2753
+
2754
+ ---
2755
+
2756
+ ### 类别 D: 上下文与约束
2757
+
2758
+ #### D1. 项目约束
2759
+ ```
2760
+ 问题模板:
2761
+ - "项目的技术栈限制有哪些?必须遵循的技术规范是什么?"
2762
+ - "项目的安全合规要求有哪些?"
2763
+ - "项目的性能要求和SLA标准是什么?"
2764
+ ```
2765
+
2766
+ #### D2. 团队规范
2767
+ ```
2768
+ 问题模板:
2769
+ - "团队的代码规范和开发流程是什么?"
2770
+ - "团队的测试要求和代码审查标准是什么?"
2771
+ - "项目的部署流程和环境配置是怎样的?"
2772
+ ```
2773
+
2774
+ ---
2775
+
2776
+ ## Phase 3: 问题生成执行流程
2777
+
2778
+ ### 3.1 智能问题生成
2779
+
2780
+ ```yaml
2781
+ 执行步骤:
2782
+ 步骤1_解析需求:
2783
+ 输入: req.txt
2784
+ 动作: 提取关键实体、流程、约束
2785
+ 输出: 需求要素清单
2786
+
2787
+ 步骤2_映射问题类别:
2788
+ 输入: 需求要素清单
2789
+ 动作: 将每个要素映射到问题类别(A/B/C/D)
2790
+ 输出: 问题类别映射表
2791
+
2792
+ 步骤3_生成具体问题:
2793
+ 输入: 问题类别映射表 + 问题模板
2794
+ 动作: 用具体内容填充模板生成问题
2795
+ 输出: 知识库查询问题清单
2796
+
2797
+ 步骤4_问题优先级排序:
2798
+ 优先级规则:
2799
+ P0_阻塞级: 缺失会导致无法理解需求的核心问题
2800
+ P1_重要级: 影响需求完整性的问题
2801
+ P2_补充级: 有助于优化实现的问题
2802
+ ```
2803
+
2804
+ ### 3.2 问题清单输出格式
2805
+
2806
+ ```markdown
2807
+ # 知识库查询问题清单
2808
+
2809
+ ## 基本信息
2810
+ - 需求文档: req.txt
2811
+ - 生成时间: {{timestamp}}
2812
+ - 问题总数: {{total_count}}
2813
+
2814
+ ## P0 阻塞级问题 (必须回答)
2815
+
2816
+ ### 业务知识
2817
+ 1. [A1-001] {{具体问题}}
2818
+ - 关联需求点: {{需求中的相关描述}}
2819
+ - 预期答案类型: {{期望获得的信息类型}}
2820
+
2821
+ ### 技术知识
2822
+ 2. [B1-001] {{具体问题}}
2823
+ - 关联需求点: {{需求中的相关描述}}
2824
+ - 预期答案类型: {{期望获得的信息类型}}
2825
+
2826
+ ## P1 重要级问题 (建议回答)
2827
+ ...
2828
+
2829
+ ## P2 补充级问题 (可选回答)
2830
+ ...
2831
+ ```
2832
+
2833
+ ---
2834
+
2835
+ ## Phase 4: 知识落地与组织
2836
+
2837
+ ### 4.1 知识存储结构
2838
+
2839
+ ```
2840
+ docs/rag/
2841
+ ├── _index.md # 知识索引文件
2842
+ ├── business/ # 业务知识
2843
+ │ ├── domain-rules.md # 业务规则
2844
+ │ ├── processes.md # 业务流程
2845
+ │ └── entities.md # 业务实体
2846
+ ├── technical/ # 技术知识
2847
+ │ ├── architecture.md # 系统架构
2848
+ │ ├── data-model.md # 数据模型
2849
+ │ ├── apis.md # 接口规范
2850
+ │ └── code-patterns.md # 代码模式
2851
+ ├── history/ # 历史信息
2852
+ │ ├── related-requirements.md # 相关需求
2853
+ │ └── decisions.md # 决策记录
2854
+ └── constraints/ # 约束条件
2855
+ ├── technical.md # 技术约束
2856
+ └── compliance.md # 合规要求
2857
+ ```
2858
+
2859
+ ### 4.2 知识文档格式
2860
+
2861
+ ```markdown
2862
+ # {{知识标题}}
2863
+
2864
+ ## 元信息
2865
+ - 来源: 知识库MCP查询
2866
+ - 查询问题: {{原始问题}}
2867
+ - 查询时间: {{timestamp}}
2868
+ - 置信度: {{high/medium/low}}
2869
+
2870
+ ## 内容摘要
2871
+ {{一句话总结}}
2872
+
2873
+ ## 详细内容
2874
+ {{知识库返回的完整内容}}
2875
+
2876
+ ## 与需求的关联
2877
+ - 关联需求点: {{req.txt中的相关内容}}
2878
+ - 影响分析: {{这个知识如何影响需求实现}}
2879
+
2880
+ ## 后续问题
2881
+ {{基于此知识产生的新问题(如有)}}
2882
+ ```
2883
+
2884
+ ---
2885
+
2886
+ ## Phase 5: 需求分析与PRD生成
2887
+
2888
+ ### 5.1 分析输入整合
2889
+
2890
+ ```yaml
2891
+ 分析输入:
2892
+ 主要输入:
2893
+ - req.txt: 原始需求文档
2894
+ - docs/rag/*: 知识库查询结果
2895
+ 辅助输入:
2896
+ - 项目简报(如存在): docs/brief.md
2897
+ - 技术偏好(如存在): data/technical-preferences.yaml
2898
+ ```
2899
+
2900
+ ### 5.2 需求分析维度
2901
+
2902
+ ```yaml
2903
+ 分析维度:
2904
+ 功能分析:
2905
+ - 核心功能拆解
2906
+ - 功能优先级排序
2907
+ - 功能依赖关系
2908
+
2909
+ 用户分析:
2910
+ - 用户角色定义
2911
+ - 用户旅程映射
2912
+ - 用户价值主张
2913
+
2914
+ 技术分析:
2915
+ - 技术可行性评估
2916
+ - 与现有系统的兼容性
2917
+ - 技术风险识别
2918
+
2919
+ 业务分析:
2920
+ - 业务规则验证
2921
+ - 业务流程优化机会
2922
+ - 业务价值量化
2923
+
2924
+ 差距分析:
2925
+ - 现有能力 vs 需求能力
2926
+ - 需要新增/修改的功能
2927
+ - 需要新增/修改的数据
2928
+ ```
2929
+
2930
+ ### 5.3 PRD生成流程
2931
+
2932
+ ```yaml
2933
+ PRD生成:
2934
+ 步骤1:
2935
+ 动作: 整合所有知识输入
2936
+ 输出: 知识上下文汇总
2937
+
2938
+ 步骤2:
2939
+ 动作: 执行需求分析(5.2维度)
2940
+ 输出: 需求分析报告
2941
+
2942
+ 步骤3:
2943
+ 动作: 套用PRD模板(prd-tmpl.yaml)
2944
+ 输出: PRD草稿
2945
+
2946
+ 步骤4:
2947
+ 动作: 启发式验证(advanced-elicitation)
2948
+ 输出: 优化后的PRD
2949
+
2950
+ 步骤5:
2951
+ 动作: 输出最终PRD到指定位置
2952
+ 输出: docs/prd.md
2953
+ ```
2954
+
2955
+ ---
2956
+
2957
+ ## 使用说明
2958
+
2959
+ ### 智能体激活命令
2960
+
2961
+ ```
2962
+ *analyze-requirement {req_file}
2963
+ ```
2964
+
2965
+ ### 执行参数
2966
+
2967
+ ```yaml
2968
+ 参数:
2969
+ req_file: 需求文档路径 (默认: req.txt)
2970
+ rag_output: 知识输出路径 (默认: docs/rag/)
2971
+ prd_output: PRD输出路径 (默认: docs/prd.md)
2972
+ skip_rag: 跳过知识库查询 (默认: false)
2973
+ interactive: 交互模式 (默认: true)
2974
+ ```
2975
+
2976
+ ### 交互模式流程
2977
+
2978
+ 1. **解析阶段**: 展示需求解析结果,请用户确认
2979
+ 2. **提问阶段**: 展示问题清单,请用户确认或调整
2980
+ 3. **查询阶段**: 依次查询知识库,展示返回结果
2981
+ 4. **分析阶段**: 展示分析结论,请用户确认
2982
+ 5. **生成阶段**: 生成PRD草稿,启用启发式优化
2983
+ ==================== END: .xiaoma-core/tasks/requirement-analysis-with-rag.md ====================
2984
+
2622
2985
  ==================== START: .xiaoma-core/templates/brainstorming-output-tmpl.yaml ====================
2623
2986
  template:
2624
2987
  id: brainstorming-output-template-v2
@@ -3596,158 +3959,1309 @@ sections:
3596
3959
  这份项目简报为 {{project_name}} 提供了完整的背景信息。请启动‘PRD 生成模式’,彻底审阅此简报,并与用户合作,按照模板指示逐节创建 PRD,同时请求任何必要的澄清或提出改进建议。
3597
3960
  ==================== END: .xiaoma-core/templates/project-brief-tmpl.yaml ====================
3598
3961
 
3599
- ==================== START: .xiaoma-core/data/brainstorming-techniques.md ====================
3600
- <!-- Powered by XiaoMa™ Core -->
3962
+ ==================== START: .xiaoma-core/templates/rag-questions-tmpl.yaml ====================
3963
+ template:
3964
+ id: rag-questions-template-v1
3965
+ name: 知识库问题生成模板
3966
+ version: 1.0
3967
+ description: 基于需求文档(req.txt)生成知识库MCP查询问题
3968
+ output:
3969
+ format: markdown
3970
+ filename: docs/rag-questions.md
3971
+ title: "知识库查询问题清单"
3601
3972
 
3602
- # Brainstorming Techniques Data
3973
+ workflow:
3974
+ mode: interactive
3975
+ phases:
3976
+ - 需求解析
3977
+ - 问题生成
3978
+ - 问题确认
3979
+ - 知识库查询
3980
+ - 知识落地
3603
3981
 
3604
- ## Creative Expansion
3982
+ sections:
3983
+ - id: requirement-parsing
3984
+ title: 第一阶段:需求文档解析
3985
+ instruction: |
3986
+ 读取并深度分析 req.txt 文档,提取以下要素:
3987
+
3988
+ 1. **业务领域识别**
3989
+ - 这个需求属于什么业务领域?(如:订单管理、用户管理、支付系统等)
3990
+ - 涉及哪些子领域或模块?
3991
+
3992
+ 2. **功能点提取**
3993
+ - 需求描述了哪些具体功能?
3994
+ - 每个功能的输入、处理、输出是什么?
3995
+
3996
+ 3. **用户角色识别**
3997
+ - 涉及哪些用户角色?(如:管理员、普通用户、访客)
3998
+ - 每个角色在此需求中的操作是什么?
3999
+
4000
+ 4. **数据实体识别**
4001
+ - 涉及哪些数据对象?(如:订单、商品、用户)
4002
+ - 数据之间的关系是什么?
4003
+
4004
+ 5. **业务流程识别**
4005
+ - 描述了什么业务流程?
4006
+ - 流程的起点、终点、关键步骤是什么?
4007
+
4008
+ 6. **模糊点标记**
4009
+ - 哪些描述不够清晰?
4010
+ - 哪些内容有多种理解方式?
4011
+ output:
4012
+ format: yaml
4013
+ template: |
4014
+ 需求解析结果:
4015
+ 业务领域: {{domain}}
4016
+ 子领域: [{{sub_domains}}]
4017
+
4018
+ 功能点:
4019
+ {{#each features}}
4020
+ - 名称: {{name}}
4021
+ 描述: {{description}}
4022
+ 输入: {{input}}
4023
+ 输出: {{output}}
4024
+ {{/each}}
4025
+
4026
+ 用户角色:
4027
+ {{#each roles}}
4028
+ - 角色: {{name}}
4029
+ 操作: [{{actions}}]
4030
+ {{/each}}
4031
+
4032
+ 数据实体:
4033
+ {{#each entities}}
4034
+ - 实体: {{name}}
4035
+ 属性: [{{attributes}}]
4036
+ 关系: {{relationships}}
4037
+ {{/each}}
4038
+
4039
+ 业务流程:
4040
+ {{#each processes}}
4041
+ - 流程: {{name}}
4042
+ 步骤: [{{steps}}]
4043
+ {{/each}}
4044
+
4045
+ 模糊点:
4046
+ {{#each ambiguities}}
4047
+ - 位置: {{location}}
4048
+ 内容: {{content}}
4049
+ 可能理解: [{{interpretations}}]
4050
+ {{/each}}
4051
+
4052
+ - id: question-generation
4053
+ title: 第二阶段:问题生成
4054
+ instruction: |
4055
+ 基于解析结果,为每个要素生成具体的知识库查询问题。
3605
4056
 
3606
- 1. **What If Scenarios**: Ask one provocative question, get their response, then ask another
3607
- 2. **Analogical Thinking**: Give one example analogy, ask them to find 2-3 more
3608
- 3. **Reversal/Inversion**: Pose the reverse question, let them work through it
3609
- 4. **First Principles Thinking**: Ask "What are the fundamentals?" and guide them to break it down
4057
+ **问题生成原则**:
4058
+ 1. 每个问题必须具体、可回答
4059
+ 2. 优先生成阻塞性问题(缺失会导致无法继续)
4060
+ 3. 问题应覆盖:业务、技术、历史、约束 四个维度
4061
+ 4. 避免开放性过强的问题
4062
+ sections:
4063
+ - id: business-questions
4064
+ title: A. 业务知识问题
4065
+ instruction: |
4066
+ 针对业务领域和流程生成问题,重点关注:
4067
+ - 业务规则和约束
4068
+ - 业务流程细节
4069
+ - 边界情况处理
4070
+ - 用户权限和角色
4071
+ question_templates:
4072
+ - category: A1-业务规则
4073
+ templates:
4074
+ - "[{entity}]有哪些业务规则?如:状态流转、必填约束、取值范围"
4075
+ - "[{process}]流程中,[{step}]步骤的具体业务规则是什么?"
4076
+ - "[{role}]角色在[{operation}]操作上有什么权限限制?"
4077
+ - "[{entity}]和[{related_entity}]之间的业务关联规则是什么?"
4078
+
4079
+ - category: A2-业务流程
4080
+ templates:
4081
+ - "[{process}]的完整流程是什么?包括正常流程和异常流程"
4082
+ - "触发[{process}]的条件有哪些?"
4083
+ - "[{process}]流程中有哪些人工审批或确认节点?"
4084
+ - "[{process}]失败后的补偿或回退机制是什么?"
4085
+
4086
+ - category: A3-边界情况
4087
+ templates:
4088
+ - "[{operation}]操作在什么情况下会失败?失败后如何处理?"
4089
+ - "[{entity}]存在并发操作时,系统如何处理冲突?"
4090
+ - "[{data}]数据量很大时,有什么限制或分页规则?"
4091
+ - "[{scenario}]场景下的异常处理逻辑是什么?"
4092
+
4093
+ - id: technical-questions
4094
+ title: B. 技术知识问题
4095
+ instruction: |
4096
+ 针对技术实现生成问题,重点关注:
4097
+ - 现有系统架构
4098
+ - 数据模型设计
4099
+ - 接口规范
4100
+ - 代码实现模式
4101
+ question_templates:
4102
+ - category: B1-系统架构
4103
+ templates:
4104
+ - "[{module}]模块的技术架构是什么?与其他模块如何交互?"
4105
+ - "系统中有哪些公共服务或组件可以复用于[{feature}]?"
4106
+ - "[{functionality}]功能应该放在哪个服务/模块中实现?"
4107
+ - "系统的缓存策略是什么?[{data}]数据需要缓存吗?"
4108
+
4109
+ - category: B2-数据模型
4110
+ templates:
4111
+ - "[{entity}]在数据库中的表结构是什么?包含哪些字段?"
4112
+ - "[{entity_a}]和[{entity_b}]的数据库关系是怎样的?外键设计?"
4113
+ - "与[{domain}]相关的枚举值或字典表有哪些?"
4114
+ - "[{entity}]的历史记录/审计日志如何存储?"
4115
+
4116
+ - category: B3-接口规范
4117
+ templates:
4118
+ - "现有的[{module}]模块提供了哪些API接口?"
4119
+ - "[{operation}]操作的接口入参和出参规范是什么?"
4120
+ - "系统的统一错误码和响应格式是什么?"
4121
+ - "[{external_system}]的集成接口协议和数据格式是什么?"
4122
+
4123
+ - category: B4-代码实现
4124
+ templates:
4125
+ - "类似[{feature}]的功能在现有代码中是如何实现的?"
4126
+ - "系统中处理[{technical_concern}]的通用模式是什么?"
4127
+ - "[{framework}]框架在项目中的使用规范和最佳实践是什么?"
4128
+ - "现有代码中有哪些工具类或辅助方法可以用于[{task}]?"
4129
+
4130
+ - id: history-questions
4131
+ title: C. 历史追溯问题
4132
+ instruction: |
4133
+ 针对历史需求和决策生成问题,重点关注:
4134
+ - 相关历史需求
4135
+ - 技术决策记录
4136
+ - 已知问题和债务
4137
+ question_templates:
4138
+ - category: C1-历史需求
4139
+ templates:
4140
+ - "之前有没有类似[{feature}]的需求?实现情况如何?"
4141
+ - "[{module}]模块最近有什么变更?变更原因是什么?"
4142
+ - "[{feature}]功能的历史版本迭代情况是什么?"
4143
+
4144
+ - category: C2-决策记录
4145
+ templates:
4146
+ - "[{technical_choice}]为什么选择当前的实现方式?"
4147
+ - "[{architecture_decision}]的架构决策背景是什么?"
4148
+ - "有没有被否决的[{alternative}]方案?为什么被否决?"
4149
+
4150
+ - category: C3-已知问题
4151
+ templates:
4152
+ - "[{module}]模块有哪些已知的问题或技术债务?"
4153
+ - "[{feature}]功能有没有用户反馈的问题或改进建议?"
4154
+ - "与[{domain}]相关的性能或稳定性问题有哪些?"
4155
+
4156
+ - id: constraint-questions
4157
+ title: D. 约束条件问题
4158
+ instruction: |
4159
+ 针对项目和技术约束生成问题,重点关注:
4160
+ - 技术栈限制
4161
+ - 安全合规要求
4162
+ - 性能要求
4163
+ - 团队规范
4164
+ question_templates:
4165
+ - category: D1-技术约束
4166
+ templates:
4167
+ - "项目的技术栈限制有哪些?必须使用什么框架/库?"
4168
+ - "[{technical_approach}]方案在当前技术栈下是否可行?"
4169
+ - "项目对[{resource}]资源的使用有什么限制?"
4170
+
4171
+ - category: D2-安全合规
4172
+ templates:
4173
+ - "[{data_type}]数据的安全存储和传输要求是什么?"
4174
+ - "[{operation}]操作需要哪些权限验证?"
4175
+ - "项目需要满足哪些合规要求?(如GDPR、等保)"
4176
+
4177
+ - category: D3-性能要求
4178
+ templates:
4179
+ - "[{interface}]接口的响应时间要求是什么?"
4180
+ - "[{process}]流程的并发处理能力要求是多少?"
4181
+ - "系统的可用性SLA要求是什么?"
4182
+
4183
+ - category: D4-团队规范
4184
+ templates:
4185
+ - "团队的代码规范和风格指南是什么?"
4186
+ - "代码审查的标准和流程是什么?"
4187
+ - "测试覆盖率和测试类型的要求是什么?"
4188
+
4189
+ - id: question-prioritization
4190
+ title: 第三阶段:问题优先级排序
4191
+ instruction: |
4192
+ 对生成的问题进行优先级排序:
4193
+
4194
+ **P0 - 阻塞级**(必须回答)
4195
+ - 缺失会导致完全无法理解需求
4196
+ - 涉及核心业务规则
4197
+ - 影响架构决策
4198
+
4199
+ **P1 - 重要级**(强烈建议回答)
4200
+ - 影响需求完整性
4201
+ - 涉及边界情况处理
4202
+ - 影响实现方案选择
4203
+
4204
+ **P2 - 补充级**(可选回答)
4205
+ - 有助于优化实现
4206
+ - 提供额外上下文
4207
+ - 历史参考信息
4208
+ output:
4209
+ format: markdown
4210
+ template: |
4211
+ # 知识库查询问题清单
4212
+
4213
+ ## 元信息
4214
+ - 源文档: req.txt
4215
+ - 生成时间: {{timestamp}}
4216
+ - 总问题数: {{total_count}}
4217
+ - P0问题: {{p0_count}} | P1问题: {{p1_count}} | P2问题: {{p2_count}}
4218
+
4219
+ ---
4220
+
4221
+ ## P0 阻塞级问题(必须回答)
4222
+
4223
+ ### 业务知识
4224
+ {{#each p0_business}}
4225
+ {{index}}. [{{id}}] {{question}}
4226
+ - 关联需求: "{{related_requirement}}"
4227
+ - 预期答案: {{expected_answer_type}}
4228
+ {{/each}}
4229
+
4230
+ ### 技术知识
4231
+ {{#each p0_technical}}
4232
+ {{index}}. [{{id}}] {{question}}
4233
+ - 关联需求: "{{related_requirement}}"
4234
+ - 预期答案: {{expected_answer_type}}
4235
+ {{/each}}
4236
+
4237
+ ---
4238
+
4239
+ ## P1 重要级问题(强烈建议回答)
4240
+
4241
+ ### 业务知识
4242
+ {{#each p1_business}}
4243
+ {{index}}. [{{id}}] {{question}}
4244
+ - 关联需求: "{{related_requirement}}"
4245
+ {{/each}}
4246
+
4247
+ ### 技术知识
4248
+ {{#each p1_technical}}
4249
+ {{index}}. [{{id}}] {{question}}
4250
+ - 关联需求: "{{related_requirement}}"
4251
+ {{/each}}
4252
+
4253
+ ### 历史追溯
4254
+ {{#each p1_history}}
4255
+ {{index}}. [{{id}}] {{question}}
4256
+ - 关联需求: "{{related_requirement}}"
4257
+ {{/each}}
4258
+
4259
+ ---
4260
+
4261
+ ## P2 补充级问题(可选回答)
4262
+
4263
+ {{#each p2_questions}}
4264
+ {{index}}. [{{id}}] {{question}}
4265
+ {{/each}}
4266
+
4267
+ - id: knowledge-landing
4268
+ title: 第四阶段:知识落地规范
4269
+ instruction: |
4270
+ 知识库返回的内容应按以下结构存储到 docs/rag/ 目录:
4271
+ output:
4272
+ structure: |
4273
+ docs/rag/
4274
+ ├── _index.md # 知识索引(自动生成)
4275
+ ├── _questions.md # 问题清单(本模板输出)
4276
+
4277
+ ├── business/ # 业务知识
4278
+ │ ├── domain-{{domain}}.md # 领域知识
4279
+ │ ├── rules-{{topic}}.md # 业务规则
4280
+ │ ├── process-{{name}}.md # 业务流程
4281
+ │ └── roles.md # 角色权限
4282
+
4283
+ ├── technical/ # 技术知识
4284
+ │ ├── architecture.md # 系统架构
4285
+ │ ├── data-model.md # 数据模型
4286
+ │ ├── api-{{module}}.md # 接口规范
4287
+ │ └── patterns.md # 代码模式
4288
+
4289
+ ├── history/ # 历史信息
4290
+ │ ├── related-features.md # 相关功能
4291
+ │ └── decisions.md # 决策记录
4292
+
4293
+ └── constraints/ # 约束条件
4294
+ ├── technical.md # 技术约束
4295
+ ├── security.md # 安全要求
4296
+ └── performance.md # 性能要求
4297
+
4298
+ file_template: |
4299
+ # {{title}}
4300
+
4301
+ ## 元信息
4302
+ - 查询问题: {{question}}
4303
+ - 问题ID: {{question_id}}
4304
+ - 查询时间: {{timestamp}}
4305
+ - 数据来源: 知识库MCP
4306
+
4307
+ ## 内容摘要
4308
+ {{summary}}
4309
+
4310
+ ## 详细内容
4311
+ {{content}}
4312
+
4313
+ ## 需求关联
4314
+ - 关联需求点: {{related_requirement}}
4315
+ - 影响分析: {{impact_analysis}}
4316
+
4317
+ ## 衍生问题
4318
+ {{#if follow_up_questions}}
4319
+ {{#each follow_up_questions}}
4320
+ - {{this}}
4321
+ {{/each}}
4322
+ {{else}}
4323
+
4324
+ {{/if}}
4325
+
4326
+ elicitation:
4327
+ after_each_phase: true
4328
+ options:
4329
+ - "调整问题优先级"
4330
+ - "添加更多问题"
4331
+ - "删除不相关问题"
4332
+ - "修改问题措辞"
4333
+ - "进入下一阶段"
4334
+ ==================== END: .xiaoma-core/templates/rag-questions-tmpl.yaml ====================
4335
+
4336
+ ==================== START: .xiaoma-core/templates/rag-knowledge-tmpl.yaml ====================
4337
+ template:
4338
+ id: rag-knowledge-template-v1
4339
+ name: RAG知识落地模板
4340
+ version: 1.0
4341
+ description: 将知识库MCP返回的知识内容结构化存储到docs/rag目录
4342
+ output:
4343
+ format: markdown
4344
+ base_path: docs/rag/
3610
4345
 
3611
- ## Structured Frameworks
4346
+ sections:
4347
+ - id: index-template
4348
+ title: 知识索引模板
4349
+ filename: _index.md
4350
+ template: |
4351
+ # RAG知识库索引
4352
+
4353
+ ## 概览
4354
+ - 需求文档: {{requirement_file}}
4355
+ - 创建时间: {{created_at}}
4356
+ - 最后更新: {{updated_at}}
4357
+ - 知识条目数: {{total_entries}}
4358
+
4359
+ ## 知识分类统计
4360
+
4361
+ | 分类 | 条目数 | 覆盖率 |
4362
+ |------|--------|--------|
4363
+ | 业务知识 | {{business_count}} | {{business_coverage}}% |
4364
+ | 技术知识 | {{technical_count}} | {{technical_coverage}}% |
4365
+ | 历史信息 | {{history_count}} | {{history_coverage}}% |
4366
+ | 约束条件 | {{constraints_count}} | {{constraints_coverage}}% |
4367
+
4368
+ ## 知识目录
4369
+
4370
+ ### 业务知识 (business/)
4371
+ {{#each business_files}}
4372
+ - [{{title}}](business/{{filename}}) - {{summary}}
4373
+ {{/each}}
4374
+
4375
+ ### 技术知识 (technical/)
4376
+ {{#each technical_files}}
4377
+ - [{{title}}](technical/{{filename}}) - {{summary}}
4378
+ {{/each}}
4379
+
4380
+ ### 历史信息 (history/)
4381
+ {{#each history_files}}
4382
+ - [{{title}}](history/{{filename}}) - {{summary}}
4383
+ {{/each}}
4384
+
4385
+ ### 约束条件 (constraints/)
4386
+ {{#each constraints_files}}
4387
+ - [{{title}}](constraints/{{filename}}) - {{summary}}
4388
+ {{/each}}
4389
+
4390
+ ## 未回答问题
4391
+ {{#if unanswered_questions}}
4392
+ 以下问题未能从知识库获得答案:
4393
+ {{#each unanswered_questions}}
4394
+ - [{{id}}] {{question}}
4395
+ {{/each}}
4396
+ {{else}}
4397
+ 所有问题均已获得回答。
4398
+ {{/if}}
4399
+
4400
+ ## 后续行动
4401
+ {{#each follow_up_actions}}
4402
+ - [ ] {{action}}
4403
+ {{/each}}
4404
+
4405
+ - id: business-knowledge
4406
+ title: 业务知识模板
4407
+ path: business/
4408
+ variants:
4409
+ - id: domain-knowledge
4410
+ filename_pattern: "domain-{{domain_name}}.md"
4411
+ template: |
4412
+ # {{domain_name}} 领域知识
3612
4413
 
3613
- 5. **SCAMPER Method**: Go through one letter at a time, wait for their ideas before moving to next
3614
- 6. **Six Thinking Hats**: Present one hat, ask for their thoughts, then move to next hat
3615
- 7. **Mind Mapping**: Start with central concept, ask them to suggest branches
4414
+ ## 元信息
4415
+ - 查询问题ID: {{question_ids}}
4416
+ - 来源: 知识库MCP
4417
+ - 更新时间: {{timestamp}}
3616
4418
 
3617
- ## Collaborative Techniques
4419
+ ## 领域概述
4420
+ {{domain_overview}}
3618
4421
 
3619
- 8. **"Yes, And..." Building**: They give idea, you "yes and" it, they "yes and" back - alternate
3620
- 9. **Brainwriting/Round Robin**: They suggest idea, you build on it, ask them to build on yours
3621
- 10. **Random Stimulation**: Give one random prompt/word, ask them to make connections
4422
+ ## 核心概念
3622
4423
 
3623
- ## Deep Exploration
4424
+ {{#each concepts}}
4425
+ ### {{name}}
4426
+ - **定义**: {{definition}}
4427
+ - **业务含义**: {{business_meaning}}
4428
+ - **相关实体**: {{related_entities}}
4429
+ {{/each}}
3624
4430
 
3625
- 11. **Five Whys**: Ask "why" and wait for their answer before asking next "why"
3626
- 12. **Morphological Analysis**: Ask them to list parameters first, then explore combinations together
3627
- 13. **Provocation Technique (PO)**: Give one provocative statement, ask them to extract useful ideas
4431
+ ## 业务规则
3628
4432
 
3629
- ## Advanced Techniques
4433
+ {{#each rules}}
4434
+ ### 规则{{index}}: {{name}}
4435
+ - **描述**: {{description}}
4436
+ - **触发条件**: {{trigger}}
4437
+ - **执行逻辑**: {{logic}}
4438
+ - **异常处理**: {{exception}}
4439
+ {{/each}}
3630
4440
 
3631
- 14. **Forced Relationships**: Connect two unrelated concepts and ask them to find the bridge
3632
- 15. **Assumption Reversal**: Challenge their core assumptions and ask them to build from there
3633
- 16. **Role Playing**: Ask them to brainstorm from different stakeholder perspectives
3634
- 17. **Time Shifting**: "How would you solve this in 1995? 2030?"
3635
- 18. **Resource Constraints**: "What if you had only $10 and 1 hour?"
3636
- 19. **Metaphor Mapping**: Use extended metaphors to explore solutions
3637
- 20. **Question Storming**: Generate questions instead of answers first
3638
- ==================== END: .xiaoma-core/data/brainstorming-techniques.md ====================
4441
+ ## 与需求的关联
4442
+ {{requirement_mapping}}
3639
4443
 
3640
- ==================== START: .xiaoma-core/tasks/brownfield-create-epic.md ====================
3641
- <!-- Powered by XiaoMa™ Core -->
4444
+ - id: process-knowledge
4445
+ filename_pattern: "process-{{process_name}}.md"
4446
+ template: |
4447
+ # {{process_name}} 业务流程
3642
4448
 
3643
- # Create Brownfield Epic Task
4449
+ ## 元信息
4450
+ - 查询问题ID: {{question_ids}}
4451
+ - 来源: 知识库MCP
4452
+ - 更新时间: {{timestamp}}
3644
4453
 
3645
- ## Purpose
4454
+ ## 流程概述
4455
+ {{process_overview}}
3646
4456
 
3647
- Create a single epic for smaller brownfield enhancements that don't require the full PRD and Architecture documentation process. This task is for isolated features or modifications that can be completed within a focused scope.
4457
+ ## 流程步骤
3648
4458
 
3649
- ## When to Use This Task
4459
+ ```mermaid
4460
+ {{mermaid_diagram}}
4461
+ ```
3650
4462
 
3651
- **Use this task when:**
4463
+ ### 详细步骤
3652
4464
 
3653
- - The enhancement can be completed in 1-3 stories
3654
- - No significant architectural changes are required
3655
- - The enhancement follows existing project patterns
3656
- - Integration complexity is minimal
3657
- - Risk to existing system is low
4465
+ {{#each steps}}
4466
+ #### 步骤{{index}}: {{name}}
4467
+ - **执行者**: {{actor}}
4468
+ - **输入**: {{input}}
4469
+ - **处理**: {{processing}}
4470
+ - **输出**: {{output}}
4471
+ - **后置条件**: {{postcondition}}
4472
+ {{/each}}
3658
4473
 
3659
- **Use the full brownfield PRD/Architecture process when:**
4474
+ ## 异常流程
3660
4475
 
3661
- - The enhancement requires multiple coordinated stories
3662
- - Architectural planning is needed
3663
- - Significant integration work is required
3664
- - Risk assessment and mitigation planning is necessary
4476
+ {{#each exceptions}}
4477
+ ### {{name}}
4478
+ - **触发条件**: {{trigger}}
4479
+ - **处理方式**: {{handling}}
4480
+ - **恢复机制**: {{recovery}}
4481
+ {{/each}}
3665
4482
 
3666
- ## Instructions
4483
+ ## 与需求的关联
4484
+ {{requirement_mapping}}
3667
4485
 
3668
- ### 1. Project Analysis (Required)
4486
+ - id: roles-knowledge
4487
+ filename_pattern: "roles.md"
4488
+ template: |
4489
+ # 用户角色与权限
4490
+
4491
+ ## 元信息
4492
+ - 查询问题ID: {{question_ids}}
4493
+ - 来源: 知识库MCP
4494
+ - 更新时间: {{timestamp}}
4495
+
4496
+ ## 角色定义
4497
+
4498
+ {{#each roles}}
4499
+ ### {{name}}
4500
+ - **描述**: {{description}}
4501
+ - **职责**: {{responsibilities}}
4502
+ - **权限范围**: {{permissions}}
4503
+
4504
+ #### 可执行操作
4505
+ {{#each operations}}
4506
+ - {{name}}: {{description}} ({{permission_level}})
4507
+ {{/each}}
4508
+ {{/each}}
4509
+
4510
+ ## 权限矩阵
4511
+
4512
+ | 操作 | {{#each roles}}{{name}} | {{/each}}
4513
+ |------|{{#each roles}}--------|{{/each}}
4514
+ {{#each operations}}
4515
+ | {{name}} | {{#each role_permissions}}{{this}} | {{/each}}
4516
+ {{/each}}
4517
+
4518
+ ## 与需求的关联
4519
+ {{requirement_mapping}}
4520
+
4521
+ - id: technical-knowledge
4522
+ title: 技术知识模板
4523
+ path: technical/
4524
+ variants:
4525
+ - id: architecture
4526
+ filename_pattern: "architecture.md"
4527
+ template: |
4528
+ # 系统架构
3669
4529
 
3670
- Before creating the epic, gather essential information about the existing project:
4530
+ ## 元信息
4531
+ - 查询问题ID: {{question_ids}}
4532
+ - 来源: 知识库MCP
4533
+ - 更新时间: {{timestamp}}
3671
4534
 
3672
- **Existing Project Context:**
4535
+ ## 架构概览
4536
+ {{architecture_overview}}
3673
4537
 
3674
- - [ ] Project purpose and current functionality understood
3675
- - [ ] Existing technology stack identified
3676
- - [ ] Current architecture patterns noted
3677
- - [ ] Integration points with existing system identified
4538
+ ## 技术栈
4539
+ | 层级 | 技术 | 版本 | 说明 |
4540
+ |------|------|------|------|
4541
+ {{#each tech_stack}}
4542
+ | {{layer}} | {{technology}} | {{version}} | {{description}} |
4543
+ {{/each}}
3678
4544
 
3679
- **Enhancement Scope:**
4545
+ ## 模块结构
3680
4546
 
3681
- - [ ] Enhancement clearly defined and scoped
3682
- - [ ] Impact on existing functionality assessed
3683
- - [ ] Required integration points identified
3684
- - [ ] Success criteria established
4547
+ ```
4548
+ {{module_structure}}
4549
+ ```
3685
4550
 
3686
- ### 2. Epic Creation
4551
+ ## 模块说明
3687
4552
 
3688
- Create a focused epic following this structure:
4553
+ {{#each modules}}
4554
+ ### {{name}}
4555
+ - **职责**: {{responsibility}}
4556
+ - **依赖**: {{dependencies}}
4557
+ - **对外接口**: {{interfaces}}
4558
+ {{/each}}
3689
4559
 
3690
- #### Epic Title
4560
+ ## 与需求的关联
4561
+ - **建议实现位置**: {{suggested_location}}
4562
+ - **需要修改的模块**: {{affected_modules}}
4563
+ - **需要新增的模块**: {{new_modules}}
3691
4564
 
3692
- {{Enhancement Name}} - Brownfield Enhancement
4565
+ - id: data-model
4566
+ filename_pattern: "data-model.md"
4567
+ template: |
4568
+ # 数据模型
3693
4569
 
3694
- #### Epic Goal
4570
+ ## 元信息
4571
+ - 查询问题ID: {{question_ids}}
4572
+ - 来源: 知识库MCP
4573
+ - 更新时间: {{timestamp}}
3695
4574
 
3696
- {{1-2 sentences describing what the epic will accomplish and why it adds value}}
4575
+ ## 数据库概览
4576
+ - **数据库类型**: {{database_type}}
4577
+ - **数据库版本**: {{database_version}}
4578
+ - **ORM框架**: {{orm_framework}}
3697
4579
 
3698
- #### Epic Description
4580
+ ## 相关数据表
3699
4581
 
3700
- **Existing System Context:**
4582
+ {{#each tables}}
4583
+ ### {{table_name}}
3701
4584
 
3702
- - Current relevant functionality: {{brief description}}
3703
- - Technology stack: {{relevant existing technologies}}
3704
- - Integration points: {{where new work connects to existing system}}
4585
+ **说明**: {{description}}
3705
4586
 
3706
- **Enhancement Details:**
4587
+ | 字段名 | 类型 | 约束 | 说明 |
4588
+ |--------|------|------|------|
4589
+ {{#each columns}}
4590
+ | {{name}} | {{type}} | {{constraints}} | {{description}} |
4591
+ {{/each}}
3707
4592
 
3708
- - What's being added/changed: {{clear description}}
3709
- - How it integrates: {{integration approach}}
3710
- - Success criteria: {{measurable outcomes}}
4593
+ **索引**:
4594
+ {{#each indexes}}
4595
+ - {{name}}: {{columns}} ({{type}})
4596
+ {{/each}}
3711
4597
 
3712
- #### Stories
4598
+ {{/each}}
3713
4599
 
3714
- List 1-3 focused stories that complete the epic:
4600
+ ## 表关系
3715
4601
 
3716
- 1. **Story 1:** {{Story title and brief description}}
3717
- 2. **Story 2:** {{Story title and brief description}}
3718
- 3. **Story 3:** {{Story title and brief description}}
4602
+ ```mermaid
4603
+ erDiagram
4604
+ {{er_diagram}}
4605
+ ```
3719
4606
 
3720
- #### Compatibility Requirements
4607
+ ## 与需求的关联
4608
+ - **需要新增的表**: {{new_tables}}
4609
+ - **需要修改的表**: {{modified_tables}}
4610
+ - **数据迁移需求**: {{migration_needs}}
3721
4611
 
3722
- - [ ] Existing APIs remain unchanged
3723
- - [ ] Database schema changes are backward compatible
3724
- - [ ] UI changes follow existing patterns
3725
- - [ ] Performance impact is minimal
4612
+ - id: api-spec
4613
+ filename_pattern: "api-{{module}}.md"
4614
+ template: |
4615
+ # {{module}} 接口规范
4616
+
4617
+ ## 元信息
4618
+ - 查询问题ID: {{question_ids}}
4619
+ - 来源: 知识库MCP
4620
+ - 更新时间: {{timestamp}}
4621
+
4622
+ ## 接口概览
4623
+ - **基础路径**: {{base_path}}
4624
+ - **认证方式**: {{auth_method}}
4625
+ - **响应格式**: {{response_format}}
4626
+
4627
+ ## 接口列表
4628
+
4629
+ {{#each apis}}
4630
+ ### {{method}} {{path}}
4631
+
4632
+ **说明**: {{description}}
4633
+
4634
+ **请求参数**:
4635
+ | 参数名 | 位置 | 类型 | 必填 | 说明 |
4636
+ |--------|------|------|------|------|
4637
+ {{#each parameters}}
4638
+ | {{name}} | {{in}} | {{type}} | {{required}} | {{description}} |
4639
+ {{/each}}
4640
+
4641
+ **请求体**:
4642
+ ```json
4643
+ {{request_body}}
4644
+ ```
4645
+
4646
+ **响应**:
4647
+ ```json
4648
+ {{response_body}}
4649
+ ```
4650
+
4651
+ **错误码**:
4652
+ | 错误码 | 说明 |
4653
+ |--------|------|
4654
+ {{#each error_codes}}
4655
+ | {{code}} | {{message}} |
4656
+ {{/each}}
4657
+
4658
+ ---
4659
+ {{/each}}
4660
+
4661
+ ## 与需求的关联
4662
+ - **可复用的接口**: {{reusable_apis}}
4663
+ - **需要新增的接口**: {{new_apis}}
4664
+ - **需要修改的接口**: {{modified_apis}}
4665
+
4666
+ - id: code-patterns
4667
+ filename_pattern: "patterns.md"
4668
+ template: |
4669
+ # 代码模式与最佳实践
4670
+
4671
+ ## 元信息
4672
+ - 查询问题ID: {{question_ids}}
4673
+ - 来源: 知识库MCP
4674
+ - 更新时间: {{timestamp}}
4675
+
4676
+ ## 项目结构规范
4677
+ ```
4678
+ {{project_structure}}
4679
+ ```
4680
+
4681
+ ## 代码规范
4682
+ {{#each coding_standards}}
4683
+ ### {{category}}
4684
+ {{description}}
4685
+
4686
+ **示例**:
4687
+ ```{{language}}
4688
+ {{example}}
4689
+ ```
4690
+ {{/each}}
4691
+
4692
+ ## 常用模式
4693
+
4694
+ {{#each patterns}}
4695
+ ### {{name}}
4696
+ - **使用场景**: {{use_case}}
4697
+ - **实现示例**: {{example_location}}
4698
+ - **注意事项**: {{notes}}
4699
+ {{/each}}
4700
+
4701
+ ## 可复用组件
4702
+
4703
+ {{#each reusable_components}}
4704
+ ### {{name}}
4705
+ - **位置**: {{location}}
4706
+ - **功能**: {{functionality}}
4707
+ - **使用方法**: {{usage}}
4708
+ {{/each}}
4709
+
4710
+ ## 与需求的关联
4711
+ {{requirement_mapping}}
4712
+
4713
+ - id: history-knowledge
4714
+ title: 历史信息模板
4715
+ path: history/
4716
+ variants:
4717
+ - id: related-features
4718
+ filename_pattern: "related-features.md"
4719
+ template: |
4720
+ # 相关历史功能
3726
4721
 
3727
- #### Risk Mitigation
4722
+ ## 元信息
4723
+ - 查询问题ID: {{question_ids}}
4724
+ - 来源: 知识库MCP
4725
+ - 更新时间: {{timestamp}}
3728
4726
 
3729
- - **Primary Risk:** {{main risk to existing system}}
3730
- - **Mitigation:** {{how risk will be addressed}}
3731
- - **Rollback Plan:** {{how to undo changes if needed}}
4727
+ ## 相关功能列表
3732
4728
 
3733
- #### Definition of Done
4729
+ {{#each features}}
4730
+ ### {{name}}
4731
+ - **实现时间**: {{implemented_at}}
4732
+ - **当前状态**: {{status}}
4733
+ - **功能描述**: {{description}}
4734
+ - **实现位置**: {{location}}
3734
4735
 
3735
- - [ ] All stories completed with acceptance criteria met
3736
- - [ ] Existing functionality verified through testing
3737
- - [ ] Integration points working correctly
3738
- - [ ] Documentation updated appropriately
3739
- - [ ] No regression in existing features
4736
+ **与当前需求的关系**:
4737
+ {{relation_to_current}}
3740
4738
 
3741
- ### 3. Validation Checklist
4739
+ **可借鉴点**:
4740
+ {{lessons_learned}}
3742
4741
 
3743
- Before finalizing the epic, ensure:
4742
+ ---
4743
+ {{/each}}
3744
4744
 
3745
- **Scope Validation:**
4745
+ ## 建议
4746
+ {{recommendations}}
3746
4747
 
3747
- - [ ] Epic can be completed in 1-3 stories maximum
3748
- - [ ] No architectural documentation is required
3749
- - [ ] Enhancement follows existing patterns
3750
- - [ ] Integration complexity is manageable
4748
+ - id: decisions
4749
+ filename_pattern: "decisions.md"
4750
+ template: |
4751
+ # 架构决策记录
4752
+
4753
+ ## 元信息
4754
+ - 查询问题ID: {{question_ids}}
4755
+ - 来源: 知识库MCP
4756
+ - 更新时间: {{timestamp}}
4757
+
4758
+ ## 相关决策
4759
+
4760
+ {{#each decisions}}
4761
+ ### ADR-{{id}}: {{title}}
4762
+
4763
+ **状态**: {{status}}
4764
+ **日期**: {{date}}
4765
+
4766
+ **背景**:
4767
+ {{context}}
4768
+
4769
+ **决策**:
4770
+ {{decision}}
4771
+
4772
+ **理由**:
4773
+ {{rationale}}
4774
+
4775
+ **影响**:
4776
+ {{consequences}}
4777
+
4778
+ **与当前需求的关联**:
4779
+ {{relation_to_current}}
4780
+
4781
+ ---
4782
+ {{/each}}
4783
+
4784
+ - id: constraints-knowledge
4785
+ title: 约束条件模板
4786
+ path: constraints/
4787
+ variants:
4788
+ - id: technical-constraints
4789
+ filename_pattern: "technical.md"
4790
+ template: |
4791
+ # 技术约束
4792
+
4793
+ ## 元信息
4794
+ - 查询问题ID: {{question_ids}}
4795
+ - 来源: 知识库MCP
4796
+ - 更新时间: {{timestamp}}
4797
+
4798
+ ## 技术栈约束
4799
+
4800
+ {{#each tech_constraints}}
4801
+ ### {{category}}
4802
+ - **约束**: {{constraint}}
4803
+ - **原因**: {{reason}}
4804
+ - **影响**: {{impact}}
4805
+ {{/each}}
4806
+
4807
+ ## 依赖约束
4808
+
4809
+ {{#each dependency_constraints}}
4810
+ - **{{name}}**: {{constraint}}
4811
+ {{/each}}
4812
+
4813
+ ## 与需求的关联
4814
+ {{requirement_mapping}}
4815
+
4816
+ - id: security-constraints
4817
+ filename_pattern: "security.md"
4818
+ template: |
4819
+ # 安全合规要求
4820
+
4821
+ ## 元信息
4822
+ - 查询问题ID: {{question_ids}}
4823
+ - 来源: 知识库MCP
4824
+ - 更新时间: {{timestamp}}
4825
+
4826
+ ## 安全要求
4827
+
4828
+ {{#each security_requirements}}
4829
+ ### {{name}}
4830
+ - **描述**: {{description}}
4831
+ - **适用范围**: {{scope}}
4832
+ - **实现方式**: {{implementation}}
4833
+ {{/each}}
4834
+
4835
+ ## 合规要求
4836
+
4837
+ {{#each compliance_requirements}}
4838
+ ### {{standard}}
4839
+ - **要求**: {{requirement}}
4840
+ - **检查点**: {{checkpoints}}
4841
+ {{/each}}
4842
+
4843
+ ## 与需求的关联
4844
+ {{requirement_mapping}}
4845
+
4846
+ - id: performance-constraints
4847
+ filename_pattern: "performance.md"
4848
+ template: |
4849
+ # 性能要求
4850
+
4851
+ ## 元信息
4852
+ - 查询问题ID: {{question_ids}}
4853
+ - 来源: 知识库MCP
4854
+ - 更新时间: {{timestamp}}
4855
+
4856
+ ## 性能指标
4857
+
4858
+ | 指标 | 目标值 | 当前值 | 说明 |
4859
+ |------|--------|--------|------|
4860
+ {{#each metrics}}
4861
+ | {{name}} | {{target}} | {{current}} | {{description}} |
4862
+ {{/each}}
4863
+
4864
+ ## SLA要求
4865
+ {{#each sla_requirements}}
4866
+ - **{{name}}**: {{value}}
4867
+ {{/each}}
4868
+
4869
+ ## 与需求的关联
4870
+ {{requirement_mapping}}
4871
+
4872
+ workflow:
4873
+ knowledge_landing_process:
4874
+ step1:
4875
+ name: "创建目录结构"
4876
+ action: |
4877
+ 确保 docs/rag/ 目录结构存在:
4878
+ - docs/rag/business/
4879
+ - docs/rag/technical/
4880
+ - docs/rag/history/
4881
+ - docs/rag/constraints/
4882
+
4883
+ step2:
4884
+ name: "分类知识内容"
4885
+ action: |
4886
+ 根据问题类别(A/B/C/D)将知识库返回内容分类:
4887
+ - A类 → business/
4888
+ - B类 → technical/
4889
+ - C类 → history/
4890
+ - D类 → constraints/
4891
+
4892
+ step3:
4893
+ name: "应用模板生成文件"
4894
+ action: |
4895
+ 为每条知识选择合适的模板变体,填充内容并生成markdown文件
4896
+
4897
+ step4:
4898
+ name: "生成索引文件"
4899
+ action: |
4900
+ 更新 docs/rag/_index.md 索引文件,统计所有知识条目
4901
+
4902
+ step5:
4903
+ name: "标记未答问题"
4904
+ action: |
4905
+ 将无法从知识库获得答案的问题记录到索引文件的"未回答问题"部分
4906
+ ==================== END: .xiaoma-core/templates/rag-knowledge-tmpl.yaml ====================
4907
+
4908
+ ==================== START: .xiaoma-core/templates/prd-tmpl.yaml ====================
4909
+ template:
4910
+ id: prd-template-v2
4911
+ name: 产品需求文档
4912
+ version: 2.0
4913
+ output:
4914
+ format: markdown
4915
+ filename: docs/prd.md
4916
+ title: "{{project_name}} Product Requirements Document (PRD)"
4917
+
4918
+ workflow:
4919
+ mode: interactive
4920
+ elicitation: advanced-elicitation
4921
+
4922
+ sections:
4923
+ - id: goals-context
4924
+ title: 目标与背景上下文
4925
+ instruction: |
4926
+ 询问“项目简报”文档是否可用。如果不存在“项目简报”,强烈建议首先使用 project-brief-tmpl 创建一个(它提供了必要的基础:问题陈述、目标用户、成功指标、MVP 范围、约束条件)。如果用户坚持在没有简报的情况下编写 PRD,请在“目标”部分收集这些信息。如果“项目简报”存在,请审阅并用它来填充“目标”(期望成果的项目符号列表)和“背景上下文”(1-2 段关于此项目解决什么问题及其原因的说明),以便我们能确定 PRD MVP 的范围内外事项。无论哪种方式,这对于确定需求都至关重要。请包含“变更日志”表格。
4927
+ sections:
4928
+ - id: goals
4929
+ title: 目标
4930
+ type: bullet-list
4931
+ instruction: 以项目符号列表形式,每行一个,列出 PRD 成功后将交付的预期成果——用户和项目的期望。
4932
+ - id: background
4933
+ title: 背景上下文
4934
+ type: paragraphs
4935
+ instruction: 用 1-2 个简短段落总结背景上下文,例如我们在项目简报中学到了什么(避免与目标重复),这个项目解决什么问题以及为什么,当前的行业状况或需求是什么。
4936
+ - id: changelog
4937
+ title: 变更日志
4938
+ type: table
4939
+ columns: [日期, 版本, 描述, 作者]
4940
+ instruction: 跟踪文档版本和变更
4941
+
4942
+ - id: requirements
4943
+ title: 需求
4944
+ instruction: 在两个子部分下起草功能性和非功能性需求列表。
4945
+ elicit: true
4946
+ sections:
4947
+ - id: functional
4948
+ title: 功能性需求
4949
+ type: numbered-list
4950
+ prefix: FR
4951
+ instruction: 每个需求将是一个 Markdown 项目符号,并带有一个以 FR 开头的标识符序列。
4952
+ examples:
4953
+ - "FR6: 待办事项列表使用 AI 检测并警告措辞不同但可能重复的待办事项。"
4954
+ - id: non-functional
4955
+ title: 非功能性需求
4956
+ type: numbered-list
4957
+ prefix: NFR
4958
+ instruction: 每个需求将是一个 Markdown 项目符号,并带有一个以 NFR 开头的标识符序列。
4959
+ examples:
4960
+ - "NFR1: 在可行的情况下,AWS 服务的使用必须力求保持在免费套餐限制内。"
4961
+
4962
+ - id: ui-goals
4963
+ title: 用户界面设计目标
4964
+ condition: PRD 包含 UX/UI 需求时
4965
+ instruction: |
4966
+ 捕获高层次的 UI/UX 愿景,以指导设计架构师并为创建用户故事提供信息。步骤:
4967
+
4968
+ 1. 基于项目上下文,用有根据的猜测预先填充所有子部分。
4969
+ 2. 将渲染后的完整部分呈现给用户。
4970
+ 3. 清晰地告知用户哪些地方做了假设。
4971
+ 4. 针对不清晰/缺失的元素或需要更具体说明的领域提出有针对性的问题。
4972
+ 5. 这不是详细的 UI 规范——重点关注产品愿景和用户目标。
4973
+ elicit: true
4974
+ choices:
4975
+ accessibility: [无, WCAG AA, WCAG AAA]
4976
+ platforms: [响应式网页, 仅移动端, 仅桌面端, 跨平台]
4977
+ sections:
4978
+ - id: ux-vision
4979
+ title: 整体 UX 愿景
4980
+ - id: interaction-paradigms
4981
+ title: 关键交互范式
4982
+ - id: core-screens
4983
+ title: 核心屏幕与视图
4984
+ instruction: 从产品角度看,为实现 PRD 的价值和目标,最关键的屏幕或视图是什么?这旨在提供概念性的高层概览,以驱动粗略的模块或用户故事。
4985
+ examples:
4986
+ - "登录屏幕"
4987
+ - "主仪表盘"
4988
+ - "项目详情页"
4989
+ - "设置页面"
4990
+ - id: accessibility
4991
+ title: "无障碍性: {无|WCAG AA|WCAG AAA|自定义要求}"
4992
+ - id: branding
4993
+ title: 品牌
4994
+ instruction: 是否有任何已知的品牌元素或风格指南必须被整合进来?
4995
+ examples:
4996
+ - "复制 20 世纪初黑白电影的观感,包括在页面或状态转换期间模拟胶片损坏或投影仪故障的动画效果。"
4997
+ - "附件是我司品牌的全套调色板和设计元素。"
4998
+ - id: target-platforms
4999
+ title: "目标设备与平台: {响应式网页|仅移动端|仅桌面端|跨平台}"
5000
+ examples:
5001
+ - "响应式网页,以及所有移动平台"
5002
+ - "仅限 iPhone"
5003
+ - "ASCII 码 Windows 桌面"
5004
+
5005
+ - id: technical-assumptions
5006
+ title: 技术假设
5007
+ instruction: |
5008
+ 收集将指导架构师的技术决策。步骤:
5009
+
5010
+ 1. 检查 .xiaoma-core/data/technical-preferences.yaml 或附加的技术偏好文件是否存在——用它来预填充选项。
5011
+ 2. 询问用户关于:语言、框架、启动模板、库、API、部署目标。
5012
+ 3. 对于未知项,根据项目目标和 MVP 范围提供指导。
5013
+ 4. 记录所有技术选择及其理由(为什么这个选择适合该项目)。
5014
+ 5. 这些将成为架构师的约束条件——务必具体和完整。
5015
+ elicit: true
5016
+ choices:
5017
+ repository: [Monorepo, Polyrepo]
5018
+ architecture: [Monolith, Microservices, Serverless]
5019
+ testing: [仅单元测试, 单元+集成测试, 完整测试金字塔]
5020
+ sections:
5021
+ - id: repository-structure
5022
+ title: "代码仓库结构: {Monorepo|Polyrepo|Multi-repo}"
5023
+ - id: service-architecture
5024
+ title: 服务架构
5025
+ instruction: "关键决策 - 记录高层服务架构(例如,Monolith, Microservices, Monorepo 内的 Serverless 函数)。"
5026
+ - id: testing-requirements
5027
+ title: 测试要求
5028
+ instruction: "关键决策 - 记录测试要求(仅单元测试、集成测试、e2e 测试、手动测试,以及是否需要方便手动测试的方法)。"
5029
+ - id: additional-assumptions
5030
+ title: 其他技术假设与请求
5031
+ instruction: 在起草本文档的整个过程中,如果提出或发现任何其他适合架构师的技术假设,请在此处作为额外的项目符号添加。
5032
+
5033
+ - id: epic-list
5034
+ title: 模块列表
5035
+ instruction: |
5036
+ 向用户呈现一份高层次的模块列表以供批准。每个模块应有一个标题和一个简短的(1句话)目标陈述。这使用户能在深入细节之前审阅整体结构。
5037
+
5038
+ 关键:模块必须遵循敏捷最佳实践,保持逻辑上的顺序:
5039
+
5040
+ - 每个模块都应交付一个重要的、端到端的、完全可部署且可测试的功能增量。
5041
+ - 模块 1 必须建立基础项目设施(应用设置、Git、CI/CD、核心服务),除非我们是向现有应用添加新功能。同时,它还应交付一个初始功能,即使只是一个健康检查路由或一个简单的金丝雀页面显示——在为第一个模块编写用户故事时要记住这一点!
5042
+ - 每个后续的模块都在之前模块功能的基础上构建,交付主要的功能模块,这些模块在部署时能为用户或业务提供切实的价值。
5043
+ - 并非每个项目都需要多个模块,一个模块需要交付价值。例如,一个已完成的 API 即使 UI 尚未完成并计划在另一个模块中实现,也可以交付价值。
5044
+ - 倾向于设置较少的模块,但要告知用户你的理由,并提供拆分选项,如果某些模块看起来太大或关注点分散的话。
5045
+ - 横切关注点应该贯穿于模块和用户故事中,而不是作为最后的用户故事。例如,在一个模块的最后一个故事中添加日志框架,或者在项目结束时作为最后一个模块或故事来做,这将非常糟糕,因为我们从一开始就没有日志记录。
5046
+ elicit: true
5047
+ examples:
5048
+ - "模块 1:基础与核心设施:建立项目设置、认证和基本用户管理"
5049
+ - "模块 2:核心业务实体:创建和管理主要领域对象的 CRUD 操作"
5050
+ - "模块 3:用户工作流与交互:实现关键用户旅程和业务流程"
5051
+ - "模块 4:报告与分析:为用户提供洞察和数据可视化"
5052
+
5053
+ - id: epic-details
5054
+ title: 模块 {{epic_number}} {{epic_title}}
5055
+ repeatable: true
5056
+ instruction: |
5057
+ 在模块列表被批准后,将每个模块及其所有的用户故事和验收标准作为一个完整的审查单元呈现。
5058
+
5059
+ 为每个模块提供扩展的目标(2-3 句话描述所有故事将实现的目标和价值)。
5060
+
5061
+ 关键的用户故事排序要求:
5062
+
5063
+ - 每个模块中的用户故事必须在逻辑上是顺序的。
5064
+ - 每个故事都应该是一个“垂直切片”,交付完整的功能,除了项目基础的早期使能型故事。
5065
+ - 任何故事都不应依赖于后续故事或模块的工作。
5066
+ - 识别并注明任何直接的前置故事。
5067
+ - 关注“做什么”和“为什么”,而不是“怎么做”(将技术实现留给架构师),但要足够精确以支持故事之间逻辑上顺序的操作。
5068
+ - 确保每个故事都交付明确的用户或业务价值,尽量避免使能型故事,而是将它们构建到交付价值的故事中。
5069
+ - 为 AI 代理执行调整故事的大小:每个故事必须能由单个 AI 代理在一次专注的会话中完成,而不会出现上下文溢出。
5070
+ - 想象一个“初级开发人员工作 2-4 小时”的场景——故事必须是小型的、专注的、自包含的。
5071
+ - 如果一个故事看起来很复杂,只要它能交付一个垂直切片,就应进一步拆分。
5072
+ elicit: true
5073
+ template: "{{epic_goal}}"
5074
+ sections:
5075
+ - id: story
5076
+ title: 用户故事 {{epic_number}}.{{story_number}} {{story_title}}
5077
+ repeatable: true
5078
+ template: |
5079
+ 作为一名 {{user_type}},
5080
+ 我想要 {{action}},
5081
+ 以便 {{benefit}}。
5082
+ sections:
5083
+ - id: acceptance-criteria
5084
+ title: 验收标准
5085
+ type: numbered-list
5086
+ item_template: "{{criterion_number}}: {{criteria}}"
5087
+ repeatable: true
5088
+ instruction: |
5089
+ 定义清晰、全面且可测试的验收标准,这些标准应:
5090
+
5091
+ - 从功能角度精确定义“完成”的含义。
5092
+ - 明确无歧义,并作为验证的基础。
5093
+ - 包括来自 PRD 的任何关键非功能性需求。
5094
+ - 考虑后端/数据组件的本地可测试性。
5095
+ - 在适用时,指定 UI/UX 需求和框架遵循情况。
5096
+ - 避免应放在其他故事或 PRD 部分的横切关注点。
5097
+
5098
+ - id: checklist-results
5099
+ title: 检查清单结果报告
5100
+ instruction: 在运行检查清单和起草提示之前,提议输出更新后的完整 PRD。如果输出,请与用户确认你将继续运行检查清单并生成报告。一旦用户确认,执行 pm-checklist 并在此部分填充结果。
5101
+
5102
+ - id: next-steps
5103
+ title: 后续步骤
5104
+ sections:
5105
+ - id: ux-expert-prompt
5106
+ title: UX 专家提示
5107
+ instruction: 此部分将包含给 UX 专家的提示,保持简短扼要,以启动使用本文档作为输入的架构创建模式。
5108
+ - id: architect-prompt
5109
+ title: 架构师提示
5110
+ instruction: 此部分将包含给架构师的提示,保持简短扼要,以启动使用本文档作为输入的架构创建模式。
5111
+ ==================== END: .xiaoma-core/templates/prd-tmpl.yaml ====================
5112
+
5113
+ ==================== START: .xiaoma-core/data/brainstorming-techniques.md ====================
5114
+ <!-- Powered by XiaoMa™ Core -->
5115
+
5116
+ # Brainstorming Techniques Data
5117
+
5118
+ ## Creative Expansion
5119
+
5120
+ 1. **What If Scenarios**: Ask one provocative question, get their response, then ask another
5121
+ 2. **Analogical Thinking**: Give one example analogy, ask them to find 2-3 more
5122
+ 3. **Reversal/Inversion**: Pose the reverse question, let them work through it
5123
+ 4. **First Principles Thinking**: Ask "What are the fundamentals?" and guide them to break it down
5124
+
5125
+ ## Structured Frameworks
5126
+
5127
+ 5. **SCAMPER Method**: Go through one letter at a time, wait for their ideas before moving to next
5128
+ 6. **Six Thinking Hats**: Present one hat, ask for their thoughts, then move to next hat
5129
+ 7. **Mind Mapping**: Start with central concept, ask them to suggest branches
5130
+
5131
+ ## Collaborative Techniques
5132
+
5133
+ 8. **"Yes, And..." Building**: They give idea, you "yes and" it, they "yes and" back - alternate
5134
+ 9. **Brainwriting/Round Robin**: They suggest idea, you build on it, ask them to build on yours
5135
+ 10. **Random Stimulation**: Give one random prompt/word, ask them to make connections
5136
+
5137
+ ## Deep Exploration
5138
+
5139
+ 11. **Five Whys**: Ask "why" and wait for their answer before asking next "why"
5140
+ 12. **Morphological Analysis**: Ask them to list parameters first, then explore combinations together
5141
+ 13. **Provocation Technique (PO)**: Give one provocative statement, ask them to extract useful ideas
5142
+
5143
+ ## Advanced Techniques
5144
+
5145
+ 14. **Forced Relationships**: Connect two unrelated concepts and ask them to find the bridge
5146
+ 15. **Assumption Reversal**: Challenge their core assumptions and ask them to build from there
5147
+ 16. **Role Playing**: Ask them to brainstorm from different stakeholder perspectives
5148
+ 17. **Time Shifting**: "How would you solve this in 1995? 2030?"
5149
+ 18. **Resource Constraints**: "What if you had only $10 and 1 hour?"
5150
+ 19. **Metaphor Mapping**: Use extended metaphors to explore solutions
5151
+ 20. **Question Storming**: Generate questions instead of answers first
5152
+ ==================== END: .xiaoma-core/data/brainstorming-techniques.md ====================
5153
+
5154
+ ==================== START: .xiaoma-core/tasks/brownfield-create-epic.md ====================
5155
+ <!-- Powered by XiaoMa™ Core -->
5156
+
5157
+ # Create Brownfield Epic Task
5158
+
5159
+ ## Purpose
5160
+
5161
+ Create a single epic for smaller brownfield enhancements that don't require the full PRD and Architecture documentation process. This task is for isolated features or modifications that can be completed within a focused scope.
5162
+
5163
+ ## When to Use This Task
5164
+
5165
+ **Use this task when:**
5166
+
5167
+ - The enhancement can be completed in 1-3 stories
5168
+ - No significant architectural changes are required
5169
+ - The enhancement follows existing project patterns
5170
+ - Integration complexity is minimal
5171
+ - Risk to existing system is low
5172
+
5173
+ **Use the full brownfield PRD/Architecture process when:**
5174
+
5175
+ - The enhancement requires multiple coordinated stories
5176
+ - Architectural planning is needed
5177
+ - Significant integration work is required
5178
+ - Risk assessment and mitigation planning is necessary
5179
+
5180
+ ## Instructions
5181
+
5182
+ ### 1. Project Analysis (Required)
5183
+
5184
+ Before creating the epic, gather essential information about the existing project:
5185
+
5186
+ **Existing Project Context:**
5187
+
5188
+ - [ ] Project purpose and current functionality understood
5189
+ - [ ] Existing technology stack identified
5190
+ - [ ] Current architecture patterns noted
5191
+ - [ ] Integration points with existing system identified
5192
+
5193
+ **Enhancement Scope:**
5194
+
5195
+ - [ ] Enhancement clearly defined and scoped
5196
+ - [ ] Impact on existing functionality assessed
5197
+ - [ ] Required integration points identified
5198
+ - [ ] Success criteria established
5199
+
5200
+ ### 2. Epic Creation
5201
+
5202
+ Create a focused epic following this structure:
5203
+
5204
+ #### Epic Title
5205
+
5206
+ {{Enhancement Name}} - Brownfield Enhancement
5207
+
5208
+ #### Epic Goal
5209
+
5210
+ {{1-2 sentences describing what the epic will accomplish and why it adds value}}
5211
+
5212
+ #### Epic Description
5213
+
5214
+ **Existing System Context:**
5215
+
5216
+ - Current relevant functionality: {{brief description}}
5217
+ - Technology stack: {{relevant existing technologies}}
5218
+ - Integration points: {{where new work connects to existing system}}
5219
+
5220
+ **Enhancement Details:**
5221
+
5222
+ - What's being added/changed: {{clear description}}
5223
+ - How it integrates: {{integration approach}}
5224
+ - Success criteria: {{measurable outcomes}}
5225
+
5226
+ #### Stories
5227
+
5228
+ List 1-3 focused stories that complete the epic:
5229
+
5230
+ 1. **Story 1:** {{Story title and brief description}}
5231
+ 2. **Story 2:** {{Story title and brief description}}
5232
+ 3. **Story 3:** {{Story title and brief description}}
5233
+
5234
+ #### Compatibility Requirements
5235
+
5236
+ - [ ] Existing APIs remain unchanged
5237
+ - [ ] Database schema changes are backward compatible
5238
+ - [ ] UI changes follow existing patterns
5239
+ - [ ] Performance impact is minimal
5240
+
5241
+ #### Risk Mitigation
5242
+
5243
+ - **Primary Risk:** {{main risk to existing system}}
5244
+ - **Mitigation:** {{how risk will be addressed}}
5245
+ - **Rollback Plan:** {{how to undo changes if needed}}
5246
+
5247
+ #### Definition of Done
5248
+
5249
+ - [ ] All stories completed with acceptance criteria met
5250
+ - [ ] Existing functionality verified through testing
5251
+ - [ ] Integration points working correctly
5252
+ - [ ] Documentation updated appropriately
5253
+ - [ ] No regression in existing features
5254
+
5255
+ ### 3. Validation Checklist
5256
+
5257
+ Before finalizing the epic, ensure:
5258
+
5259
+ **Scope Validation:**
5260
+
5261
+ - [ ] Epic can be completed in 1-3 stories maximum
5262
+ - [ ] No architectural documentation is required
5263
+ - [ ] Enhancement follows existing patterns
5264
+ - [ ] Integration complexity is manageable
3751
5265
 
3752
5266
  **Risk Assessment:**
3753
5267
 
@@ -4593,211 +6107,6 @@ sections:
4593
6107
  - template: "IV3: {{performance_impact_verification}}"
4594
6108
  ==================== END: .xiaoma-core/templates/brownfield-prd-tmpl.yaml ====================
4595
6109
 
4596
- ==================== START: .xiaoma-core/templates/prd-tmpl.yaml ====================
4597
- template:
4598
- id: prd-template-v2
4599
- name: 产品需求文档
4600
- version: 2.0
4601
- output:
4602
- format: markdown
4603
- filename: docs/prd.md
4604
- title: "{{project_name}} Product Requirements Document (PRD)"
4605
-
4606
- workflow:
4607
- mode: interactive
4608
- elicitation: advanced-elicitation
4609
-
4610
- sections:
4611
- - id: goals-context
4612
- title: 目标与背景上下文
4613
- instruction: |
4614
- 询问“项目简报”文档是否可用。如果不存在“项目简报”,强烈建议首先使用 project-brief-tmpl 创建一个(它提供了必要的基础:问题陈述、目标用户、成功指标、MVP 范围、约束条件)。如果用户坚持在没有简报的情况下编写 PRD,请在“目标”部分收集这些信息。如果“项目简报”存在,请审阅并用它来填充“目标”(期望成果的项目符号列表)和“背景上下文”(1-2 段关于此项目解决什么问题及其原因的说明),以便我们能确定 PRD MVP 的范围内外事项。无论哪种方式,这对于确定需求都至关重要。请包含“变更日志”表格。
4615
- sections:
4616
- - id: goals
4617
- title: 目标
4618
- type: bullet-list
4619
- instruction: 以项目符号列表形式,每行一个,列出 PRD 成功后将交付的预期成果——用户和项目的期望。
4620
- - id: background
4621
- title: 背景上下文
4622
- type: paragraphs
4623
- instruction: 用 1-2 个简短段落总结背景上下文,例如我们在项目简报中学到了什么(避免与目标重复),这个项目解决什么问题以及为什么,当前的行业状况或需求是什么。
4624
- - id: changelog
4625
- title: 变更日志
4626
- type: table
4627
- columns: [日期, 版本, 描述, 作者]
4628
- instruction: 跟踪文档版本和变更
4629
-
4630
- - id: requirements
4631
- title: 需求
4632
- instruction: 在两个子部分下起草功能性和非功能性需求列表。
4633
- elicit: true
4634
- sections:
4635
- - id: functional
4636
- title: 功能性需求
4637
- type: numbered-list
4638
- prefix: FR
4639
- instruction: 每个需求将是一个 Markdown 项目符号,并带有一个以 FR 开头的标识符序列。
4640
- examples:
4641
- - "FR6: 待办事项列表使用 AI 检测并警告措辞不同但可能重复的待办事项。"
4642
- - id: non-functional
4643
- title: 非功能性需求
4644
- type: numbered-list
4645
- prefix: NFR
4646
- instruction: 每个需求将是一个 Markdown 项目符号,并带有一个以 NFR 开头的标识符序列。
4647
- examples:
4648
- - "NFR1: 在可行的情况下,AWS 服务的使用必须力求保持在免费套餐限制内。"
4649
-
4650
- - id: ui-goals
4651
- title: 用户界面设计目标
4652
- condition: PRD 包含 UX/UI 需求时
4653
- instruction: |
4654
- 捕获高层次的 UI/UX 愿景,以指导设计架构师并为创建用户故事提供信息。步骤:
4655
-
4656
- 1. 基于项目上下文,用有根据的猜测预先填充所有子部分。
4657
- 2. 将渲染后的完整部分呈现给用户。
4658
- 3. 清晰地告知用户哪些地方做了假设。
4659
- 4. 针对不清晰/缺失的元素或需要更具体说明的领域提出有针对性的问题。
4660
- 5. 这不是详细的 UI 规范——重点关注产品愿景和用户目标。
4661
- elicit: true
4662
- choices:
4663
- accessibility: [无, WCAG AA, WCAG AAA]
4664
- platforms: [响应式网页, 仅移动端, 仅桌面端, 跨平台]
4665
- sections:
4666
- - id: ux-vision
4667
- title: 整体 UX 愿景
4668
- - id: interaction-paradigms
4669
- title: 关键交互范式
4670
- - id: core-screens
4671
- title: 核心屏幕与视图
4672
- instruction: 从产品角度看,为实现 PRD 的价值和目标,最关键的屏幕或视图是什么?这旨在提供概念性的高层概览,以驱动粗略的史诗或用户故事。
4673
- examples:
4674
- - "登录屏幕"
4675
- - "主仪表盘"
4676
- - "项目详情页"
4677
- - "设置页面"
4678
- - id: accessibility
4679
- title: "无障碍性: {无|WCAG AA|WCAG AAA|自定义要求}"
4680
- - id: branding
4681
- title: 品牌
4682
- instruction: 是否有任何已知的品牌元素或风格指南必须被整合进来?
4683
- examples:
4684
- - "复制 20 世纪初黑白电影的观感,包括在页面或状态转换期间模拟胶片损坏或投影仪故障的动画效果。"
4685
- - "附件是我司品牌的全套调色板和设计元素。"
4686
- - id: target-platforms
4687
- title: "目标设备与平台: {响应式网页|仅移动端|仅桌面端|跨平台}"
4688
- examples:
4689
- - "响应式网页,以及所有移动平台"
4690
- - "仅限 iPhone"
4691
- - "ASCII 码 Windows 桌面"
4692
-
4693
- - id: technical-assumptions
4694
- title: 技术假设
4695
- instruction: |
4696
- 收集将指导架构师的技术决策。步骤:
4697
-
4698
- 1. 检查 .xiaoma-core/data/technical-preferences.yaml 或附加的技术偏好文件是否存在——用它来预填充选项。
4699
- 2. 询问用户关于:语言、框架、启动模板、库、API、部署目标。
4700
- 3. 对于未知项,根据项目目标和 MVP 范围提供指导。
4701
- 4. 记录所有技术选择及其理由(为什么这个选择适合该项目)。
4702
- 5. 这些将成为架构师的约束条件——务必具体和完整。
4703
- elicit: true
4704
- choices:
4705
- repository: [Monorepo, Polyrepo]
4706
- architecture: [Monolith, Microservices, Serverless]
4707
- testing: [仅单元测试, 单元+集成测试, 完整测试金字塔]
4708
- sections:
4709
- - id: repository-structure
4710
- title: "代码仓库结构: {Monorepo|Polyrepo|Multi-repo}"
4711
- - id: service-architecture
4712
- title: 服务架构
4713
- instruction: "关键决策 - 记录高层服务架构(例如,Monolith, Microservices, Monorepo 内的 Serverless 函数)。"
4714
- - id: testing-requirements
4715
- title: 测试要求
4716
- instruction: "关键决策 - 记录测试要求(仅单元测试、集成测试、e2e 测试、手动测试,以及是否需要方便手动测试的方法)。"
4717
- - id: additional-assumptions
4718
- title: 其他技术假设与请求
4719
- instruction: 在起草本文档的整个过程中,如果提出或发现任何其他适合架构师的技术假设,请在此处作为额外的项目符号添加。
4720
-
4721
- - id: epic-list
4722
- title: 史诗列表
4723
- instruction: |
4724
- 向用户呈现一份高层次的史诗列表以供批准。每个史诗应有一个标题和一个简短的(1句话)目标陈述。这使用户能在深入细节之前审阅整体结构。
4725
-
4726
- 关键:史诗必须遵循敏捷最佳实践,保持逻辑上的顺序:
4727
-
4728
- - 每个史诗都应交付一个重要的、端到端的、完全可部署且可测试的功能增量。
4729
- - 史诗 1 必须建立基础项目设施(应用设置、Git、CI/CD、核心服务),除非我们是向现有应用添加新功能。同时,它还应交付一个初始功能,即使只是一个健康检查路由或一个简单的金丝雀页面显示——在为第一个史诗编写用户故事时要记住这一点!
4730
- - 每个后续的史诗都在之前史诗功能的基础上构建,交付主要的功能模块,这些模块在部署时能为用户或业务提供切实的价值。
4731
- - 并非每个项目都需要多个史诗,一个史诗需要交付价值。例如,一个已完成的 API 即使 UI 尚未完成并计划在另一个史诗中实现,也可以交付价值。
4732
- - 倾向于设置较少的史诗,但要告知用户你的理由,并提供拆分选项,如果某些史诗看起来太大或关注点分散的话。
4733
- - 横切关注点应该贯穿于史诗和用户故事中,而不是作为最后的用户故事。例如,在一个史诗的最后一个故事中添加日志框架,或者在项目结束时作为最后一个史诗或故事来做,这将非常糟糕,因为我们从一开始就没有日志记录。
4734
- elicit: true
4735
- examples:
4736
- - "史诗 1:基础与核心设施:建立项目设置、认证和基本用户管理"
4737
- - "史诗 2:核心业务实体:创建和管理主要领域对象的 CRUD 操作"
4738
- - "史诗 3:用户工作流与交互:实现关键用户旅程和业务流程"
4739
- - "史诗 4:报告与分析:为用户提供洞察和数据可视化"
4740
-
4741
- - id: epic-details
4742
- title: 史诗 {{epic_number}} {{epic_title}}
4743
- repeatable: true
4744
- instruction: |
4745
- 在史诗列表被批准后,将每个史诗及其所有的用户故事和验收标准作为一个完整的审查单元呈现。
4746
-
4747
- 为每个史诗提供扩展的目标(2-3 句话描述所有故事将实现的目标和价值)。
4748
-
4749
- 关键的用户故事排序要求:
4750
-
4751
- - 每个史诗中的用户故事必须在逻辑上是顺序的。
4752
- - 每个故事都应该是一个“垂直切片”,交付完整的功能,除了项目基础的早期使能型故事。
4753
- - 任何故事都不应依赖于后续故事或史诗的工作。
4754
- - 识别并注明任何直接的前置故事。
4755
- - 关注“做什么”和“为什么”,而不是“怎么做”(将技术实现留给架构师),但要足够精确以支持故事之间逻辑上顺序的操作。
4756
- - 确保每个故事都交付明确的用户或业务价值,尽量避免使能型故事,而是将它们构建到交付价值的故事中。
4757
- - 为 AI 代理执行调整故事的大小:每个故事必须能由单个 AI 代理在一次专注的会话中完成,而不会出现上下文溢出。
4758
- - 想象一个“初级开发人员工作 2-4 小时”的场景——故事必须是小型的、专注的、自包含的。
4759
- - 如果一个故事看起来很复杂,只要它能交付一个垂直切片,就应进一步拆分。
4760
- elicit: true
4761
- template: "{{epic_goal}}"
4762
- sections:
4763
- - id: story
4764
- title: 用户故事 {{epic_number}}.{{story_number}} {{story_title}}
4765
- repeatable: true
4766
- template: |
4767
- 作为一名 {{user_type}},
4768
- 我想要 {{action}},
4769
- 以便 {{benefit}}。
4770
- sections:
4771
- - id: acceptance-criteria
4772
- title: 验收标准
4773
- type: numbered-list
4774
- item_template: "{{criterion_number}}: {{criteria}}"
4775
- repeatable: true
4776
- instruction: |
4777
- 定义清晰、全面且可测试的验收标准,这些标准应:
4778
-
4779
- - 从功能角度精确定义“完成”的含义。
4780
- - 明确无歧义,并作为验证的基础。
4781
- - 包括来自 PRD 的任何关键非功能性需求。
4782
- - 考虑后端/数据组件的本地可测试性。
4783
- - 在适用时,指定 UI/UX 需求和框架遵循情况。
4784
- - 避免应放在其他故事或 PRD 部分的横切关注点。
4785
-
4786
- - id: checklist-results
4787
- title: 检查清单结果报告
4788
- instruction: 在运行检查清单和起草提示之前,提议输出更新后的完整 PRD。如果输出,请与用户确认你将继续运行检查清单并生成报告。一旦用户确认,执行 pm-checklist 并在此部分填充结果。
4789
-
4790
- - id: next-steps
4791
- title: 后续步骤
4792
- sections:
4793
- - id: ux-expert-prompt
4794
- title: UX 专家提示
4795
- instruction: 此部分将包含给 UX 专家的提示,保持简短扼要,以启动使用本文档作为输入的架构创建模式。
4796
- - id: architect-prompt
4797
- title: 架构师提示
4798
- instruction: 此部分将包含给架构师的提示,保持简短扼要,以启动使用本文档作为输入的架构创建模式。
4799
- ==================== END: .xiaoma-core/templates/prd-tmpl.yaml ====================
4800
-
4801
6110
  ==================== START: .xiaoma-core/checklists/change-checklist.md ====================
4802
6111
  <!-- Powered by XiaoMa™ Core -->
4803
6112
 
@@ -7531,7 +8840,7 @@ sections:
7531
8840
  1. 如果是 REST API, 创建一个 OpenAPI 3.0 规范
7532
8841
  2. 如果是 GraphQL, 提供 GraphQL 模式
7533
8842
  3. 如果是 tRPC, 展示路由定义
7534
- 4. 包括来自史诗/故事的所有端点
8843
+ 4. 包括来自模块/故事的所有端点
7535
8844
  5. 基于数据模型定义请求/响应模式
7536
8845
  6. 记录认证要求
7537
8846
  7. 包括请求/响应示例