一键导入
th-workflow-decision-engine
PRD驱动工作流的决策大脑 - 智能判断何时使用搜索、代码分析、多模型聚合。 作为子Skill被 th-prd-driven-dev-workflow 调用,负责工具选择和策略决策。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
PRD驱动工作流的决策大脑 - 智能判断何时使用搜索、代码分析、多模型聚合。 作为子Skill被 th-prd-driven-dev-workflow 调用,负责工具选择和策略决策。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
PRD 驱动的完整开发工作流 - 从用户故事分析到自动化测试的端到端流程。 当用户需要"一条龙开发"、"全自动开发"、"从需求到代码"、"先分析PRD再开发"、 "多模型分析后自动开发"、"完整开发流程"、"从需求分析到测试"或任何涉及 PRD分析→需求整合→代码生成→自动化测试的连续工作时,**必须**使用此技能。 整合多模型聚合、Kimi深度整合、PRD生成、多模型代码审查、代码开发、自动化测试等能力。 **新增**: 智能决策大脑(th-workflow-decision-engine) - 自动判断何时使用GitNexus代码分析、 unified-search联网搜索、多模型聚合,测试失败时智能选择修复策略。
动态 Agent 生成器(母体模式)。当用户需要处理复杂项目时,自动分析需求并生成定制化专业 Agent 团队。接收项目描述、技术栈、版本号、约束条件,输出完整的 Agent 配置和启动命令。触发词:需要专业团队、生成 Agent、创建定制化 Agent、复杂项目团队、动态生成 Agent。
Arch Linux 系统特性(PEP 668、AUR Helpers)
浏览器交互自动化:网页测试、表单填写、截图、数据提取。触发词:打开网页、填写表单、网页截图。
系统化代码审查:安全性、性能、可维护性、正确性、测试覆盖。触发词:代码审查、review 代码、PR 审查。
需求演进与决策追踪器 - 当用户提出零散需求、抱怨某个功能、或讨论产品方向时,**必须**使用此技能。通过逐级剖析推导出落地方案,并在每个关键节点**强制暂停**等待用户确认。适用于:记录决策、需求演进、功能推演、架构选型、重构方案确定。触发词:记录决策、需求演进、功能演进、决策追踪、需求推演、演进记录、这个需求怎么演化、帮我推演这个需求。
| name | th-workflow-decision-engine |
| description | PRD驱动工作流的决策大脑 - 智能判断何时使用搜索、代码分析、多模型聚合。 作为子Skill被 th-prd-driven-dev-workflow 调用,负责工具选择和策略决策。 |
| triggers | ["工作流决策","智能工具选择","需要搜索吗","需要代码分析吗"] |
智能决策何时使用搜索、GitNexus分析、多模型聚合
interface DecisionContext {
phase: number; // 当前阶段 1-7
task: string; // 任务描述
context?: {
code?: string; // 相关代码片段
error?: string; // 错误信息
prd?: string; // PRD内容
files?: string[]; // 相关文件
};
history?: string[]; // 历史决策
}
interface DecisionResult {
tools: string[]; // 推荐使用的工具
priority: 'high' | 'medium' | 'low';
reasoning: string; // 决策理由
searchQuery?: string; // 搜索建议
analysisTarget?: string; // 分析目标
}
| 场景 | 决策 | 工具 |
|---|---|---|
| 新技术/框架 | 搜索 + 多模型聚合 | unified-search, th-model-compare-search |
| 已有PRD | 直接分析 | Read |
| 需求模糊 | 搜索竞品 | unified-search |
自动触发 th-model-compare-search - 无需决策
自动触发 kimi-cli - 无需决策
自动触发 requirement-to-prd - 无需决策
// 代码审查决策逻辑
function decideCodeReview(context) {
const tools = ['codebundle'];
// 如果涉及复杂依赖
if (context.files?.length > 5 || context.hasSharedCode) {
tools.push('th-gitnexus-assistant');
}
// 如果涉及外部API/库
if (context.hasExternalDeps) {
tools.push('unified-search');
}
// 必定使用多模型审查
tools.push('th-model-compare-search');
return { tools, priority: 'high' };
}
| 场景 | 决策 |
|---|---|
| Bug修复 | th-gitnexus-assistant (影响分析) → prd-to-code |
| 新功能 | unified-search (最佳实践) → prd-to-code |
| 复杂算法 | th-deep-coder2 → prd-to-code |
// 测试失败时的决策
function decideOnTestFailure(error, context) {
const tools = [];
const errorMsg = error.toLowerCase();
// 网络/API 错误
if (errorMsg.includes('network') || errorMsg.includes('api') || errorMsg.includes('timeout')) {
tools.push('unified-search'); // 搜索解决方案
}
// 代码逻辑错误
if (errorMsg.includes('undefined') || errorMsg.includes('null') || errorMsg.includes('type')) {
tools.push('th-gitnexus-assistant'); // 分析代码影响
}
// 复杂错误 - 多模型分析
if (tools.length === 0 || errorMsg.includes('race') || errorMsg.includes('deadlock')) {
tools.push('th-model-compare-search');
}
return {
tools,
priority: 'high',
reasoning: '基于错误类型智能选择修复策略'
};
}
| 问题类型 | 首选工具 | 备选工具 | 理由 |
|---|---|---|---|
| 需要最新信息 | unified-search | web-fetch | 联网获取最新文档 |
| 代码影响分析 | th-gitnexus-assistant | mcp__gitnexus__impact | 知识图谱分析 |
| 复杂问题诊断 | th-model-compare-search | th-deep-coder2 | 多模型聚合 |
| 代码实现 | prd-to-code | Agent | PRD驱动开发 |
| 安全审查 | th-gitnexus-assistant + security-reviewer | - | 代码图谱+专业审查 |
// 输入
const context = {
phase: 7,
task: "修复测试失败",
context: {
error: "WebSocket connection timeout",
stack: "...",
files: ["src/websocket/handler.ts"]
}
};
// 决策
await Skill({
name: "th-workflow-decision-engine",
args: JSON.stringify(context)
});
// 输出
{
tools: ['unified-search', 'th-model-compare-search'],
priority: 'high',
reasoning: 'WebSocket超时错误可能涉及网络配置或代码逻辑,先搜索最佳实践,再用多模型诊断',
searchQuery: 'WebSocket connection timeout Node.js 解决方案'
}
// 输入
const context = {
phase: 6,
task: "修复竞态条件bug",
context: {
error: "connection already exists",
files: ["src/connection/manager.ts", "src/websocket/handler.ts"]
}
};
// 决策输出
{
tools: ['th-gitnexus-assistant', 'th-deep-coder2', 'prd-to-code'],
priority: 'high',
reasoning: '竞态条件需要代码影响分析确定修复范围,再用深度代码分析找出根因',
analysisTarget: "connection manager race condition"
}
// 阶段5: 代码审查准备 - 智能工具选择
const reviewDecision = await Skill({
name: "th-workflow-decision-engine",
args: JSON.stringify({
phase: 5,
task: "代码审查",
context: { files: changedFiles }
})
});
// 根据决策执行
if (reviewDecision.tools.includes('th-gitnexus-assistant')) {
// 执行影响分析
await analyzeImpactWithGitNexus();
}
if (reviewDecision.tools.includes('unified-search')) {
// 搜索最佳实践
await searchBestPractices();
}
// 执行多模型代码审查
await Skill({ name: "th-model-compare-search", ... });
// 测试失败处理
if (!testPassed) {
const fixDecision = await Skill({
name: "th-workflow-decision-engine",
args: JSON.stringify({
phase: 7,
task: "修复测试失败",
context: { error: testError }
})
});
// 执行推荐的修复流程
for (const tool of fixDecision.tools) {
await Skill({ name: tool, ... });
}
}
| 工具失败 | 降级到 | 说明 |
|---|---|---|
th-gitnexus-assistant | Grep + Read | 手动代码搜索 |
unified-search | web-fetch | 单源搜索 |
th-model-compare-search | kimi-cli | 单模型分析 |
th-deep-coder2 | code-reviewer Agent | 代码审查Agent |
版本: v1.0 | 决策大脑 for th-prd-driven-dev-workflow