--- name: ai-ad-flow-orchestrator version: "1.1" status: active layer: skill owner: wade last_reviewed: 2025-12-07 sot_dependencies: required: - docs/sot/DEV_FLOW_SOT_v1.0.md # v1.1 (7 Flow 架构) - docs/sot/STATE_MACHINE.md - docs/sot/DATA_SCHEMA.md - docs/sot/BUSINESS_RULES.md - docs/sot/API_SOT.md optional: - docs/sot/ERROR_CODES_SOT.md sub_skills: - ai-ad-spec-governor # /sot-check - ai-ad-be-gen # /gen be - ai-ad-fe-gen # /gen fe - ai-ad-test-gen # /gen test - ai-master-architect # /review - ai-doc-system-auditor # /doc enhancement: enabled: true superclaude_patterns: - task_breakdown # 任务分解 - step_implementation # 步骤化执行 - analysis_pattern # 分析审计 internal_workflow: true sot_priority: true baseline: AI_CODE_FACTORY_DEV_GUIDE_v2.4, DEV_FLOW_SOT_v1.1, SoT Freeze v2.6 --- ────────────────────────────────────────────── ai-ad-flow-orchestrator 1.1 AI_AD_SYSTEM / 开发流程编排 Flow-Orchestrator / Multi-skill / Safe ────────────────────────────────────────────── 根据用户任务描述,自动识别适用的开发流程 (Flow), 输出完整的命令执行序列: /sot-check → /gen → /review → /doc 目标: - 任务开始前必须进行 SoT 对齐检查 - 代码生成必须受 SoT 约束 - 生成的代码必须经过审查 - 流程结束时必须更新相关文档 SoT 基准: DEV_FLOW_SOT_v1.1 (7 大 Flow) 最小输入: { task: string, // 任务描述,如 "实现充值审批功能" } 可选输入: { flow_type?: "BE_DEV_FLOW" | "FE_DEV_FLOW" | "API_FIX_FLOW" | "TEST_HARDEN_FLOW" | "DOC_FREEZE_FLOW" | "REFACTOR_FLOW" | "FULL_FLOW", target_module?: string, // 目标模块名,如 "topup", "reconciliation" skip_steps?: string[], // 跳过的步骤,如 ["doc"] } 命令映射 (DEV_FLOW_SOT §11): - /dev-flow be → BE_DEV_FLOW - /dev-flow fe → FE_DEV_FLOW - /dev-flow fix → API_FIX_FLOW - /dev-flow test → TEST_HARDEN_FLOW - /dev-flow doc → DOC_FREEZE_FLOW - /dev-flow full → FULL_FLOW - /dev-flow refactor → REFACTOR_FLOW 若 task 缺失 → 输出 Missing: task description 并停止。 成功输出: { flow_type: string, // 识别的流程类型 flow_name: string, // 流程中文名 command: string, // 对应的 /dev-flow 命令 command_sequence: [ // 命令执行序列 { step: number, command: string, purpose: string, expected_output: string } ], local_test_commands: string[], // 本地测试命令 freeze_checklist: string[], // 冻结检查项 } 失败输出: { error: string, suggestion: string, } 基于任务描述自动识别 Flow 类型 (7 大 Flow): - 新增后端 - 新增 API - 新增接口 - 实现 service - 实现服务 - 后端功能 - 新增模块 - 状态机流转 - 账本分录 - 后端开发 - 新增页面 - 新增组件 - 前端功能 - UI 开发 - React 组件 - 表单页面 - 列表页面 - 前端开发 - 修复接口 - 修复 API - Bug 修复 - 接口问题 - 返回值错误 - 参数校验 - 接口报错 - fix bug - 补充测试 - 测试覆盖 - 回归测试 - 边界测试 - 测试加固 - 单元测试 - 测试补齐 - 文档审计 - 文档冻结 - 文档治理 - 更新文档 - SoT 更新 - 文档检查 - 代码重构 - 重构代码 - 优化代码 - 代码优化 - 去重复 - 提取公共 - 性能优化 - 技术债 - refactor - 不得改变业务行为 - 不得修改 SoT 定义 - 输入/输出契约保持不变 - 完整功能 - 端到端 - 全栈开发 - 前后端 - MVP - 新模块开发 - 完整模块 BE_DEV_FLOW → FE_DEV_FLOW → TEST_HARDEN_FLOW → DOC_FREEZE_FLOW 若无法识别 → 默认 BE_DEV_FLOW 并提示用户确认。 Phase 1: 任务分析 ───────────────── 1. 接收用户任务描述 2. 提取关键词,匹配 Flow 类型 (7 大 Flow) 3. 若用户指定 flow_type,使用指定值 4. 输出 Flow 类型确认 + 对应 /dev-flow 命令 Phase 2: 命令序列生成 ───────────────────── 1. 加载对应 Flow 模板 (参考 DEV_FLOW_SOT) 2. 替换 {module}, {component} 等占位符 3. 若用户指定 skip_steps,移除对应步骤 4. 输出完整命令序列 Phase 3: 执行指导 ───────────────── 1. 输出命令执行顺序 2. 提示每步的预期产出 3. 提供本地测试命令 4. 输出冻结检查清单 ## Flow Orchestration Report ### 任务识别 - **任务**: {task} - **Flow 类型**: {flow_type} - **Flow 名称**: {flow_name} - **命令**: {command} - **复杂度**: {complexity} - **SoT 基准**: DEV_FLOW_SOT v1.1 ### 命令执行序列 | Step | 命令 | 目的 | 预期产出 | |------|------|------|----------| | 1 | ... | ... | ... | ### 执行提示 ``` ⚠️ 命令不支持管道串联,请逐条执行: Step 1: /sot-check ... → 确认 SoT 规则后继续 Step 2: /gen be ... → 检查生成代码后继续 ... ``` ### 本地测试 ```bash # 代码测试 pytest backend/tests/ -v # 类型检查 mypy backend/services/{module}_service.py ``` ### 冻结检查清单 - [ ] 所有 SoT 规则已遵循 - [ ] 代码审查通过 - [ ] 本地测试通过 - [ ] 相关文档已更新 无法识别 Flow 类型 默认 BE_DEV_FLOW,提示用户确认 任务未指明目标模块 询问用户补充模块名 /sot-check 发现 P0 违规 中断流程,输出违规详情,等待修复 REFACTOR_FLOW 检测到业务行为变化 中断流程,提示用户确认是否改为 BE_DEV_FLOW task: "实现充值审批功能" flow_type: BE_DEV_FLOW command: /dev-flow be 实现充值审批功能 command_sequence: 1. /sot-check docs/sot/ 2. /gen be "生成 topup_approval 的 Pydantic Schema" 3. /gen be "实现 topup_approval 的 Service 层" 4. /gen be "实现 topup_approval 的 Router 层" 5. /gen test "为 topup_approval 生成状态机测试 + API 测试" 6. /review backend/services/topup_approval_service.py task: "修复日报导出接口返回空数据问题" flow_type: API_FIX_FLOW command: /dev-flow fix 修复日报导出接口返回空数据问题 command_sequence: 1. /sot-check backend/routers/daily_report.py 2. /gen be "修复日报导出接口返回空数据问题" 3. /gen test "为日报导出接口生成回归测试" 4. /review backend/routers/daily_report.py task: "重构 topup_service.py 的审批逻辑" flow_type: REFACTOR_FLOW command: /dev-flow refactor 重构 topup_service.py 的审批逻辑 constraints: - 不得改变业务行为 - 不得修改 SoT 定义 command_sequence: 1. pytest backend/tests/ --tb=short > refactor_baseline.txt 2. /sot-check backend/services/topup_service.py 3. /review backend/services/topup_service.py 4. /gen be "重构 topup_service.py 的审批逻辑" 5. /sot-check backend/services/topup_service.py 6. pytest + diff 验证 task: "实现对账模块" flow_type: FULL_FLOW command: /dev-flow full 实现对账模块 phases: Phase 1: BE_DEV_FLOW (后端) Phase 2: FE_DEV_FLOW (前端) Phase 3: TEST_HARDEN_FLOW (测试加固) Phase 4: DOC_FREEZE_FLOW (文档冻结)