universal-dev-standards 5.14.0 → 5.16.0
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.
- package/bin/uds.js +2 -0
- package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +31 -0
- package/bundled/ai/standards/ai-instruction-standards.ai.yaml +190 -3
- package/bundled/ai/standards/forward-derivation-standards.ai.yaml +23 -0
- package/bundled/ai/standards/knowledge-graph-memory.ai.yaml +83 -0
- package/bundled/core/acceptance-criteria-traceability.md +46 -0
- package/bundled/core/ai-instruction-standards.md +136 -11
- package/bundled/core/forward-derivation-standards.md +19 -0
- package/bundled/core/knowledge-graph-memory.md +119 -0
- package/bundled/locales/COVERAGE.md +226 -0
- package/bundled/locales/zh-CN/CHANGELOG.md +42 -3
- package/bundled/locales/zh-CN/README.md +1 -1
- package/bundled/locales/zh-CN/SECURITY.md +1 -1
- package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +46 -0
- package/bundled/locales/zh-CN/core/ai-instruction-standards.md +111 -5
- package/bundled/locales/zh-CN/core/forward-derivation-standards.md +19 -0
- package/bundled/locales/zh-CN/skills/ac-coverage/SKILL.md +194 -0
- package/bundled/locales/zh-CN/skills/adr-assistant/SKILL.md +135 -40
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +217 -63
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +599 -0
- package/bundled/locales/zh-CN/skills/commands/brainstorm.md +92 -25
- package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +78 -16
- package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +85 -26
- package/bundled/locales/zh-CN/skills/deploy-assistant/SKILL.md +189 -0
- package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +110 -0
- package/bundled/locales/zh-CN/skills/dev-methodology/guide.md +255 -0
- package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +70 -11
- package/bundled/locales/zh-CN/skills/journey-test-assistant/SKILL.md +209 -0
- package/bundled/locales/zh-CN/skills/knowledge-graph/SKILL.md +58 -0
- package/bundled/locales/zh-CN/skills/knowledge-graph/guide.md +74 -0
- package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +125 -8
- package/bundled/locales/zh-CN/skills/observability-assistant/guide.md +188 -0
- package/bundled/locales/zh-CN/skills/orchestrate/SKILL.md +173 -0
- package/bundled/locales/zh-CN/skills/plan/SKILL.md +240 -0
- package/bundled/locales/zh-CN/skills/push/SKILL.md +242 -0
- package/bundled/locales/zh-CN/skills/retrospective-assistant/SKILL.md +104 -36
- package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +88 -32
- package/bundled/locales/zh-CN/skills/runbook-assistant/guide.md +216 -0
- package/bundled/locales/zh-CN/skills/skill-builder/SKILL.md +149 -0
- package/bundled/locales/zh-CN/skills/slo-assistant/guide.md +188 -0
- package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +86 -0
- package/bundled/locales/zh-CN/skills/spec-derivation/guide.md +476 -0
- package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +155 -81
- package/bundled/locales/zh-CN/skills/sweep/SKILL.md +151 -0
- package/bundled/locales/zh-CN/skills/testing-guide/SKILL.md +207 -110
- package/bundled/locales/zh-TW/CHANGELOG.md +46 -3
- package/bundled/locales/zh-TW/README.md +1 -1
- package/bundled/locales/zh-TW/SECURITY.md +1 -1
- package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +46 -0
- package/bundled/locales/zh-TW/core/ai-instruction-standards.md +130 -5
- package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +222 -5
- package/bundled/locales/zh-TW/core/contract-testing-standards.md +184 -5
- package/bundled/locales/zh-TW/core/cross-flow-regression.md +192 -5
- package/bundled/locales/zh-TW/core/forward-derivation-standards.md +19 -0
- package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +127 -0
- package/bundled/locales/zh-TW/core/release-readiness-gate.md +186 -5
- package/bundled/locales/zh-TW/core/self-review-protocol.md +9 -1
- package/bundled/locales/zh-TW/skills/ac-coverage/SKILL.md +192 -0
- package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +21 -42
- package/bundled/locales/zh-TW/skills/ai-collaboration-standards/SKILL.md +5 -1
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +212 -59
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +266 -579
- package/bundled/locales/zh-TW/skills/commands/brainstorm.md +91 -26
- package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +77 -15
- package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +75 -16
- package/bundled/locales/zh-TW/skills/deploy-assistant/SKILL.md +187 -0
- package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +108 -0
- package/bundled/locales/zh-TW/skills/dev-methodology/guide.md +255 -0
- package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +125 -64
- package/bundled/locales/zh-TW/skills/journey-test-assistant/SKILL.md +222 -0
- package/bundled/locales/zh-TW/skills/knowledge-graph/SKILL.md +56 -0
- package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +74 -0
- package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +128 -11
- package/bundled/locales/zh-TW/skills/observability-assistant/guide.md +188 -0
- package/bundled/locales/zh-TW/skills/orchestrate/SKILL.md +173 -0
- package/bundled/locales/zh-TW/skills/plan/SKILL.md +240 -0
- package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +5 -1
- package/bundled/locales/zh-TW/skills/push/SKILL.md +242 -0
- package/bundled/locales/zh-TW/skills/retrospective-assistant/SKILL.md +94 -28
- package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +84 -28
- package/bundled/locales/zh-TW/skills/runbook-assistant/guide.md +216 -0
- package/bundled/locales/zh-TW/skills/skill-builder/SKILL.md +165 -0
- package/bundled/locales/zh-TW/skills/slo-assistant/guide.md +188 -0
- package/bundled/locales/zh-TW/skills/spec-derivation/SKILL.md +83 -0
- package/bundled/locales/zh-TW/skills/spec-derivation/guide.md +476 -0
- package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +148 -77
- package/bundled/locales/zh-TW/skills/sweep/SKILL.md +149 -0
- package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +141 -44
- package/bundled/skills/adr-assistant/SKILL.md +1 -1
- package/bundled/skills/ai-collaboration-standards/SKILL.md +1 -1
- package/bundled/skills/ai-friendly-architecture/SKILL.md +1 -1
- package/bundled/skills/ai-instruction-standards/SKILL.md +1 -1
- package/bundled/skills/api-design-assistant/SKILL.md +1 -1
- package/bundled/skills/audit-assistant/SKILL.md +1 -1
- package/bundled/skills/brainstorm-assistant/SKILL.md +142 -106
- package/bundled/skills/brainstorm-assistant/guide.md +256 -661
- package/bundled/skills/ci-cd-assistant/SKILL.md +1 -1
- package/bundled/skills/commands/brainstorm.md +51 -30
- package/bundled/skills/contract-test-assistant/SKILL.md +1 -1
- package/bundled/skills/database-assistant/SKILL.md +1 -1
- package/bundled/skills/deploy-assistant/SKILL.md +1 -1
- package/bundled/skills/documentation-guide/SKILL.md +1 -1
- package/bundled/skills/error-code-guide/SKILL.md +1 -1
- package/bundled/skills/git-workflow-guide/SKILL.md +1 -1
- package/bundled/skills/incident-response-assistant/SKILL.md +1 -1
- package/bundled/skills/journey-test-assistant/SKILL.md +1 -1
- package/bundled/skills/knowledge-graph/SKILL.md +58 -0
- package/bundled/skills/knowledge-graph/guide.md +69 -0
- package/bundled/skills/logging-guide/SKILL.md +1 -1
- package/bundled/skills/observability-assistant/SKILL.md +1 -1
- package/bundled/skills/orchestrate/SKILL.md +1 -1
- package/bundled/skills/plan/SKILL.md +1 -1
- package/bundled/skills/pr-automation-assistant/SKILL.md +1 -1
- package/bundled/skills/project-structure-guide/SKILL.md +1 -1
- package/bundled/skills/push/SKILL.md +1 -1
- package/bundled/skills/retrospective-assistant/SKILL.md +1 -1
- package/bundled/skills/reverse-engineer/SKILL.md +1 -1
- package/bundled/skills/runbook-assistant/SKILL.md +1 -1
- package/bundled/skills/security-assistant/SKILL.md +1 -1
- package/bundled/skills/security-scan-assistant/SKILL.md +1 -1
- package/bundled/skills/slo-assistant/SKILL.md +1 -1
- package/bundled/skills/sweep/SKILL.md +1 -1
- package/bundled/skills/testing-guide/SKILL.md +1 -1
- package/package.json +2 -2
- package/src/commands/check.js +80 -0
- package/src/commands/init.js +8 -1
- package/src/commands/update.js +49 -14
- package/src/i18n/messages.js +32 -5
- package/src/installers/skills-installer.js +49 -0
- package/src/lint/i18n.js +424 -0
- package/src/utils/config-manager.js +39 -0
- package/src/utils/skills-installer.js +39 -7
- package/standards-registry.json +16 -4
- package/bundled/locales/zh-TW/docs/SKILL-FALLBACK-GUIDE.md +0 -407
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ac-coverage
|
|
3
|
+
source: ../../../../skills/ac-coverage/SKILL.md
|
|
4
|
+
source_version: 1.0.0
|
|
5
|
+
translation_version: 1.0.0
|
|
6
|
+
last_synced: 2026-06-02
|
|
7
|
+
source_hash: f8358fa818e4
|
|
8
|
+
scope: universal
|
|
9
|
+
status: current
|
|
10
|
+
description: "[UDS] 分析验收条件(AC)与测试之间的追踪关系并生成覆盖率报告"
|
|
11
|
+
allowed-tools: Read, Grep, Glob
|
|
12
|
+
argument-hint: "[规格文件路径]"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# AC 覆盖率助手
|
|
16
|
+
|
|
17
|
+
> **语言**: [English](../../../../skills/ac-coverage/SKILL.md) | 简体中文
|
|
18
|
+
|
|
19
|
+
分析验收条件(AC)与测试之间的追踪关系,并生成覆盖率报告。
|
|
20
|
+
|
|
21
|
+
## 与 `/coverage` 的区别
|
|
22
|
+
|
|
23
|
+
| 方面 | `/coverage` | `/ac-coverage` |
|
|
24
|
+
|------|-------------|----------------|
|
|
25
|
+
| **范围** | 代码层级(行数/分支/函数) | 需求层级(AC 对应测试) |
|
|
26
|
+
| **输入** | 源代码 + 测试运行器 | SPEC 文件 + 测试标注 |
|
|
27
|
+
| **问题** | 「代码测试了多少?」 | 「哪些 AC 有测试?」 |
|
|
28
|
+
| **输出** | 覆盖率百分比 | 追踪矩阵 + 缺口报告 |
|
|
29
|
+
|
|
30
|
+
## 工作流程
|
|
31
|
+
|
|
32
|
+
1. **解析 SPEC** — 从规格文件中抽取 AC 定义(AC-1, AC-2, ...)
|
|
33
|
+
2. **扫描测试** — 依标准链接约定搜索测试文件中的 `@AC` 与 `@SPEC` 标注
|
|
34
|
+
3. **构建矩阵** — 将每个 AC 对应到其测试引用(文件、测试名称、行号)
|
|
35
|
+
4. **分类状态** — 将每个 AC 标记为 ✅ 已覆盖、⚠️ 部分覆盖、或 ❌ 未覆盖
|
|
36
|
+
5. **计算覆盖率** — 套用公式:`覆盖率 % = (已覆盖 + 部分覆盖 × 0.5) / 总数 × 100`
|
|
37
|
+
6. **生成报告** — 输出标准化的 Markdown 报告
|
|
38
|
+
|
|
39
|
+
## 链接标注约定
|
|
40
|
+
|
|
41
|
+
测试**必须**使用标准标注引用其来源 AC:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
// TypeScript/JavaScript
|
|
45
|
+
describe('AC-1: User login with valid credentials', () => {
|
|
46
|
+
// @AC AC-1
|
|
47
|
+
// @SPEC SPEC-001
|
|
48
|
+
it('should redirect to dashboard on successful login', () => { ... });
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
# Python
|
|
54
|
+
class TestAC1_UserLogin:
|
|
55
|
+
"""AC-1: User login with valid credentials
|
|
56
|
+
@AC AC-1
|
|
57
|
+
@SPEC SPEC-001
|
|
58
|
+
"""
|
|
59
|
+
def test_redirect_to_dashboard(self): ...
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```gherkin
|
|
63
|
+
# BDD Feature
|
|
64
|
+
@SPEC-001 @AC-1
|
|
65
|
+
Scenario: User login with valid credentials
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 覆盖率门槛
|
|
69
|
+
|
|
70
|
+
| 门槛 | 默认值 | 强制等级 |
|
|
71
|
+
|------|--------|----------|
|
|
72
|
+
| **签入(Check-in)** | 80% | feature branch 合并必要条件 |
|
|
73
|
+
| **发布(Release)** | 100% | 生产环境发布必要条件 |
|
|
74
|
+
| **警告(Warning)** | 60% | 触发覆盖率警告 |
|
|
75
|
+
|
|
76
|
+
门槛可通过 `--threshold` 参数或项目配置文件调整。
|
|
77
|
+
|
|
78
|
+
## 四层追溯(`--full` 模式)
|
|
79
|
+
|
|
80
|
+
使用 `--full` 标记将追溯从 2 层(AC→Test)扩展为 4 层。
|
|
81
|
+
|
|
82
|
+
### 追溯层次
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Layer 0:需求 / 用户故事 (REQ)
|
|
86
|
+
↓ (定义)
|
|
87
|
+
Layer 1:验收条件 (AC)
|
|
88
|
+
↓ (@AC 标注)
|
|
89
|
+
Layer 2:测试用例
|
|
90
|
+
↓ (覆盖)
|
|
91
|
+
Layer 3:源代码 (@implements)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 各层标注约定
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// Layer 3→1:代码引用 AC
|
|
98
|
+
// @implements AC-1, AC-2
|
|
99
|
+
function authenticate(user: string, pass: string) { ... }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```markdown
|
|
103
|
+
<!-- Layer 0→1:SPEC 中的需求 -->
|
|
104
|
+
## Requirements
|
|
105
|
+
### REQ-1:用户验证
|
|
106
|
+
- AC-1: 给定有效凭证,当登录时,则验证通过
|
|
107
|
+
- AC-2: 给定无效凭证,当登录时,则被拒绝
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 完整追溯报告
|
|
111
|
+
|
|
112
|
+
```markdown
|
|
113
|
+
## 四层追溯矩阵
|
|
114
|
+
|
|
115
|
+
| 需求 | AC | 测试 | 代码 | 状态 |
|
|
116
|
+
|------|-----|------|------|------|
|
|
117
|
+
| REQ-1 | AC-1 | auth.test.ts:15 | auth.ts:42 | ✅ 完整 |
|
|
118
|
+
| REQ-1 | AC-2 | auth.test.ts:30 | auth.ts:58 | ✅ 完整 |
|
|
119
|
+
| REQ-2 | AC-3 | — | dashboard.ts:10 | ⚠️ 缺测试 |
|
|
120
|
+
| REQ-3 | AC-4 | export.test.ts:5 | — | ⚠️ 缺代码 |
|
|
121
|
+
|
|
122
|
+
### 缺口摘要
|
|
123
|
+
- Layer 0→1: 2 个需求未对应 AC
|
|
124
|
+
- Layer 1→2: 1 个 AC 未对应测试
|
|
125
|
+
- Layer 2→3: 0 个测试未对应代码
|
|
126
|
+
- Layer 3→1: 3 个代码文件未对应 AC
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 反向追溯
|
|
130
|
+
|
|
131
|
+
使用 `--trace-code <path>` 从代码反向追溯到需求。
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
/ac-coverage --trace-code src/auth.ts
|
|
135
|
+
# 输出:
|
|
136
|
+
# src/auth.ts:42 → @implements AC-1 → REQ-1 (SPEC-AUTH-001)
|
|
137
|
+
# src/auth.ts:58 → @implements AC-2 → REQ-1 (SPEC-AUTH-001)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 报告格式
|
|
141
|
+
|
|
142
|
+
生成的报告遵循 `core/acceptance-criteria-traceability.md` 的标准格式:
|
|
143
|
+
|
|
144
|
+
```markdown
|
|
145
|
+
# AC 覆盖率报告
|
|
146
|
+
|
|
147
|
+
**规格**: SPEC-001 — 功能名称
|
|
148
|
+
**生成时间**: 2026-03-18
|
|
149
|
+
**覆盖率**: 75% (6/8 AC)
|
|
150
|
+
|
|
151
|
+
## 摘要
|
|
152
|
+
|
|
153
|
+
| 状态 | 数量 | 百分比 |
|
|
154
|
+
|------|------|--------|
|
|
155
|
+
| ✅ 已覆盖 | 5 | 62.5% |
|
|
156
|
+
| ⚠️ 部分覆盖 | 2 | 25.0% |
|
|
157
|
+
| ❌ 未覆盖 | 1 | 12.5% |
|
|
158
|
+
|
|
159
|
+
## 追溯矩阵
|
|
160
|
+
|
|
161
|
+
| AC-ID | 描述 | 状态 | 测试引用 |
|
|
162
|
+
|-------|------|------|----------|
|
|
163
|
+
| AC-1 | 以有效凭证登录 | ✅ | auth.test.ts:15 |
|
|
164
|
+
| AC-2 | 拒绝无效凭证 | ✅ | auth.test.ts:32 |
|
|
165
|
+
| ... | ... | ... | ... |
|
|
166
|
+
|
|
167
|
+
## 缺口
|
|
168
|
+
- **AC-8**: 社交登录 — 因 OAuth sandbox 未就绪受阻
|
|
169
|
+
|
|
170
|
+
## 行动项目
|
|
171
|
+
1. [ ] AC-8:搭建 OAuth sandbox(预计时间:待定)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## 下一步引导
|
|
175
|
+
|
|
176
|
+
`/ac-coverage` 完成后,AI 助手应建议:
|
|
177
|
+
|
|
178
|
+
> **AC 覆盖率分析完成。建议下一步:**
|
|
179
|
+
> - 覆盖率达标 → 执行 `/checkin` 质量关卡
|
|
180
|
+
> - 有未覆盖 AC → 执行 `/derive-tdd` 补齐测试 ⭐ **推荐**
|
|
181
|
+
> - 有部分覆盖 AC → 检查缺少的边界情况
|
|
182
|
+
> - 需要完整追溯 → 执行 `/ac-coverage --full`
|
|
183
|
+
> - 反向追溯 → 执行 `/ac-coverage --trace-code <path>`
|
|
184
|
+
|
|
185
|
+
## 参考
|
|
186
|
+
|
|
187
|
+
- 核心标准:[acceptance-criteria-traceability.md](../../../../core/acceptance-criteria-traceability.md)
|
|
188
|
+
- SPEC:[SPEC-AC-COVERAGE.md](../../../../docs/specs/skills/SPEC-AC-COVERAGE.md)
|
|
189
|
+
- 相关:[test-coverage-assistant](../test-coverage-assistant/SKILL.md)(代码层级覆盖率)
|
|
190
|
+
- 相关:[checkin-assistant](../checkin-assistant/SKILL.md)(质量关卡)
|
|
191
|
+
|
|
192
|
+
## AI 代理行为
|
|
193
|
+
|
|
194
|
+
> 完整的 AI 行为定义请参阅对应的命令文件:[`/ac-coverage`](../../../../skills/commands/ac-coverage.md#ai-agent-behavior--ai-代理行为)
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
source: ../../../../skills/adr-assistant/SKILL.md
|
|
3
3
|
source_version: 1.0.0
|
|
4
|
+
source_hash: 7d8bf5944cf4
|
|
4
5
|
translation_version: 1.0.0
|
|
5
|
-
last_synced: 2026-
|
|
6
|
+
last_synced: 2026-06-01
|
|
6
7
|
status: current
|
|
7
8
|
description: |
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
[UDS] 创建、管理和追踪架构决策记录(ADR)。
|
|
10
|
+
使用时机:架构决策、技术选型、设计取舍、模式选择。
|
|
10
11
|
关键字:ADR, architecture decision, decision record, 架构决策, 决策记录。
|
|
11
12
|
---
|
|
12
13
|
|
|
@@ -14,7 +15,7 @@ description: |
|
|
|
14
15
|
|
|
15
16
|
> **语言**: [English](../../../../skills/adr-assistant/SKILL.md) | 简体中文
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
创建、管理和追踪架构决策记录。捕捉重大技术决策的背景、选项和理由。
|
|
18
19
|
|
|
19
20
|
## 工作流程
|
|
20
21
|
|
|
@@ -23,61 +24,155 @@ CAPTURE ──► ANALYZE ──► DECIDE ──► RECORD ──► LINK
|
|
|
23
24
|
捕捉背景 分析选项 做出决策 记录 ADR 建立链接
|
|
24
25
|
```
|
|
25
26
|
|
|
27
|
+
### 阶段 1:CAPTURE | 捕捉背景
|
|
28
|
+
|
|
29
|
+
识别驱动决策的背景与约束条件。
|
|
30
|
+
|
|
31
|
+
| 步骤 | 动作 |
|
|
32
|
+
|------|------|
|
|
33
|
+
| 1 | 识别问题或机会 |
|
|
34
|
+
| 2 | 列出约束条件(时间、预算、团队技能) |
|
|
35
|
+
| 3 | 定义决策驱动因素 |
|
|
36
|
+
|
|
37
|
+
### 阶段 2:ANALYZE | 分析选项
|
|
38
|
+
|
|
39
|
+
至少探索 2 个选项,列出优缺点。
|
|
40
|
+
|
|
41
|
+
| 步骤 | 动作 |
|
|
42
|
+
|------|------|
|
|
43
|
+
| 1 | 头脑风暴候选方案 |
|
|
44
|
+
| 2 | 根据决策驱动因素评估各方案 |
|
|
45
|
+
| 3 | 记录各方案优缺点 |
|
|
46
|
+
|
|
47
|
+
### 阶段 3:DECIDE | 做出决策
|
|
48
|
+
|
|
49
|
+
选择最佳方案并阐述理由。
|
|
50
|
+
|
|
51
|
+
### 阶段 4:RECORD | 记录 ADR
|
|
52
|
+
|
|
53
|
+
依照标准模板生成 ADR 文件。
|
|
54
|
+
|
|
55
|
+
### 阶段 5:LINK | 建立链接
|
|
56
|
+
|
|
57
|
+
与相关工件(规格、PR、代码)建立交叉引用。
|
|
58
|
+
|
|
59
|
+
## 快速参考
|
|
60
|
+
|
|
61
|
+
### 何时撰写 ADR
|
|
62
|
+
|
|
63
|
+
| 撰写 ADR | 不需要 ADR |
|
|
64
|
+
|----------|-----------|
|
|
65
|
+
| 框架/库选择 | 例行性依赖更新 |
|
|
66
|
+
| API 合约或数据格式 | 现有架构内的 Bug 修复 |
|
|
67
|
+
| 部署策略变更 | 代码风格决策 |
|
|
68
|
+
| 建立新模式 | 琐碎的实现选择 |
|
|
69
|
+
|
|
70
|
+
**经验法则**:如果 6 个月后有人可能会问「为什么?」,就写一份 ADR。
|
|
71
|
+
|
|
72
|
+
### 状态生命周期
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
Proposed ──► Accepted ──► Deprecated
|
|
76
|
+
│
|
|
77
|
+
└──► Superseded by ADR-NNN
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
| 状态 | 说明 |
|
|
81
|
+
|------|------|
|
|
82
|
+
| **Proposed** | 讨论中,尚未决定 |
|
|
83
|
+
| **Accepted** | 已接受,应遵循 |
|
|
84
|
+
| **Deprecated** | 不再适用 |
|
|
85
|
+
| **Superseded** | 已被新 ADR 取代 |
|
|
86
|
+
|
|
87
|
+
### 模板摘要
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
# ADR-NNN: [决策标题]
|
|
91
|
+
|
|
92
|
+
- Status: [Proposed | Accepted | Deprecated | Superseded]
|
|
93
|
+
- Date: YYYY-MM-DD
|
|
94
|
+
- Deciders: [参与决策者]
|
|
95
|
+
- Technical Story: [SPEC-ID 或 Issue]
|
|
96
|
+
|
|
97
|
+
## Context(背景)
|
|
98
|
+
## Decision Drivers(决策驱动因素)
|
|
99
|
+
## Considered Options(考虑的选项)
|
|
100
|
+
## Decision Outcome(决策结果)
|
|
101
|
+
### Consequences(后果:Good / Bad / Neutral)
|
|
102
|
+
## Links(相关链接)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 存放位置
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
docs/adr/
|
|
109
|
+
├── ADR-001-short-description.md
|
|
110
|
+
├── ADR-002-short-description.md
|
|
111
|
+
└── README.md # 索引(可选)
|
|
112
|
+
```
|
|
113
|
+
|
|
26
114
|
## 指令
|
|
27
115
|
|
|
28
116
|
| 指令 | 说明 |
|
|
29
117
|
|------|------|
|
|
30
|
-
| `/adr` |
|
|
31
|
-
| `/adr create` |
|
|
118
|
+
| `/adr` | 交互式创建 ADR |
|
|
119
|
+
| `/adr create` | 创建新 ADR |
|
|
32
120
|
| `/adr list` | 列出所有 ADR 及状态 |
|
|
33
121
|
| `/adr search [关键字]` | 依关键字搜索 ADR |
|
|
34
122
|
| `/adr supersede [ADR-NNN]` | 取代现有 ADR |
|
|
35
123
|
| `/adr review` | 审查过期的 ADR |
|
|
36
124
|
|
|
37
|
-
##
|
|
125
|
+
## 与其他技能的集成
|
|
38
126
|
|
|
39
|
-
|
|
40
|
-
|
|
127
|
+
| 技能 | 集成方式 |
|
|
128
|
+
|------|---------|
|
|
129
|
+
| `/sdd` | 在技术设计中引用 ADR;重大决策时建议创建 ADR |
|
|
130
|
+
| `/review` | 代码审查时引用 ADR 作为设计依据 |
|
|
131
|
+
| `/commit` | 提交时在 footer 加入 ADR 编号 |
|
|
132
|
+
| `/brainstorm` | 头脑风暴结果作为 ADR 选项分析输入 |
|
|
41
133
|
|
|
134
|
+
## 质量检查清单
|
|
42
135
|
|
|
43
|
-
|
|
136
|
+
| 检查项 | 标准 |
|
|
137
|
+
|--------|------|
|
|
138
|
+
| ☐ 背景 | 清楚说明问题 |
|
|
139
|
+
| ☐ 选项 | 至少考虑 2 个选项 |
|
|
140
|
+
| ☐ 驱动因素 | 决策驱动因素明确列出 |
|
|
141
|
+
| ☐ 后果 | 包含正面与负面结果 |
|
|
142
|
+
| ☐ 链接 | 相关工件已引用 |
|
|
44
143
|
|
|
45
|
-
|
|
144
|
+
## 下一步引导
|
|
46
145
|
|
|
47
|
-
|
|
48
|
-
> - Execute `/sdd` to create a spec if the decision requires implementation
|
|
49
|
-
> - Execute `/commit` to commit the ADR file
|
|
50
|
-
> - Update related SPECs to reference this ADR
|
|
51
|
-
> - Share with team for review if status is `Proposed`
|
|
146
|
+
`/adr` 完成后,AI 助手应建议:
|
|
52
147
|
|
|
53
|
-
> **ADR
|
|
54
|
-
> -
|
|
55
|
-
> -
|
|
56
|
-
> -
|
|
57
|
-
> -
|
|
148
|
+
> **ADR 已创建。建议下一步:**
|
|
149
|
+
> - 执行 `/sdd` 创建规格(若决策需要实现)
|
|
150
|
+
> - 执行 `/commit` 提交 ADR 文件
|
|
151
|
+
> - 更新相关规格以引用此 ADR
|
|
152
|
+
> - 若状态为 `Proposed`,分享给团队审查
|
|
58
153
|
|
|
59
|
-
## AI
|
|
154
|
+
## AI 代理行为
|
|
60
155
|
|
|
61
|
-
|
|
156
|
+
当用户调用 `/adr` 时,AI 助手必须:
|
|
62
157
|
|
|
63
|
-
1.
|
|
64
|
-
2.
|
|
65
|
-
3.
|
|
66
|
-
4.
|
|
67
|
-
5.
|
|
158
|
+
1. **检查现有 ADR** — 搜索 `docs/adr/` 以确定下一个 ADR 编号
|
|
159
|
+
2. **交互式引导** — 逐步询问背景、驱动因素和选项
|
|
160
|
+
3. **生成文件** — 将 ADR 写入 `docs/adr/ADR-NNN-title.md`
|
|
161
|
+
4. **建议链接** — 识别相关规格或 ADR 以建立交叉引用
|
|
162
|
+
5. **提供下一步** — 显示上方的下一步引导
|
|
68
163
|
|
|
69
|
-
|
|
70
|
-
1.
|
|
71
|
-
2.
|
|
72
|
-
3.
|
|
164
|
+
当用户调用 `/adr list` 时:
|
|
165
|
+
1. 扫描 `docs/adr/` 目录
|
|
166
|
+
2. 解析每个 ADR 文件的状态
|
|
167
|
+
3. 以表格显示:编号、标题、状态、日期
|
|
73
168
|
|
|
74
|
-
|
|
75
|
-
1.
|
|
76
|
-
2.
|
|
77
|
-
3.
|
|
78
|
-
4.
|
|
169
|
+
当用户调用 `/adr supersede [ADR-NNN]` 时:
|
|
170
|
+
1. 读取现有 ADR
|
|
171
|
+
2. 引导创建新 ADR
|
|
172
|
+
3. 将旧 ADR 状态更新为 `Superseded by ADR-NNN`
|
|
173
|
+
4. 在新 ADR 中加入 `Supersedes ADR-NNN`
|
|
79
174
|
|
|
80
|
-
##
|
|
175
|
+
## 参考
|
|
81
176
|
|
|
82
|
-
-
|
|
83
|
-
-
|
|
177
|
+
- 核心规范:[adr-standards.md](../../../../core/adr-standards.md)
|
|
178
|
+
- 详细指南:[guide.md](./guide.md)
|