universal-dev-standards 5.14.0 → 5.15.1
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/ai-instruction-standards.ai.yaml +190 -3
- package/bundled/ai/standards/knowledge-graph-memory.ai.yaml +83 -0
- package/bundled/core/ai-instruction-standards.md +136 -11
- package/bundled/core/knowledge-graph-memory.md +119 -0
- package/bundled/locales/COVERAGE.md +226 -0
- package/bundled/locales/zh-CN/CHANGELOG.md +32 -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/ai-instruction-standards.md +111 -5
- package/bundled/locales/zh-TW/CHANGELOG.md +36 -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/ai-instruction-standards.md +130 -5
- package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +127 -0
- 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/ai-collaboration-standards/SKILL.md +5 -1
- 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/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/orchestrate/SKILL.md +172 -0
- package/bundled/locales/zh-TW/skills/plan/SKILL.md +239 -0
- package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +5 -1
- package/bundled/locales/zh-TW/skills/push/SKILL.md +241 -0
- package/bundled/locales/zh-TW/skills/skill-builder/SKILL.md +165 -0
- package/bundled/locales/zh-TW/skills/spec-derivation/SKILL.md +83 -0
- package/bundled/locales/zh-TW/skills/sweep/SKILL.md +149 -0
- 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/ci-cd-assistant/SKILL.md +1 -1
- 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 +1 -1
- package/src/commands/check.js +71 -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 +338 -0
- package/src/utils/config-manager.js +39 -0
- package/src/utils/skills-installer.js +39 -7
- package/standards-registry.json +16 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
source: ../../../core/ai-instruction-standards.md
|
|
3
|
-
source_version: 1.
|
|
4
|
-
translation_version: 1.
|
|
5
|
-
last_synced: 2026-
|
|
3
|
+
source_version: 1.1.0
|
|
4
|
+
translation_version: 1.1.0
|
|
5
|
+
last_synced: 2026-05-28
|
|
6
6
|
status: current
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -10,8 +10,8 @@ status: current
|
|
|
10
10
|
|
|
11
11
|
> **語言**: [English](../../../core/ai-instruction-standards.md) | 繁體中文
|
|
12
12
|
|
|
13
|
-
**版本**: 1.
|
|
14
|
-
**最後更新**: 2026-
|
|
13
|
+
**版本**: 1.1.0
|
|
14
|
+
**最後更新**: 2026-05-28
|
|
15
15
|
**適用範圍**: 所有使用 AI 編碼助手的專案
|
|
16
16
|
|
|
17
17
|
---
|
|
@@ -151,6 +151,130 @@ AI 指令檔案通常混合兩種類型的內容:
|
|
|
151
151
|
|
|
152
152
|
---
|
|
153
153
|
|
|
154
|
+
## 國際化(i18n)
|
|
155
|
+
|
|
156
|
+
AI 指令檔常需提供多語言版本——既為了國際採用者,也為了非英語母語維護者主導的專案。本章節定義多語言指令檔的組織、驗證與安裝規則。
|
|
157
|
+
|
|
158
|
+
### AI 指令檔的範圍
|
|
159
|
+
|
|
160
|
+
本標準涵蓋兩個層級的 AI 指令檔:
|
|
161
|
+
|
|
162
|
+
| 層級 | 範例 | i18n 模式 |
|
|
163
|
+
|------|------|----------|
|
|
164
|
+
| **Root 層** | `CLAUDE.md`、`.cursorrules`、`.windsurfrules`、`.opencode/instructions.md` | 單檔內以 inline 段落分語言(例:`## 中文` / `## English`)|
|
|
165
|
+
| **Skill 層** | Claude Code `.claude/skills/{name}/SKILL.md`、OpenCode plugin instructions | Canonical(英文)+ `locales/{lang}/` 變體 |
|
|
166
|
+
|
|
167
|
+
> 注意:skill 層的多檔結構主要對 Claude Code 適用。其他工具是 root 單檔;對它們只有下方「分層語言策略」與「Chimera 防範」規則適用。
|
|
168
|
+
|
|
169
|
+
### 分層語言策略
|
|
170
|
+
|
|
171
|
+
每份 AI 指令檔概念上有 **4 層**,各層語言責任不同:
|
|
172
|
+
|
|
173
|
+
| 層 | 內容 | Canonical (en) | Locale ({lang}) | 為何分這層 |
|
|
174
|
+
|----|------|---------------|----------------|-----------|
|
|
175
|
+
| **L1 — Metadata** | YAML frontmatter `description`、`argument-hint`、`allowed-tools` | **必須英文** | **必須對應 locale 語言** | AI 觸發訊號;英文 token 效率最高 + 訓練語料密度高 |
|
|
176
|
+
| **L2 — 指令(Instructions)** | 對 AI 的命令式規則(steps、behavior、allowed-tools 理由)| **必須英文** | 對應 locale 語言(可選;可保留英文)| AI 讀英文指令最精準;只有當維護者需要以母語讀指令時才翻譯 |
|
|
177
|
+
| **L3 — 輸出範本(Output Templates)** | 範例輸出、回應格式、情境範本 | 英文(canonical 鎖定英文)| **強制對應 locale**(mandatory)| **唯一直接影響 AI 輸出語言的層**——AI 會繼承所見範本的語言 |
|
|
178
|
+
| **L4 — 人類文件** | 維護者註解、貢獻者說明、walkthrough | 英文 | 對應 locale 語言(強烈建議)| 給人類維護者讀,AI 不讀 |
|
|
179
|
+
|
|
180
|
+
**關鍵 insight**:L1(description)是 AI 用來決定「**是否呼叫**」此 skill 的觸發訊號——它**不**影響 AI 之後說什麼。L3(output template)才是控制 AI 輸出語言的唯一開關,因為 AI 會慣性沿用範本語言。**i18n 強制檢查應該聚焦在 L3——加強 L1 的強制(例如強制 description 用 locale)是常見錯誤,它解決的是錯誤的問題。**
|
|
181
|
+
|
|
182
|
+
### Canonical / Locale 檔案結構
|
|
183
|
+
|
|
184
|
+
UDS 標準與 skill 的 locale 變體結構:
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
core/{name}.md ← canonical(英文)— single source of truth
|
|
188
|
+
core/{name}.ai.yaml ← canonical 結構化(英文)
|
|
189
|
+
locales/{lang}/core/{name}.md ← locale 變體(匹配 lang)
|
|
190
|
+
locales/{lang}/ai/standards/{name}.ai.yaml ← locale .ai.yaml(匹配 lang)
|
|
191
|
+
skills/{name}/SKILL.md ← canonical skill(英文)
|
|
192
|
+
locales/{lang}/skills/{name}/SKILL.md ← locale skill 變體
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**命名慣例**:使用 BCP 47 語言標籤——`zh-TW`、`zh-CN`、`ja`、`ko`、`en-US` 等。
|
|
196
|
+
|
|
197
|
+
### Locale 變體 Frontmatter 必填欄位
|
|
198
|
+
|
|
199
|
+
每個 locale 變體必須含追蹤用 frontmatter,方便偵測 drift:
|
|
200
|
+
|
|
201
|
+
```yaml
|
|
202
|
+
---
|
|
203
|
+
name: {與 canonical 同名}
|
|
204
|
+
source: {指回 canonical 的相對路徑}
|
|
205
|
+
source_version: {翻譯時 canonical 的版本}
|
|
206
|
+
translation_version: {本翻譯的版本}
|
|
207
|
+
---
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
當 canonical 更新(bump `source_version`),locale 維護者應重新同步並 bump `translation_version`。若 `source_version` 落後超過 2 個 minor 版本,會觸發 drift 警告(見「Chimera 防範」)。
|
|
211
|
+
|
|
212
|
+
### 責任邊界
|
|
213
|
+
|
|
214
|
+
| 角色 | 擁有 | 必須做 |
|
|
215
|
+
|------|------|--------|
|
|
216
|
+
| **Canonical 擁有者** | `core/{name}.md`、`core/{name}.ai.yaml`、`skills/{name}/SKILL.md` | 維持 L1/L2/L3/L4 為英文;每次 breaking change 時 bump `source_version` |
|
|
217
|
+
| **Locale 維護者** | `locales/{lang}/...` 檔 | `translation_version` 對齊 `source_version`;翻譯 L1(必)、L2(選)、L3(必)、L4(建議)|
|
|
218
|
+
| **採用者(下游專案)** | 自己的 `.claude/skills/`、`CLAUDE.md` 等 | 用 `uds install --locale {lang}` 安裝;**絕不**手動修改 canonical 檔(要客製化請用 locale 變體或 overlay)|
|
|
219
|
+
|
|
220
|
+
### Chimera 防範
|
|
221
|
+
|
|
222
|
+
**Chimera**(混血兒)指違反分層規則、混合語言的檔案。常見 chimera 模式:
|
|
223
|
+
|
|
224
|
+
| 模式 | 嚴重度 | 偵測方式 |
|
|
225
|
+
|------|--------|----------|
|
|
226
|
+
| Canonical 檔的 `description` 含 CJK | ❌ Error | Lint:`canonical:description-must-be-ascii` |
|
|
227
|
+
| Locale 變體的 `description` 是純 ASCII | ❌ Error | Lint:`locale:description-must-match-language` |
|
|
228
|
+
| Locale 變體缺 `source:` frontmatter | ❌ Error | Lint:`locale:must-have-source-frontmatter` |
|
|
229
|
+
| Canonical L3 output template 含非英文範例回應 | ⚠️ Warn | Lint:`canonical:l3-language-consistency` |
|
|
230
|
+
| 採用者 `.claude/skills/` 的檔案與 canonical 和任何 locale 變體都不同 | ⚠️ Warn | Sync check:`adopter:must-match-installed-locale` |
|
|
231
|
+
| `translation_version` 落後 `source_version` 超過 2 minor | ⚠️ Warn | Drift check |
|
|
232
|
+
|
|
233
|
+
Pre-commit / CI lint 強制 error 級規則;warn 級規則只在 dashboard 揭露不阻擋。
|
|
234
|
+
|
|
235
|
+
### 採用者安裝模式
|
|
236
|
+
|
|
237
|
+
採用者透過 UDS CLI 安裝指令檔:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
uds install --locale zh-TW # 以繁體中文安裝 skills 與 standards
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Locale 解析優先順序**:
|
|
244
|
+
1. `--locale` CLI 旗標(最高)
|
|
245
|
+
2. `.uds/install.yaml` 的 `locale:` 欄位
|
|
246
|
+
3. 環境變數 `UDS_LOCALE`
|
|
247
|
+
4. Fallback:`en`
|
|
248
|
+
|
|
249
|
+
**Locale 不存在時的 fallback 行為**:當索求的 locale 對某個 skill 沒有變體時,CLI:
|
|
250
|
+
- 安裝 canonical(英文)檔案
|
|
251
|
+
- 發出 WARN 列出哪些 skill fallback 了
|
|
252
|
+
- **不**阻斷安裝
|
|
253
|
+
|
|
254
|
+
這確保覆蓋率不完整時採用者仍能用。採用者可查 `locales/COVERAGE.md` 知道哪些有翻譯、哪些沒有。
|
|
255
|
+
|
|
256
|
+
### 遷移:已有 chimera 的採用者
|
|
257
|
+
|
|
258
|
+
若採用者已手動修改過專案中的 canonical 檔(例:在 `.claude/skills/` 翻譯了描述):
|
|
259
|
+
|
|
260
|
+
1. **辨識 chimera**:比對採用者檔案與 UDS canonical / canonical 的 locale 變體。
|
|
261
|
+
2. **安裝正確變體**:執行 `uds install --locale {lang}` 替換 chimera 為 locale 變體。
|
|
262
|
+
3. **保留專案級客製**:若 chimera 含合理的專案級客製(非翻譯),抽出為 overlay 或記錄到客製化日誌(例:`UDS-CUSTOMIZATION.md`)。
|
|
263
|
+
4. **丟棄純翻譯**:chimera 中純翻譯部分直接丟棄——locale 變體會取代它。
|
|
264
|
+
|
|
265
|
+
### 快速參考
|
|
266
|
+
|
|
267
|
+
| 動作 | 何時 | 工具 / 檔案 |
|
|
268
|
+
|------|------|------------|
|
|
269
|
+
| 新增語言支援 | 想支援新 locale | 建立 `locales/{lang}/...` 對應 canonical 結構 |
|
|
270
|
+
| 更新 canonical | 改進英文 source | Bump `source_version`;通知 locale 維護者 |
|
|
271
|
+
| 翻譯 / 同步 locale | 新增或更新 locale 內容 | Bump `translation_version`;參照當前 `source_version` |
|
|
272
|
+
| 檢查覆蓋率 | 定期 review | 看自動產生的 `locales/COVERAGE.md` |
|
|
273
|
+
| 帶 locale 安裝 | 採用者初設或重新同步 | `uds install --locale {lang}` |
|
|
274
|
+
| 跑 i18n lint | Commit 前 / CI | `uds lint --i18n` |
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
154
278
|
## 維護檢查清單
|
|
155
279
|
|
|
156
280
|
在提交 AI 指令檔案的變更之前:
|
|
@@ -205,6 +329,7 @@ grep -n "npm\|yarn\|pip\|cargo" CLAUDE.md | head -20
|
|
|
205
329
|
| 版本 | 日期 | 變更 |
|
|
206
330
|
|------|------|------|
|
|
207
331
|
| 1.0.0 | 2026-01-14 | 初始發布 |
|
|
332
|
+
| 1.1.0 | 2026-05-28 | 新增 i18n 章節;範圍延伸至 skill 層級檔案 |
|
|
208
333
|
|
|
209
334
|
---
|
|
210
335
|
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../core/knowledge-graph-memory.md
|
|
3
|
+
source_version: 1.0.0
|
|
4
|
+
translation_version: 1.0.0
|
|
5
|
+
last_synced: 2026-05-30
|
|
6
|
+
status: current
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Knowledge Graph Memory Standards(知識圖記憶標準)
|
|
10
|
+
|
|
11
|
+
> **語言**: [English](../../../core/knowledge-graph-memory.md) | 繁體中文
|
|
12
|
+
|
|
13
|
+
**版本**: 1.0.0
|
|
14
|
+
**最後更新**: 2026-05-30
|
|
15
|
+
**適用範圍**: 在「程式碼 + 規格/決策」語料上使用 AI 助手的專案
|
|
16
|
+
**Scope**: uds-specific
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 目的
|
|
21
|
+
|
|
22
|
+
本標準定義一套**關係 schema**,讓規格、決策與程式碼能以圖的方式遍歷——回答如*「我若修改 `execute()`,會影響哪些規格與決策?」*的問題。它與向量/語意記憶(找出*相似*的產物)互補,提供**結構遍歷**(找出*有關聯*的產物)。
|
|
23
|
+
|
|
24
|
+
此 schema 與引擎無關:以純 Markdown front-matter 表達,AI 助手可直接讀取(降級模式),亦可由可選的圖引擎(如 [CodeSage](https://github.com/AsiaOstrich/CodeSage))索引以進行多跳查詢(服務模式)。
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 快速參考
|
|
29
|
+
|
|
30
|
+
### 關係 Front-Matter Schema
|
|
31
|
+
|
|
32
|
+
在規格/決策文件的 YAML front-matter 中加入以下可選欄位:
|
|
33
|
+
|
|
34
|
+
| 欄位 | 型別 | 方向 | 意義 |
|
|
35
|
+
|------|------|------|------|
|
|
36
|
+
| `related` | id 列表 | 無向 | 鬆散關聯的產物 |
|
|
37
|
+
| `impacts` | spec id 列表 | this → spec | 此決策改動那些規格 |
|
|
38
|
+
| `impacted_by` | decision id 列表 | decision → this | 那些決策改動此規格 |
|
|
39
|
+
| `supersedes` | decision id 列表 | this → decision | 此決策取代那些決策 |
|
|
40
|
+
| `implements` | spec id 列表 | code/spec → spec | 此產物實作那些規格 |
|
|
41
|
+
|
|
42
|
+
id 為產物識別碼(如 `XSPEC-205`、`DEC-062`、`ADR-001`)。內文的 `[[XSPEC-NNN]]` wiki 連結是等效但較低保真度的訊號。
|
|
43
|
+
|
|
44
|
+
### 節點種類
|
|
45
|
+
|
|
46
|
+
| 前綴 | 節點種類 |
|
|
47
|
+
|------|---------|
|
|
48
|
+
| `XSPEC-*` / `SPEC-*` | Spec |
|
|
49
|
+
| `DEC-*` / `ADR-*` | Decision |
|
|
50
|
+
| 函式/類別/模組(來自程式碼)| Code 節點 |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 1. Schema
|
|
55
|
+
|
|
56
|
+
### 1.1 Front-Matter 範例
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
---
|
|
60
|
+
id: XSPEC-205
|
|
61
|
+
title: Agent/Role Spec SDD Variant
|
|
62
|
+
status: Implemented
|
|
63
|
+
impacted_by: [DEC-062]
|
|
64
|
+
related: [XSPEC-204]
|
|
65
|
+
---
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
---
|
|
70
|
+
id: DEC-069
|
|
71
|
+
title: CodeSage Architecture
|
|
72
|
+
date: 2026-05-27
|
|
73
|
+
supersedes: [DEC-057]
|
|
74
|
+
impacts: [XSPEC-237]
|
|
75
|
+
---
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 1.2 邊的推導
|
|
79
|
+
|
|
80
|
+
| 文件上的 front-matter | 推導出的邊 |
|
|
81
|
+
|----------------------|-----------|
|
|
82
|
+
| Decision `impacts: [SPEC]` | `IMPACTS`(Decision → Spec)|
|
|
83
|
+
| Spec `impacted_by: [DEC]` | `IMPACTS`(Decision → Spec)|
|
|
84
|
+
| Decision `supersedes: [DEC]` | `SUPERSEDES`(Decision → Decision)|
|
|
85
|
+
| Decision 內文 `[[XSPEC-NNN]]` 連結 | `IMPACTS`(Decision → Spec)|
|
|
86
|
+
|
|
87
|
+
邊是**冪等**的:同一關係從兩端宣告(決策的 `impacts` 與規格的 `impacted_by`)只產生一條邊,不會重複。
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 2. 兩種運作模式
|
|
92
|
+
|
|
93
|
+
本標準的消費者**必須**同時支援兩種模式:
|
|
94
|
+
|
|
95
|
+
### 2.1 降級模式(無引擎)
|
|
96
|
+
|
|
97
|
+
AI 助手讀取目標文件,沿其 front-matter/`[[ref]]` 連結讀取被連結檔案,手動組出影響鏈。隨時可用;受限於助手能讀取的檔案數。
|
|
98
|
+
|
|
99
|
+
### 2.2 服務模式(有圖引擎)
|
|
100
|
+
|
|
101
|
+
語料被索引進圖引擎;助手送出單一多跳查詢(如 `impact-analysis { nodeId, maxHops }`)取得完整鏈——包含降級模式會漏掉的跨域連結(code → spec → decision)。
|
|
102
|
+
|
|
103
|
+
> 正確實作在兩種模式下產生**相同形狀的答案**;服務模式只是更快更完整,並非本質不同。
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 3. Confidence(可選)
|
|
108
|
+
|
|
109
|
+
節點**可**帶 `confidence`,範圍 `[0.1, 1.0]`。回饋訊號(測試通過/失敗、人工修正、狀態變更)演化 confidence,讓讀取時優先浮現最被強化的產物。confidence 有下限(永不歸零),使連續失敗無法抹除重要節點。此為自我演化圖記憶(SAGE)的基礎。
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 4. 規則
|
|
114
|
+
|
|
115
|
+
1. 關係欄位**可選**且**附加**——缺少永不破壞工具。
|
|
116
|
+
2. 允許參照尚不存在的 id;它們成為 stub 節點,待目標文件出現時解析。
|
|
117
|
+
3. 從*擁有*該關係的一端宣告(決策擁有 `impacts`/`supersedes`;規格擁有 `impacted_by`),但兩端皆接受。
|
|
118
|
+
4. 圖引擎為 **opt-in**。未設定引擎時工具**必須**優雅降級為 Markdown 讀取。
|
|
119
|
+
5. 向量/語意記憶為**互補**而非取代——結構用圖遍歷,相似用向量。
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 相關標準
|
|
124
|
+
|
|
125
|
+
- [Project Context Memory](project-context-memory.md) — 每專案長期事實
|
|
126
|
+
- [Developer Memory](developer-memory.md) — 通用、可攜偏好
|
|
127
|
+
- [ADR Standards](adr-standards.md) — 餵入 Decision 節點的決策紀錄格式
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../core/self-review-protocol.md
|
|
3
|
+
source_version: 1.0.0
|
|
4
|
+
translation_version: 1.0.0
|
|
5
|
+
last_synced: 2026-05-28
|
|
6
|
+
status: current
|
|
7
|
+
---
|
|
8
|
+
|
|
1
9
|
# Self-Review Protocol(自我審查協議)
|
|
2
10
|
|
|
3
|
-
> [English](../../../core/self-review-protocol.md) |
|
|
11
|
+
> **語言**: [English](../../../core/self-review-protocol.md) | 繁體中文
|
|
4
12
|
|
|
5
13
|
**版本**: 1.0.0
|
|
6
14
|
**最後更新**: 2026-05-26
|
|
@@ -0,0 +1,192 @@
|
|
|
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-05-28
|
|
7
|
+
scope: universal
|
|
8
|
+
description: "[UDS] 分析驗收條件(AC)與測試之間的追蹤關係並產生覆蓋率報告"
|
|
9
|
+
allowed-tools: Read, Grep, Glob
|
|
10
|
+
argument-hint: "[規格檔案路徑]"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# AC 覆蓋率助手
|
|
14
|
+
|
|
15
|
+
> **語言**: [English](../../../../skills/ac-coverage/SKILL.md) | 繁體中文
|
|
16
|
+
|
|
17
|
+
分析驗收條件(AC)與測試之間的追蹤關係,並產生覆蓋率報告。
|
|
18
|
+
|
|
19
|
+
## 與 `/coverage` 的差異
|
|
20
|
+
|
|
21
|
+
| 面向 | `/coverage` | `/ac-coverage` |
|
|
22
|
+
|------|-------------|----------------|
|
|
23
|
+
| **範圍** | 程式碼層級(行數/分支/函式) | 需求層級(AC 對應測試) |
|
|
24
|
+
| **輸入** | 原始碼 + 測試執行器 | SPEC 檔案 + 測試標註 |
|
|
25
|
+
| **問題** | 「程式碼測試了多少?」 | 「哪些 AC 有測試?」 |
|
|
26
|
+
| **輸出** | 覆蓋率百分比 | 追溯矩陣 + 缺口報告 |
|
|
27
|
+
|
|
28
|
+
## 工作流程
|
|
29
|
+
|
|
30
|
+
1. **解析 SPEC** — 從規格檔案抽取 AC 定義(AC-1, AC-2, ...)
|
|
31
|
+
2. **掃描測試** — 依標準連結慣例搜尋測試檔中的 `@AC` 與 `@SPEC` 標註
|
|
32
|
+
3. **建立矩陣** — 將每個 AC 對應到其測試引用(檔案、測試名稱、行號)
|
|
33
|
+
4. **分類狀態** — 將每個 AC 標記為 ✅ 已覆蓋、⚠️ 部分覆蓋、或 ❌ 未覆蓋
|
|
34
|
+
5. **計算覆蓋率** — 套用公式:`覆蓋率 % = (已覆蓋 + 部分覆蓋 × 0.5) / 總數 × 100`
|
|
35
|
+
6. **產生報告** — 輸出標準化的 Markdown 報告
|
|
36
|
+
|
|
37
|
+
## 連結標註慣例
|
|
38
|
+
|
|
39
|
+
測試**必須**使用標準標註引用其來源 AC:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// TypeScript / JavaScript
|
|
43
|
+
describe('AC-1: 使用者以有效憑證登入', () => {
|
|
44
|
+
// @AC AC-1
|
|
45
|
+
// @SPEC SPEC-001
|
|
46
|
+
it('登入成功後應導向儀表板', () => { ... });
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
# Python
|
|
52
|
+
class TestAC1_UserLogin:
|
|
53
|
+
"""AC-1: 使用者以有效憑證登入
|
|
54
|
+
@AC AC-1
|
|
55
|
+
@SPEC SPEC-001
|
|
56
|
+
"""
|
|
57
|
+
def test_redirect_to_dashboard(self): ...
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```gherkin
|
|
61
|
+
# BDD Feature
|
|
62
|
+
@SPEC-001 @AC-1
|
|
63
|
+
Scenario: 使用者以有效憑證登入
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 覆蓋率門檻
|
|
67
|
+
|
|
68
|
+
| 門檻 | 預設值 | 強制等級 |
|
|
69
|
+
|------|--------|----------|
|
|
70
|
+
| **簽入(Check-in)** | 80% | feature branch 合併必要條件 |
|
|
71
|
+
| **發布(Release)** | 100% | 正式環境發布必要條件 |
|
|
72
|
+
| **警告(Warning)** | 60% | 觸發覆蓋率警告 |
|
|
73
|
+
|
|
74
|
+
門檻可透過 `--threshold` 參數或專案設定檔調整。
|
|
75
|
+
|
|
76
|
+
## 四層追溯(`--full` 模式)
|
|
77
|
+
|
|
78
|
+
使用 `--full` 標記將追溯從 2 層(AC→Test)擴展為 4 層。
|
|
79
|
+
|
|
80
|
+
### 追溯層次
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Layer 0:需求 / 使用者故事 (REQ)
|
|
84
|
+
↓ (定義)
|
|
85
|
+
Layer 1:驗收條件 (AC)
|
|
86
|
+
↓ (@AC 標註)
|
|
87
|
+
Layer 2:測試案例
|
|
88
|
+
↓ (覆蓋)
|
|
89
|
+
Layer 3:原始碼 (@implements)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 各層標註慣例
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// Layer 3→1:程式碼引用 AC
|
|
96
|
+
// @implements AC-1, AC-2
|
|
97
|
+
function authenticate(user: string, pass: string) { ... }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
<!-- Layer 0→1:SPEC 中的需求 -->
|
|
102
|
+
## Requirements
|
|
103
|
+
### REQ-1:使用者驗證
|
|
104
|
+
- AC-1: 給定有效憑證,當登入時,則驗證通過
|
|
105
|
+
- AC-2: 給定無效憑證,當登入時,則被拒絕
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 完整追溯報告
|
|
109
|
+
|
|
110
|
+
```markdown
|
|
111
|
+
## 四層追溯矩陣
|
|
112
|
+
|
|
113
|
+
| 需求 | AC | 測試 | 程式碼 | 狀態 |
|
|
114
|
+
|------|-----|------|--------|------|
|
|
115
|
+
| REQ-1 | AC-1 | auth.test.ts:15 | auth.ts:42 | ✅ 完整 |
|
|
116
|
+
| REQ-1 | AC-2 | auth.test.ts:30 | auth.ts:58 | ✅ 完整 |
|
|
117
|
+
| REQ-2 | AC-3 | — | dashboard.ts:10 | ⚠️ 缺測試 |
|
|
118
|
+
| REQ-3 | AC-4 | export.test.ts:5 | — | ⚠️ 缺程式碼 |
|
|
119
|
+
|
|
120
|
+
### 缺口摘要
|
|
121
|
+
- Layer 0→1: 2 個需求未對應 AC
|
|
122
|
+
- Layer 1→2: 1 個 AC 未對應測試
|
|
123
|
+
- Layer 2→3: 0 個測試未對應程式碼
|
|
124
|
+
- Layer 3→1: 3 個程式碼檔案未對應 AC
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 反向追溯
|
|
128
|
+
|
|
129
|
+
使用 `--trace-code <path>` 從程式碼反向追溯到需求。
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
/ac-coverage --trace-code src/auth.ts
|
|
133
|
+
# 輸出:
|
|
134
|
+
# src/auth.ts:42 → @implements AC-1 → REQ-1 (SPEC-AUTH-001)
|
|
135
|
+
# src/auth.ts:58 → @implements AC-2 → REQ-1 (SPEC-AUTH-001)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 報告格式
|
|
139
|
+
|
|
140
|
+
產生的報告遵循 `core/acceptance-criteria-traceability.md` 的標準格式:
|
|
141
|
+
|
|
142
|
+
```markdown
|
|
143
|
+
# AC 覆蓋率報告
|
|
144
|
+
|
|
145
|
+
**規格**: SPEC-001 — 功能名稱
|
|
146
|
+
**產生時間**: 2026-03-18
|
|
147
|
+
**覆蓋率**: 75% (6/8 AC)
|
|
148
|
+
|
|
149
|
+
## 摘要
|
|
150
|
+
|
|
151
|
+
| 狀態 | 數量 | 百分比 |
|
|
152
|
+
|------|------|--------|
|
|
153
|
+
| ✅ 已覆蓋 | 5 | 62.5% |
|
|
154
|
+
| ⚠️ 部分覆蓋 | 2 | 25.0% |
|
|
155
|
+
| ❌ 未覆蓋 | 1 | 12.5% |
|
|
156
|
+
|
|
157
|
+
## 追溯矩陣
|
|
158
|
+
|
|
159
|
+
| AC-ID | 描述 | 狀態 | 測試引用 |
|
|
160
|
+
|-------|------|------|----------|
|
|
161
|
+
| AC-1 | 以有效憑證登入 | ✅ | auth.test.ts:15 |
|
|
162
|
+
| AC-2 | 拒絕無效憑證 | ✅ | auth.test.ts:32 |
|
|
163
|
+
| ... | ... | ... | ... |
|
|
164
|
+
|
|
165
|
+
## 缺口
|
|
166
|
+
- **AC-8**: 社群登入 — 因 OAuth sandbox 未就緒受阻
|
|
167
|
+
|
|
168
|
+
## 行動項目
|
|
169
|
+
1. [ ] AC-8:設定 OAuth sandbox(預計時程:待定)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## 下一步引導
|
|
173
|
+
|
|
174
|
+
`/ac-coverage` 完成後,AI 助手應建議:
|
|
175
|
+
|
|
176
|
+
> **AC 覆蓋率分析完成。建議下一步:**
|
|
177
|
+
> - 覆蓋率達標 → 執行 `/checkin` 品質關卡
|
|
178
|
+
> - 有未覆蓋 AC → 執行 `/derive-tdd` 補齊測試 ⭐ **推薦**
|
|
179
|
+
> - 有部分覆蓋 AC → 檢查缺少的邊界情況
|
|
180
|
+
> - 需要完整追溯 → 執行 `/ac-coverage --full`
|
|
181
|
+
> - 反向追溯 → 執行 `/ac-coverage --trace-code <path>`
|
|
182
|
+
|
|
183
|
+
## 參考
|
|
184
|
+
|
|
185
|
+
- 核心標準:[acceptance-criteria-traceability.md](../../../../core/acceptance-criteria-traceability.md)
|
|
186
|
+
- SPEC:[SPEC-AC-COVERAGE.md](../../../../docs/specs/skills/SPEC-AC-COVERAGE.md)
|
|
187
|
+
- 相關:[test-coverage-assistant](../test-coverage-assistant/SKILL.md)(程式碼層級覆蓋率)
|
|
188
|
+
- 相關:[checkin-assistant](../checkin-assistant/SKILL.md)(品質關卡)
|
|
189
|
+
|
|
190
|
+
## AI 代理行為
|
|
191
|
+
|
|
192
|
+
> 完整的 AI 行為定義請參閱對應的命令文件:[`/ac-coverage`](../../../../skills/commands/ac-coverage.md#ai-agent-behavior--ai-代理行為)
|
|
@@ -3,8 +3,12 @@ name: ai-collaboration-standards
|
|
|
3
3
|
source: ../../../../skills/ai-collaboration-standards/SKILL.md
|
|
4
4
|
source_version: 1.1.0
|
|
5
5
|
translation_version: 1.1.0
|
|
6
|
-
last_synced: 2026-
|
|
6
|
+
last_synced: 2026-05-28
|
|
7
7
|
status: current
|
|
8
|
+
description: |
|
|
9
|
+
[UDS] 防止 AI 幻覺、確保分析程式碼或提建議時以證據為基礎的回應。
|
|
10
|
+
Use when: analyzing code, making recommendations, providing options, or when user asks about confidence/certainty.
|
|
11
|
+
Keywords: certainty, assumption, inference, evidence, source, 證據, 假設, 推論.
|
|
8
12
|
---
|
|
9
13
|
|
|
10
14
|
# AI 協作標準
|