SuperAPI AI 工具集

tech-divergence

智能体与模型

查看项目

更新于 10-16 07:45

技能介绍

Tech Divergence 是一个用于评估技术实现方案选择的技能,其核心方法是使用 8 维度评分矩阵,并依据总分决定是自动推进还是进入人工决策检查点。

用途

该技能用于以下场景:在 Plan Mode Phase 2(Technical Diverge,技术分歧阶段)中使用;在确定某个具体架构或模式之前使用;当存在多个可行的实现方式时使用。

评分矩阵(8 个维度)

每个维度评分为 0(自动推进)或 1(计入检查点评分):

  • Pattern:0 表示代码库中已存在该模式;1 表示需要新模式。
  • Scope:0 表示单一领域;1 表示跨领域影响。
  • Data Model:0 表示在既有模型上新增字段;1 表示新增实体/表。
  • Dependencies:0 表示使用现有库;1 表示新增依赖。
  • API Surface:0 表示仅内部使用;1 表示公开接口或破坏性变更。
  • Reversibility:0 表示易于撤销;1 表示需要迁移。
  • Security:0 表示非敏感数据;1 表示涉及认证/权限。
  • Performance:0 表示简单 CRUD;1 表示涉及缓存、队列或优化。

Phase 1:收集上下文

1.1 查询 Pattern Library(Notion)

检查是否存在相似模式:

API-query-database: database_id: "[PATTERN_LIBRARY_DB_ID]" filter: property: "Domain" select: equals: "[current domain]"

1.2 搜索代码库

SemanticSearch: "How is [similar feature] implemented?" Grep: "[pattern name]" in relevant directories

1.3 查询 Context7(外部库)

如果正在考虑引入新库:

Context7 MCP:

  1. resolve-library-id: libraryName = "[library]"
  2. get-library-docs: topic = "best practices", mode = "info"

Phase 2:为每个维度评分

针对 8 个维度逐一评估并评分:

Technical Divergence Score

Dimension Score Rationale
Pattern 0/1 [Exists/New]
Scope 0/1 [Single/Cross-domain]
Data Model 0/1 [Field/Entity]
Dependencies 0/1 [Existing/New]
API Surface 0/1 [Internal/Public]
Reversibility 0/1 [Easy/Migration]
Security 0/1 [Non-sensitive/Auth]
Performance 0/1 [CRUD/Optimization]
TOTAL [0-8]

Phase 3:确定路径

如果评分 < 4:自动推进

Technical Approach: Auto-Proceed

Score: [N]/8 (below threshold)

Selected Approach: [Describe the approach]

Rationale:

  • Pattern exists: [reference]
  • Low cross-domain impact
  • Easy to reverse if needed

Proceeding to Commit Plan...

如果评分 >= 4:Gate 4(人工检查点)

Gate 4: Technical Approach Selection

Score: [N]/8 (threshold reached)

Why human input needed:

  • [List dimensions that scored 1]

Option A: [Name] (Conservative)

Approach: [Description] Effort: S Risk: Low Trade-off: [What you give up]

Option B: [Name] (Balanced)

Approach: [Description] Effort: M Risk: Medium Trade-off: [What you give up]

Option C: [Name] (Bold)

Approach: [Description] Effort: L Risk: Higher Trade-off: [What you give up]


Which approach would you like to proceed with? (A / B / C)

If you reject an option, I'll invoke decision-capture to record why.

Phase 4:记录决策

Gate 4 选择之后:

如果某个选项被拒绝,调用 decision-capture 技能;将选定方案记录到上下文中,供 Commit Plan 使用;如果确立了新模式,更新 Pattern Library。

与 Plan Mode 的集成

该技能在 Plan Mode Phase 2 中被调用:

Plan Mode Flow: Phase 1: APPETITE → Phase 2: TECHNICAL DIVERGE (this skill) → If score < 4: Auto-proceed If score >= 4: Gate 4 → Human selects Phase 3: COMMIT PLAN

使用的 MCP 工具

  • Notion MCP:查询 Pattern Library 数据库。
  • Context7 MCP:获取库的最佳实践。
  • SemanticSearch:查找代码库中已有的模式。
  • Grep:搜索具体实现。

评分的示例

低分示例(自动推进)

功能:向已有表添加新列

Dimension Score Rationale
Pattern 0 之前已做过添加列的操作
Scope 0 单一领域(表)
Data Model 0 添加字段而非实体
Dependencies 0 使用现有库
API Surface 0 仅内部使用
Reversibility 0 易于迁移
Security 0 非敏感数据
Performance 0 简单 CRUD
TOTAL 0 自动推进

高分示例(需要 Gate 4)

功能:添加实时协作

Dimension Score Rationale
Pattern 1 尚无 WebSocket 模式
Scope 1 影响认证、表、工作流
Data Model 1 新增 presence 实体
Dependencies 1 需要 socket.io
API Surface 1 新增 WS 端点
Reversibility 1 需要清理迁移
Security 1 涉及用户会话处理
Performance 1 需要连接池
TOTAL 8 需要 Gate 4

调用方式

由 Plan Mode Phase 2 自动调用,或手动使用 "use tech-divergence skill" 调用。