ADR Decision Extraction
Extract architectural decisions from conversation context for ADR generation.
Detection Signals
| Signal Type | Examples |
|---|
| Explicit markers | INLINECODE0 , "decided:", "the decision is" |
| Choice patterns |
"let's go with X", "we'll use Y", "choosing Z" |
| Trade-off discussions | "X vs Y", "pros/cons", "considering alternatives" |
| Problem-solution pairs | "the problem is... so we'll..." |
Extraction Rules
Explicit Tags (Guaranteed Inclusion)
Text marked with [ADR] is always extracted:
CODEBLOCK0
These receive confidence: "high" automatically.
AI-Detected Decisions
Patterns detected without explicit tags require confidence assessment:
| Confidence | Criteria |
|---|
| high | Clear statement of choice with rationale |
| medium |
Implied decision from action taken |
|
low | Contextual inference, may need verification |
Output Format
CODEBLOCK1
Field Definitions
| Field | Required | Description |
|---|
| INLINECODE3 | Yes | Concise decision summary |
| INLINECODE4 |
Yes | Problem or context driving the decision |
|
chosen_option | Yes | The selected solution or approach |
|
alternatives_discussed | No | Other options mentioned (empty array if none) |
|
drivers | No | Factors influencing the decision |
|
confidence | Yes |
high,
medium, or
low |
|
source_context | No | Brief description of where decision appeared |
Extraction Workflow
- 1. Scan for explicit markers - Find all
[ADR] tagged content - Identify choice patterns - Look for decision language
- Extract trade-off discussions - Capture alternatives and reasoning
- Assess confidence - Rate each non-explicit decision
- Capture context - Note surrounding discussion for ADR writer
Pattern Examples
High Confidence
CODEBLOCK2
Extracts:
- - Title: Use Redis for caching
- Problem: Need fast caching with TTL
- Chosen: Redis
- Alternatives: Memcached
- Drivers: sub-millisecond latency, native TTL, persistence
- Confidence: high
Medium Confidence
CODEBLOCK3
Extracts:
- - Title: Use TypeScript for frontend
- Problem: Language choice for frontend
- Chosen: TypeScript
- Alternatives: (none stated)
- Drivers: consistency with backend
- Confidence: medium
Low Confidence
CODEBLOCK4
Extracts:
- - Title: REST API architecture
- Problem: API design approach
- Chosen: REST
- Alternatives: (none stated)
- Drivers: (none stated)
- Confidence: low
Best Practices
Context Capture
Always capture sufficient context for the ADR writer:
- - What was the discussion about?
- Who was involved (if known)?
- What prompted the decision?
Merge Related Decisions
If multiple statements relate to the same decision, consolidate them:
- - Combine alternatives from different mentions
- Aggregate drivers
- Use highest confidence level
Flag Ambiguity
When decisions are unclear or contradictory:
- - Note the ambiguity in INLINECODE14
- Set confidence to INLINECODE15
- Include all interpretations if multiple exist
When to Use This Skill
- - Analyzing session transcripts for ADR generation
- Reviewing conversation history for documentation
- Extracting decisions from design discussions
- Preparing input for ADR writing tools
ADR 决策提取
从对话上下文中提取架构决策以生成ADR。
检测信号
| 信号类型 | 示例 |
|---|
| 显式标记 | [ADR]、“已决定:”、“决策是” |
| 选择模式 |
“我们采用X”、“我们将使用Y”、“选择Z” |
| 权衡讨论 | “X与Y对比”、“优缺点”、“考虑备选方案” |
| 问题-解决方案对 | “问题是……所以我们将……” |
提取规则
显式标签(保证包含)
标记有[ADR]的文本始终被提取:
[ADR] 由于ACID需求,使用PostgreSQL存储用户数据
这些自动获得confidence: high。
AI检测的决策
无显式标签检测到的模式需要置信度评估:
从采取的行动中隐含的决策 |
|
低 | 上下文推断,可能需要验证 |
输出格式
json
{
decisions: [
{
title: 使用PostgreSQL存储用户数据,
problem: 需要ACID事务处理财务记录,
chosen_option: PostgreSQL,
alternatives_discussed: [MongoDB, SQLite],
drivers: [ACID合规性, 团队熟悉度],
confidence: high,
source_context: 规划阶段关于数据库选择的讨论
}
]
}
字段定义
| 字段 | 必需 | 描述 |
|---|
| title | 是 | 简洁的决策摘要 |
| problem |
是 | 驱动决策的问题或上下文 |
| chosen_option | 是 | 选定的解决方案或方法 |
| alternatives_discussed | 否 | 提及的其他选项(若无则为空数组) |
| drivers | 否 | 影响决策的因素 |
| confidence | 是 | high、medium或low |
| source_context | 否 | 决策出现位置的简要描述 |
提取工作流程
- 1. 扫描显式标记 - 查找所有[ADR]标记的内容
- 识别选择模式 - 寻找决策语言
- 提取权衡讨论 - 捕获备选方案和推理过程
- 评估置信度 - 对每个非显式决策进行评级
- 捕获上下文 - 记录周围讨论内容供ADR编写者使用
模式示例
高置信度
我们决定使用Redis进行缓存,因为它具有亚毫秒级延迟
和原生TTL支持。曾考虑过Memcached,但缺乏持久化能力。
提取结果:
- - 标题:使用Redis进行缓存
- 问题:需要支持TTL的快速缓存
- 选择:Redis
- 备选方案:Memcached
- 驱动因素:亚毫秒级延迟、原生TTL、持久化
- 置信度:高
中置信度
前端我们采用TypeScript吧,因为后端已经在使用了。
提取结果:
- - 标题:前端使用TypeScript
- 问题:前端语言选择
- 选择:TypeScript
- 备选方案:(未说明)
- 驱动因素:与后端保持一致
- 置信度:中
低置信度
这个API使用REST端点似乎运行良好。
提取结果:
- - 标题:REST API架构
- 问题:API设计方法
- 选择:REST
- 备选方案:(未说明)
- 驱动因素:(未说明)
- 置信度:低
最佳实践
上下文捕获
始终为ADR编写者捕获足够的上下文:
- - 讨论的内容是什么?
- 涉及哪些人(如果知道)?
- 是什么促使了这个决策?
合并相关决策
如果多个陈述涉及同一决策,请合并它们:
- - 合并不同提及中的备选方案
- 汇总驱动因素
- 使用最高置信度级别
标记歧义
当决策不明确或矛盾时:
- - 在source_context中注明歧义
- 将置信度设为low
- 如果存在多种解释,全部包含
何时使用此技能
- - 分析会话记录以生成ADR
- 审查对话历史以进行文档记录
- 从设计讨论中提取决策
- 为ADR编写工具准备输入