universal-dev-standards 5.15.1 → 5.17.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.
Files changed (84) hide show
  1. package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +31 -0
  2. package/bundled/ai/standards/forward-derivation-standards.ai.yaml +23 -0
  3. package/bundled/ai/standards/knowledge-graph-memory.ai.yaml +1 -1
  4. package/bundled/core/acceptance-criteria-traceability.md +46 -0
  5. package/bundled/core/forward-derivation-standards.md +19 -0
  6. package/bundled/core/knowledge-graph-memory.md +2 -2
  7. package/bundled/core/spec-driven-development.md +21 -3
  8. package/bundled/locales/zh-CN/CHANGELOG.md +23 -3
  9. package/bundled/locales/zh-CN/README.md +1 -1
  10. package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +46 -0
  11. package/bundled/locales/zh-CN/core/forward-derivation-standards.md +19 -0
  12. package/bundled/locales/zh-CN/core/spec-driven-development.md +16 -2
  13. package/bundled/locales/zh-CN/skills/ac-coverage/SKILL.md +194 -0
  14. package/bundled/locales/zh-CN/skills/adr-assistant/SKILL.md +135 -40
  15. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +217 -63
  16. package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +599 -0
  17. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +92 -25
  18. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +78 -16
  19. package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +85 -26
  20. package/bundled/locales/zh-CN/skills/deploy-assistant/SKILL.md +189 -0
  21. package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +110 -0
  22. package/bundled/locales/zh-CN/skills/dev-methodology/guide.md +255 -0
  23. package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +70 -11
  24. package/bundled/locales/zh-CN/skills/journey-test-assistant/SKILL.md +209 -0
  25. package/bundled/locales/zh-CN/skills/knowledge-graph/SKILL.md +58 -0
  26. package/bundled/locales/zh-CN/skills/knowledge-graph/guide.md +74 -0
  27. package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +125 -8
  28. package/bundled/locales/zh-CN/skills/observability-assistant/guide.md +188 -0
  29. package/bundled/locales/zh-CN/skills/orchestrate/SKILL.md +173 -0
  30. package/bundled/locales/zh-CN/skills/plan/SKILL.md +240 -0
  31. package/bundled/locales/zh-CN/skills/push/SKILL.md +242 -0
  32. package/bundled/locales/zh-CN/skills/retrospective-assistant/SKILL.md +104 -36
  33. package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +88 -32
  34. package/bundled/locales/zh-CN/skills/runbook-assistant/guide.md +216 -0
  35. package/bundled/locales/zh-CN/skills/skill-builder/SKILL.md +149 -0
  36. package/bundled/locales/zh-CN/skills/slo-assistant/guide.md +188 -0
  37. package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +86 -0
  38. package/bundled/locales/zh-CN/skills/spec-derivation/guide.md +476 -0
  39. package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +155 -81
  40. package/bundled/locales/zh-CN/skills/sweep/SKILL.md +151 -0
  41. package/bundled/locales/zh-CN/skills/testing-guide/SKILL.md +207 -110
  42. package/bundled/locales/zh-TW/CHANGELOG.md +23 -3
  43. package/bundled/locales/zh-TW/README.md +1 -1
  44. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +46 -0
  45. package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +222 -5
  46. package/bundled/locales/zh-TW/core/contract-testing-standards.md +184 -5
  47. package/bundled/locales/zh-TW/core/cross-flow-regression.md +192 -5
  48. package/bundled/locales/zh-TW/core/forward-derivation-standards.md +19 -0
  49. package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +2 -2
  50. package/bundled/locales/zh-TW/core/release-readiness-gate.md +186 -5
  51. package/bundled/locales/zh-TW/core/spec-driven-development.md +20 -2
  52. package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +21 -42
  53. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +212 -59
  54. package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +266 -579
  55. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +91 -26
  56. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +77 -15
  57. package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +75 -16
  58. package/bundled/locales/zh-TW/skills/dev-methodology/guide.md +255 -0
  59. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +125 -64
  60. package/bundled/locales/zh-TW/skills/knowledge-graph/SKILL.md +5 -5
  61. package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +74 -0
  62. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +128 -11
  63. package/bundled/locales/zh-TW/skills/observability-assistant/guide.md +188 -0
  64. package/bundled/locales/zh-TW/skills/orchestrate/SKILL.md +3 -2
  65. package/bundled/locales/zh-TW/skills/plan/SKILL.md +3 -2
  66. package/bundled/locales/zh-TW/skills/push/SKILL.md +3 -2
  67. package/bundled/locales/zh-TW/skills/retrospective-assistant/SKILL.md +94 -28
  68. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +84 -28
  69. package/bundled/locales/zh-TW/skills/runbook-assistant/guide.md +216 -0
  70. package/bundled/locales/zh-TW/skills/slo-assistant/guide.md +188 -0
  71. package/bundled/locales/zh-TW/skills/spec-derivation/guide.md +476 -0
  72. package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +148 -77
  73. package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +141 -44
  74. package/bundled/skills/brainstorm-assistant/SKILL.md +142 -106
  75. package/bundled/skills/brainstorm-assistant/guide.md +256 -661
  76. package/bundled/skills/commands/brainstorm.md +51 -30
  77. package/bundled/skills/knowledge-graph/SKILL.md +5 -5
  78. package/bundled/skills/knowledge-graph/guide.md +4 -4
  79. package/bundled/skills/spec-driven-dev/SKILL.md +27 -0
  80. package/package.json +2 -2
  81. package/src/commands/check.js +11 -2
  82. package/src/lint/i18n.js +109 -23
  83. package/standards-registry.json +4 -4
  84. package/bundled/locales/zh-TW/docs/SKILL-FALLBACK-GUIDE.md +0 -407
@@ -3,7 +3,8 @@ name: dev-workflow-guide
3
3
  source: ../../../../skills/dev-workflow-guide/SKILL.md
4
4
  source_version: 1.0.0
5
5
  translation_version: 1.0.0
6
- last_synced: 2026-03-24
6
+ last_synced: 2026-06-02
7
+ source_hash: 5bf83f0db544
7
8
  status: current
8
9
  description: "[UDS] 將軟體開發階段對應到 UDS 指令與功能的指南"
9
10
  ---
@@ -19,27 +20,29 @@ description: "[UDS] 將軟體開發階段對應到 UDS 指令與功能的指南"
19
20
  ## 軟體開發階段總覽
20
21
 
21
22
  ```
22
- I. 規劃設計 ──► II. 測試驅動開發 ──► III. 程式碼開發 ──► IV. 品質保證
23
+ I. Planning ──► II. Testing Design ──► III. Implementation ──► IV. Quality Gates
24
+ 需求設計 測試驅動開發 程式碼開發 品質保證
23
25
 
24
- V. 版本提交 ──► VI. 文件與架構 ──► VII. 工具與標準 ──► VIII. 進階分析
26
+ V. Release ──► VI. Documentation ──► VII. Standards ──► VIII. Advanced
27
+ 版本提交 文件與架構 工具與標準 進階分析
25
28
  ```
26
29
 
27
30
  ### 快速對照表
28
31
 
29
- | 階段 | UDS 指令 | 用途 |
30
- |------|----------|------|
31
- | **I. 規劃與設計** | `/brainstorm` `/requirement` `/sdd` `/reverse` | 需求、規格、逆向工程 |
32
- | **II. 測試驅動開發** | `/bdd` `/atdd` `/tdd` `/coverage` `/derive` | 先寫測試再寫程式 |
33
- | **III. 實作** | `/refactor` `/reverse` | 撰寫與改善程式碼 |
34
- | **IV. 品質關卡** | `/checkin` `/review` | 提交前檢查與程式碼審查 |
35
- | **V. 發布與提交** | `/commit` `/changelog` `/release` | 版本、提交、發布 |
36
- | **VI. 文件** | `/docs` `/docgen` `/struct` | 文件與專案結構 |
37
- | **VII. 工具與標準** | `/discover` `/testing` `/guide` `/git` | 參考指南 |
38
- | **VIII. 進階分析** | `/methodology` | 跨方法論工作流程 |
32
+ | 階段 | UDS 指令 | 目的 | 用途 |
33
+ |------|----------|------|------|
34
+ | **I. 規劃與設計** | `/brainstorm` `/requirement` `/sdd` `/reverse` `/api-design` `/database` | Requirements, specs, API/DB design | 需求、規格、API/DB 設計 |
35
+ | **II. 測試驅動開發** | `/bdd` `/atdd` `/tdd` `/coverage` `/derive` `/ac-coverage` | Design tests before code | 先寫測試再寫程式 |
36
+ | **III. 實作** | `/refactor` `/reverse` `/migrate` `/durable` | Write, improve, and migrate code | 撰寫、改善與遷移程式碼 |
37
+ | **IV. 品質關卡** | `/checkin` `/review` `/security` `/scan` `/incident` | Quality, security, incident response | 品質、安全、事故回應 |
38
+ | **V. 發布與提交** | `/commit` `/changelog` `/release` `/pr` `/ci-cd` | Version, commit, PR, CI/CD | 版本、提交、PR、CI/CD |
39
+ | **VI. 文件** | `/docs` `/docgen` | Docs and project structure | 文件與專案結構 |
40
+ | **VII. 工具與標準** | `/discover` `/guide` `/metrics` `/audit` | Reference guides, metrics, audit | 參考指南、指標、審計 |
41
+ | **VIII. 進階分析** | `/methodology` | Cross-methodology workflows | 跨方法論工作流程 |
39
42
 
40
43
  ## 常見場景
41
44
 
42
- ### 場景 1:新功能開發
45
+ ### 場景 1:新功能開發(Greenfield)
43
46
 
44
47
  從零開始建立新功能的推薦流程:
45
48
 
@@ -47,15 +50,15 @@ V. 版本提交 ──► VI. 文件與架構 ──► VII. 工具與標準 ─
47
50
  /brainstorm → /requirement → /sdd → /derive → /tdd → /checkin → /commit
48
51
  ```
49
52
 
50
- | 步驟 | 指令 | 做什麼 |
51
- |------|------|--------|
52
- | 1 | `/brainstorm` | 探索想法與方法 |
53
- | 2 | `/requirement` | 撰寫使用者故事(INVEST 準則) |
54
- | 3 | `/sdd` | 建立規格文件 |
55
- | 4 | `/derive` | 從規格產生測試骨架 |
56
- | 5 | `/tdd` | 用紅綠重構循環實作 |
57
- | 6 | `/checkin` | 驗證品質關卡 |
58
- | 7 | `/commit` | 建立規範化提交 |
53
+ | 步驟 | 指令 | 做什麼 | 做什麼 |
54
+ |------|------|--------|--------|
55
+ | 1 | `/brainstorm` | Explore ideas and approaches | 探索想法與方法 |
56
+ | 2 | `/requirement` | Write user stories (INVEST criteria) | 撰寫使用者故事 |
57
+ | 3 | `/sdd` | Create specification document | 建立規格文件 |
58
+ | 4 | `/derive` | Generate test skeletons from spec | 從規格產生測試骨架 |
59
+ | 5 | `/tdd` | Implement with Red-Green-Refactor | 用紅綠重構循環實作 |
60
+ | 6 | `/checkin` | Verify quality gates | 驗證品質關卡 |
61
+ | 7 | `/commit` | Create conventional commit | 建立規範化提交 |
59
62
 
60
63
  ### 場景 2:修復錯誤
61
64
 
@@ -65,13 +68,13 @@ V. 版本提交 ──► VI. 文件與架構 ──► VII. 工具與標準 ─
65
68
  /discover → /reverse → /tdd → /checkin → /commit
66
69
  ```
67
70
 
68
- | 步驟 | 指令 | 做什麼 |
69
- |------|------|--------|
70
- | 1 | `/discover` | 評估受影響區域健康度 |
71
- | 2 | `/reverse` | 理解現有程式碼結構 |
72
- | 3 | `/tdd` | 先寫失敗測試,再修復 |
73
- | 4 | `/checkin` | 驗證品質關卡 |
74
- | 5 | `/commit` | 建立規範化提交 |
71
+ | 步驟 | 指令 | 做什麼 | 做什麼 |
72
+ |------|------|--------|--------|
73
+ | 1 | `/discover` | Assess affected area health | 評估受影響區域健康度 |
74
+ | 2 | `/reverse` | Understand existing code structure | 理解現有程式碼結構 |
75
+ | 3 | `/tdd` | Write failing test, then fix | 先寫失敗測試,再修復 |
76
+ | 4 | `/checkin` | Verify quality gates | 驗證品質關卡 |
77
+ | 5 | `/commit` | Create conventional commit | 建立規範化提交 |
75
78
 
76
79
  ### 場景 3:重構
77
80
 
@@ -81,41 +84,75 @@ V. 版本提交 ──► VI. 文件與架構 ──► VII. 工具與標準 ─
81
84
  /discover → /reverse → /coverage → /refactor → /checkin → /commit
82
85
  ```
83
86
 
84
- | 步驟 | 指令 | 做什麼 |
85
- |------|------|--------|
86
- | 1 | `/discover` | 評估專案健康度與風險 |
87
- | 2 | `/reverse` | 記錄目前行為 |
88
- | 3 | `/coverage` | 確保測試安全網存在 |
89
- | 4 | `/refactor` | 套用重構策略 |
90
- | 5 | `/checkin` | 驗證品質關卡 |
91
- | 6 | `/commit` | 建立規範化提交 |
87
+ | 步驟 | 指令 | 做什麼 | 做什麼 |
88
+ |------|------|--------|--------|
89
+ | 1 | `/discover` | Assess project health and risks | 評估專案健康度與風險 |
90
+ | 2 | `/reverse` | Document current behavior | 記錄目前行為 |
91
+ | 3 | `/coverage` | Ensure test safety net exists | 確保測試安全網存在 |
92
+ | 4 | `/refactor` | Apply refactoring strategies | 套用重構策略 |
93
+ | 5 | `/checkin` | Verify quality gates | 驗證品質關卡 |
94
+ | 6 | `/commit` | Create conventional commit | 建立規範化提交 |
95
+
96
+ ### 場景 4:安全審查
97
+
98
+ 安全審查與漏洞修復的推薦流程:
99
+
100
+ ```
101
+ /scan → /security → /checkin → /commit
102
+ ```
103
+
104
+ | 步驟 | 指令 | 做什麼 | 做什麼 |
105
+ |------|------|--------|--------|
106
+ | 1 | `/scan` | Run automated security scans (deps, secrets) | 執行自動化安全掃描 |
107
+ | 2 | `/security` | Deep security review (OWASP) | 深入安全審查 |
108
+ | 3 | `/checkin` | Verify quality gates | 驗證品質關卡 |
109
+ | 4 | `/commit` | Create conventional commit | 建立規範化提交 |
110
+
111
+ ### 場景 5:API 設計與實作
112
+
113
+ API 設計與實作的推薦流程:
114
+
115
+ ```
116
+ /brainstorm → /api-design → /sdd → /derive → /tdd → /pr
117
+ ```
118
+
119
+ | 步驟 | 指令 | 做什麼 | 做什麼 |
120
+ |------|------|--------|--------|
121
+ | 1 | `/brainstorm` | Explore API approaches | 探索 API 方案 |
122
+ | 2 | `/api-design` | Design endpoints and schemas | 設計端點與 schema |
123
+ | 3 | `/sdd` | Create specification document | 建立規格文件 |
124
+ | 4 | `/derive` | Generate test skeletons | 產生測試骨架 |
125
+ | 5 | `/tdd` | Implement with tests | 搭配測試實作 |
126
+ | 6 | `/pr` | Create pull request | 建立 Pull Request |
92
127
 
93
128
  ## 使用方式
94
129
 
95
130
  ```bash
96
- /dev-workflow # 顯示完整階段總覽
97
- /dev-workflow planning # 取得第 I 階段指引
98
- /dev-workflow testing # 取得第 II 階段指引
99
- /dev-workflow new-feature # 取得新功能工作流程
100
- /dev-workflow bug-fix # 取得修復錯誤工作流程
101
- /dev-workflow refactoring # 取得重構工作流程
131
+ /dev-workflow # Show full phase overview
132
+ /dev-workflow planning # Get Phase I guidance
133
+ /dev-workflow testing # Get Phase II guidance
134
+ /dev-workflow new-feature # Get new feature workflow
135
+ /dev-workflow bug-fix # Get bug fix workflow
136
+ /dev-workflow refactoring # Get refactoring workflow
102
137
  ```
103
138
 
104
139
  ### 支援的參數
105
140
 
106
- | 參數 | 說明 |
107
- |------|------|
108
- | `planning` | I 階段:規劃與設計 |
109
- | `testing` | II 階段:測試驅動開發 |
110
- | `implementation` | III 階段:程式碼開發 |
111
- | `quality` | IV 階段:品質保證 |
112
- | `release` | V 階段:版本與提交 |
113
- | `docs` | VI 階段:文件與架構 |
114
- | `standards` | VII 階段:工具與標準 |
115
- | `advanced` | VIII 階段:進階系統分析 |
116
- | `new-feature` | 場景:新功能開發 |
117
- | `bug-fix` | 場景:修復錯誤 |
118
- | `refactoring` | 場景:重構 |
141
+ | 參數 | 說明 | 說明 |
142
+ |------|------|------|
143
+ | `planning` | Phase I: Planning & Design | 需求與設計 |
144
+ | `testing` | Phase II: Test-Driven Development | 測試驅動開發 |
145
+ | `implementation` | Phase III: Implementation | 程式碼開發 |
146
+ | `quality` | Phase IV: Quality Gates | 品質保證 |
147
+ | `release` | Phase V: Release & Commit | 版本與提交 |
148
+ | `docs` | Phase VI: Documentation | 文件與架構 |
149
+ | `standards` | Phase VII: Tools & Standards | 工具與標準 |
150
+ | `advanced` | Phase VIII: Advanced Analysis | 進階系統分析 |
151
+ | `new-feature` | Scenario: New feature workflow | 場景:新功能開發 |
152
+ | `bug-fix` | Scenario: Bug fix workflow | 場景:修復錯誤 |
153
+ | `refactoring` | Scenario: Refactoring workflow | 場景:重構 |
154
+ | `security` | Scenario: Security review workflow | 場景:安全審查 |
155
+ | `api` | Scenario: API design workflow | 場景:API 設計 |
119
156
 
120
157
  ## 工作流程行為
121
158
 
@@ -125,17 +162,41 @@ V. 版本提交 ──► VI. 文件與架構 ──► VII. 工具與標準 ─
125
162
  2. **階段參數**:顯示該階段的詳細指引,包含所有相關指令與範例
126
163
  3. **場景參數**:顯示該場景的推薦逐步工作流程
127
164
 
165
+ 此技能會從 [workflow-phases.md](./workflow-phases.md) 讀取詳細的階段資訊。
166
+
128
167
  ## 下一步引導
129
168
 
130
169
  `/dev-workflow` 完成後,AI 助手應根據使用者情況建議:
131
170
 
132
- > **工作流程已顯示。建議下一步:**
133
- > - 新功能開發 → 執行 `/brainstorm` 探索想法
134
- > - 修復錯誤 → 執行 `/discover` 評估受影響區域
135
- > - 重構程式碼 → 執行 `/discover` 評估健康度
136
- > - 遺留系統 → 執行 `/reverse` 進行系統考古
171
+ > **工作流程已顯示。建議下一步 / Workflow displayed. Suggested next steps:**
172
+ > - 新功能開發 → 執行 `/brainstorm` 探索想法 ⭐ **Recommended / 推薦** — New feature → Run `/brainstorm` to explore ideas
173
+ > - 修復錯誤 → 執行 `/discover` 評估受影響區域 — Bug fix → Run `/discover` to assess affected area
174
+ > - 重構程式碼 → 執行 `/discover` 評估健康度 — Refactoring → Run `/discover` to assess health
175
+ > - 遺留系統 → 執行 `/reverse` 進行系統考古 — Legacy system → Run `/reverse` for system archeology
176
+ > - 安全審查 → 執行 `/scan` 掃描漏洞 — Security review → Run `/scan` to find vulnerabilities
177
+ > - API 開發 → 執行 `/api-design` 設計端點 — API development → Run `/api-design` to design endpoints
178
+ > - 事故回應 → 執行 `/incident` 啟動回應流程 — Incident → Run `/incident` to start response
137
179
 
138
180
  ## 參考
139
181
 
140
- - 詳細階段指引:[workflow-phases.md](../../../../skills/dev-workflow-guide/workflow-phases.md)
141
- - 每日工作流程指南:[DAILY-WORKFLOW-GUIDE.md](../../../../adoption/DAILY-WORKFLOW-GUIDE.md)
182
+ - [詳細階段指引](./workflow-phases.md) - 完整的逐階段參考
183
+ - [每日工作流程指南](../../adoption/DAILY-WORKFLOW-GUIDE.md) - 完整的每日工作流程指南
184
+ - [功能開發工作流程](../workflows/feature-dev.yaml) - 自動化功能開發工作流程
185
+ - [整合流程工作流程](../workflows/integrated-flow.yaml) - 完整的 ATDD/SDD/BDD/TDD 工作流程
186
+
187
+ ---
188
+
189
+ ## 版本歷史
190
+
191
+ | 版本 | 日期 | 變更內容 |
192
+ |------|------|----------|
193
+ | 1.1.0 | 2026-03-24 | 新增 11 個指令、2 個新場景(安全審查、API 設計) |
194
+ | 1.0.0 | 2026-03-04 | 初版:8 個開發階段、3 個場景、以階段為基礎的導覽 |
195
+
196
+ ---
197
+
198
+ ## 授權
199
+
200
+ 本技能以 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 授權釋出。
201
+
202
+ **來源**:[universal-dev-standards](https://github.com/AsiaOstrich/universal-dev-standards)
@@ -14,7 +14,7 @@ description: "[UDS] 透過知識圖追蹤規格/決策/程式碼的影響鏈
14
14
 
15
15
  依據[知識圖記憶標準](../../../../core/knowledge-graph-memory.md)的關係 schema,回答橫跨規格、決策與程式碼的結構性問題——*「XSPEC-205 的完整影響鏈是什麼?」*。有無圖引擎皆可運作。
16
16
 
17
- > **Implements**: XSPEC-237 Phase 5 — knowledge-graph skill(CodeSage opt-in)
17
+ > **Implements**: XSPEC-237 Phase 5 — knowledge-graph skill(EngramGraph opt-in)
18
18
 
19
19
  ## 模式選擇
20
20
 
@@ -22,7 +22,7 @@ description: "[UDS] 透過知識圖追蹤規格/決策/程式碼的影響鏈
22
22
 
23
23
  | 條件 | 模式 |
24
24
  |------|------|
25
- | 設定了 `CODESAGE_URL`,或本機圖引擎 `/health` 有回應 | 服務模式(引擎)|
25
+ | 設定了 `ENGRAM_URL`,或本機圖引擎 `/health` 有回應 | 服務模式(引擎)|
26
26
  | 否則 | 降級模式(Markdown)|
27
27
 
28
28
  ## 工作流程
@@ -31,7 +31,7 @@ description: "[UDS] 透過知識圖追蹤規格/決策/程式碼的影響鏈
31
31
  2. **選擇模式**——探測圖引擎(服務)否則後備(降級)。
32
32
  3. **服務模式(AC-5b)**——送出單一多跳查詢,呈現回傳的鏈(含跨域連結 code → spec → decision):
33
33
  ```bash
34
- curl -s -X POST "$CODESAGE_URL/graph/impact-analysis" \
34
+ curl -s -X POST "$ENGRAM_URL/graph/impact-analysis" \
35
35
  -H 'content-type: application/json' \
36
36
  -d '{"nodeId":"XSPEC-205","maxHops":3}'
37
37
  ```
@@ -45,12 +45,12 @@ description: "[UDS] 透過知識圖追蹤規格/決策/程式碼的影響鏈
45
45
 
46
46
  ## 下一步引導
47
47
 
48
- - 降級模式若觸及讀取深度上限,告知使用者圖引擎(如 CodeSage)可給出完整鏈,以及如何設定 `CODESAGE_URL`。
48
+ - 降級模式若觸及讀取深度上限,告知使用者圖引擎(如 EngramGraph)可給出完整鏈,以及如何設定 `ENGRAM_URL`。
49
49
  - 若參照的 id 找不到,標示為待修的懸空參照。
50
50
  - 主動提議為遍歷過的文件補上缺漏的 `impacts`/`impacted_by` front-matter。
51
51
 
52
52
  ## 參考
53
53
 
54
54
  - 標準:[core/knowledge-graph-memory.md](../../../../core/knowledge-graph-memory.md)
55
- - 引擎(opt-in):[CodeSage](https://github.com/AsiaOstrich/CodeSage) — `@asiaostrich/codesage`
55
+ - 引擎(opt-in):[EngramGraph](https://github.com/AsiaOstrich/EngramGraph) — `engramgraph`
56
56
  - 詳細指南:[guide.md](guide.md)
@@ -0,0 +1,74 @@
1
+ ---
2
+ source: ../../../../skills/knowledge-graph/guide.md
3
+ source_version: 1.0.0
4
+ translation_version: 1.0.0
5
+ last_synced: 2026-06-02
6
+ source_hash: 9c86b5a2a71d
7
+ status: current
8
+ ---
9
+
10
+ # Knowledge Graph — 詳細指南
11
+
12
+ [SKILL.md](SKILL.md) 的配套說明。兩種運作模式的範例與引擎 API。
13
+
14
+ ---
15
+
16
+ ## 1. 服務模式(graph 引擎)
17
+
18
+ 當有相容於 EngramGraph 的引擎可連線時,單次查詢即可回傳完整影響鏈。
19
+
20
+ ### 影響分析
21
+
22
+ ```bash
23
+ curl -s -X POST "$ENGRAM_URL/graph/impact-analysis" \
24
+ -H 'content-type: application/json' \
25
+ -d '{"nodeId":"XSPEC-205","maxHops":3}'
26
+ # => { "nodeId": "XSPEC-205",
27
+ # "decisions": [ {"id":"DEC-062","title":"...","via":"direct"},
28
+ # {"id":"DEC-069","title":"...","via":"supersedes"} ] }
29
+ ```
30
+
31
+ `via: "direct"` 表示該決策直接 IMPACTS 此 spec;`via: "supersedes"` 表示它透過 SUPERSEDES 影響鏈(≤ `maxHops`)連到此 spec。
32
+
33
+ ### 信心回饋(SAGE)
34
+
35
+ ```bash
36
+ curl -s -X POST "$ENGRAM_URL/graph/ingest" \
37
+ -H 'content-type: application/json' \
38
+ -d '{"type":"test_fail","functionId":"src/a.ts#execute"}'
39
+ ```
40
+
41
+ 降低該節點的信心值;之後讀取時會優先浮現信心較高的節點。
42
+
43
+ ---
44
+
45
+ ## 2. 降級模式(僅 Markdown)
46
+
47
+ 不需要引擎。透過讀取檔案重建影響鏈:
48
+
49
+ 1. 讀取目標文件(例如 `XSPEC-205`)。
50
+ 2. 從其 front-matter(`impacts`、`impacted_by`、`supersedes`、`related`)與行內 `[[ref]]` 連結蒐集 id。
51
+ 3. 對每個 id,讀取該文件並重複此過程,直到所需的跳數深度。
52
+ 4. 依前綴分類每個 id(`XSPEC-*`/`SPEC-*` → Spec;`DEC-*`/`ADR-*` → Decision)並回報邊。
53
+
54
+ ```bash
55
+ # find the documents
56
+ grep -rl "id: XSPEC-205" --include='*.md' .
57
+ # discover outbound references
58
+ grep -nE "(impacts|impacted_by|supersedes|related):|\[\[(XSPEC|DEC|ADR)-" path/to/XSPEC-205.md
59
+ ```
60
+
61
+ 降級模式永遠正確,但受限於你讀取了多少檔案;跨領域的程式碼連結(function → spec)通常只在服務模式中可用。
62
+
63
+ ---
64
+
65
+ ## 3. 等價性
66
+
67
+ 兩種模式產生**相同形狀的答案**(一份相連的 Specs/Decisions 清單,附帶邊類型)。服務模式更快且更完整(可包含 code→spec→decision 的跳轉);降級模式則是通用後備。務必告知使用者答案來自哪種模式。
68
+
69
+ ---
70
+
71
+ ## 參考
72
+
73
+ - [core/knowledge-graph-memory.md](../../core/knowledge-graph-memory.md)
74
+ - [EngramGraph](https://github.com/AsiaOstrich/EngramGraph)
@@ -2,8 +2,9 @@
2
2
  name: migration-assistant
3
3
  source: ../../../../skills/migration-assistant/SKILL.md
4
4
  source_version: 1.0.0
5
+ source_hash: 67b6f33f825e
5
6
  translation_version: 1.0.0
6
- last_synced: 2026-03-24
7
+ last_synced: 2026-06-01
7
8
  status: current
8
9
  description: "[UDS] 引導程式碼遷移、框架升級與技術現代化"
9
10
  ---
@@ -21,19 +22,19 @@ description: "[UDS] 引導程式碼遷移、框架升級與技術現代化"
21
22
  | `/migrate` | 啟動互動式遷移引導 |
22
23
  | `/migrate --assess` | 僅風險評估 |
23
24
  | `/migrate "Vue 2 to 3"` | 引導特定遷移 |
24
- | `/migrate --deps` | 依賴升級分析 |
25
+ | `/migrate --deps` | 相依升級分析 |
25
26
  | `/migrate --rollback` | 規劃回滾策略 |
26
27
 
27
28
  ## 遷移類型
28
29
 
29
30
  | 類型 | 範例 | 風險 |
30
31
  |------|------|------|
31
- | **框架升級** | React 17→18, Vue 2→3 | 中高 |
32
- | **語言遷移** | JS→TS, Python 2→3 | 高 |
33
- | **API 版本** | REST v1→v2, GraphQL 更新 | 中 |
34
- | **資料庫遷移** | MySQL→PostgreSQL | 極高 |
35
- | **建構工具** | Webpack→Vite | 低中 |
36
- | **套件管理器** | npm→pnpm | 低 |
32
+ | **框架升級** | React 17→18, Vue 2→3, Angular 15→17 | 中高 |
33
+ | **語言遷移** | JS→TS, Python 2→3, Java 8→17 | 高 |
34
+ | **API 版本** | REST v1→v2, GraphQL schema 更新 | 中 |
35
+ | **資料庫遷移** | MySQL→PostgreSQL, SQL→NoSQL | 極高 |
36
+ | **建構工具** | Webpack→Vite, Grunt→ESBuild | 低中 |
37
+ | **套件管理器** | npm→pnpm, pip→poetry | 低 |
37
38
 
38
39
  ## 風險評估矩陣
39
40
 
@@ -46,11 +47,97 @@ description: "[UDS] 引導程式碼遷移、框架升級與技術現代化"
46
47
  ## 工作流程
47
48
 
48
49
  1. **評估** - 評估現狀、識別破壞性變更
49
- 2. **規劃** - 建立含依賴關係的遷移清單
50
+ 2. **規劃** - 建立含相依關係的遷移清單
50
51
  3. **準備** - 設定 codemods、相容層、功能旗標
51
52
  4. **遷移** - 分階段執行遷移並測試
52
53
  5. **驗證** - 執行完整測試套件、檢查回歸
53
- 6. **清理** - 移除相容層、舊依賴
54
+ 6. **清理** - 移除相容層、舊相依
55
+
56
+ ## API 遷移合約測試
57
+
58
+ 當 API endpoint 從一個技術棧遷至另一個(PHP → .NET、Express → Spring、Python → Go),對**新**實作的單元測試只驗證**新 DTO**——無法捕捉「舊版有但新版漏掉的欄位」。欄位缺漏、欄位 rename、型別漂移,以及頂層 vs nested 層級漂移等問題會靜默流入生產,導致仍預期舊版 shape 的既有前端失靈。
59
+
60
+ **僅靠單元測試、整合測試或 code review 無法防止**。2026-05-24 真實 PROD 事故:67/67 測試全綠流入正式環境,由客戶發現缺漏。
61
+
62
+ ### 強制規則
63
+
64
+ 每個被遷移的 API endpoint **必須**至少有一份 contract test,比對新實作的 response 與從 legacy 實作捕獲的 fixture。驗證的是結構性等價(keys、type、層級位置),而非值等價。
65
+
66
+ ### Fixture 捕獲協議
67
+
68
+ **Legacy 仍運行(典型遷移窗口):**
69
+
70
+ ```bash
71
+ # 1. Capture ≥3 representative inputs (happy path, edge case, empty result)
72
+ curl -X POST $LEGACY_BASE/endpoint -d @input1.json \
73
+ > tests/fixtures/migration/endpoint/scenario1.json
74
+ curl -X POST $LEGACY_BASE/endpoint -d @input2_empty.json \
75
+ > tests/fixtures/migration/endpoint/scenario2_empty.json
76
+ curl -X POST $LEGACY_BASE/endpoint -d @input3_edge.json \
77
+ > tests/fixtures/migration/endpoint/scenario3_edge.json
78
+
79
+ # 2. Scrub PII and volatile values (timestamps, generated IDs)
80
+ jq 'walk(if type == "string" and test("@") then "redacted@example.com" else . end)' \
81
+ tests/fixtures/migration/endpoint/scenario1.json > tmp && mv tmp ...
82
+
83
+ # 3. Commit fixtures
84
+ git add tests/fixtures/migration/endpoint/
85
+ ```
86
+
87
+ **Legacy 已退役但 source 可讀:**
88
+
89
+ - 追蹤 legacy source code,手動建構預期的 response shape
90
+ - 將每個欄位的來源(SQL 欄位、計算式、hardcoded)記錄於同位置的 `.notes.md` 檔案
91
+
92
+ ### Contract test 範本
93
+
94
+ **C# / xUnit:**
95
+
96
+ ```csharp
97
+ [Theory]
98
+ [InlineData("scenario1")]
99
+ [InlineData("scenario2_empty")]
100
+ [InlineData("scenario3_edge")]
101
+ public async Task Endpoint_ResponseShape_MatchesLegacyFixture(string scenario)
102
+ {
103
+ var fixture = LoadFixture($"migration/endpoint/{scenario}");
104
+ var response = await CallNewImpl(fixture.Input);
105
+ // StructuralEquivalence checks keys + types + placement, ignores values
106
+ StructuralEquivalence.Assert(response, fixture.ExpectedShape);
107
+ }
108
+ ```
109
+
110
+ **TypeScript / Jest:**
111
+
112
+ ```typescript
113
+ import { structuralEquivalence } from "./test-utils/structural-equivalence";
114
+
115
+ describe.each([
116
+ ["scenario1"],
117
+ ["scenario2_empty"],
118
+ ["scenario3_edge"],
119
+ ])("Endpoint response shape vs legacy fixture (%s)", (scenario) => {
120
+ test("matches", async () => {
121
+ const fixture = loadFixture(`migration/endpoint/${scenario}.json`);
122
+ const response = await callNewImpl(fixture.input);
123
+ structuralEquivalence(response, fixture.expectedShape);
124
+ });
125
+ });
126
+ ```
127
+
128
+ `structuralEquivalence` / `StructuralEquivalence.Assert` 規則:每一層具備相同的 key 集合(不可缺漏、不可多出,除非明確 opt in)、每個 key 具相同的基本型別、相同的層級位置(頂層 vs nested)。值可以不同(timestamps、IDs);型別與結構不可不同。
129
+
130
+ ### 逐欄位遷移稽核清單
131
+
132
+ 合併任何被遷移的 endpoint 前:
133
+
134
+ - [ ] 所有 legacy response 欄位皆 mapping 至新 DTO(無 silent drop)
135
+ - [ ] 儘量保留命名(避免將 `TotalX` rename 而丟失「per-member」語意)
136
+ - [ ] 保留頂層 vs nested 層級位置
137
+ - [ ] 已驗證型別相容性(string→int 轉換為明確而非巧合)
138
+ - [ ] Error path return code 與 legacy 一致(`509` 而非 `506`;`404` 而非 `400`)
139
+ - [ ] Contract test fixture 已 commit 至 `tests/fixtures/migration/`
140
+ - [ ] Cross-link 至 [contract-test-assistant](../contract-test-assistant/SKILL.md) 做持續的消費端驗證
54
141
 
55
142
  ## 回滾策略
56
143
 
@@ -61,15 +148,45 @@ description: "[UDS] 引導程式碼遷移、框架升級與技術現代化"
61
148
  | **雙運行** | 關鍵系統、零停機 |
62
149
  | **分支凍結** | 一次性完整遷移 |
63
150
 
151
+ ## 使用範例
152
+
153
+ ```
154
+ User: /migrate "Vue 2 to 3"
155
+ AI: Migration Assessment: Vue 2 → Vue 3
156
+ Breaking changes found: 12
157
+ - Options API → Composition API (47 components)
158
+ - Filters removed (8 usages)
159
+ - Event bus removed (3 usages)
160
+ Risk: Medium-High
161
+ Estimated effort: 2-3 weeks
162
+ Recommended: Staged migration with @vue/compat
163
+ ```
164
+
64
165
  ## 下一步引導
65
166
 
66
167
  `/migrate` 完成後,AI 助手應建議:
67
168
 
68
169
  > **遷移分析完成。建議下一步:**
69
170
  > - 執行 `/reverse` 深入理解現有程式碼
70
- > - 執行 `/testing` 確保遷移後測試通過
171
+ > - 執行 `/testing` 確保遷移後測試通過 ⭐ **推薦**
71
172
  > - 執行 `/commit` 提交遷移變更
72
173
 
73
174
  ## 參考
74
175
 
75
176
  - 核心規範:[refactoring-standards.md](../../../../core/refactoring-standards.md)
177
+ - 相關:[contract-test-assistant](../contract-test-assistant/SKILL.md) — 遷移後持續合約驗證的策略
178
+
179
+ ## 版本歷史
180
+
181
+ | 版本 | 日期 | 變更 |
182
+ |------|------|------|
183
+ | 1.1.0 | 2026-05-26 | 新增:API 遷移合約測試章節——強制 fixture 捕獲協議、C#/TS 範本、逐欄位稽核清單(XSPEC-233 / closes #112) |
184
+ | 1.0.0 | 2026-03-24 | 初始版本 |
185
+
186
+ ## AI 代理行為
187
+
188
+ > 完整的 AI 行為定義請參閱對應的命令文件:[`/migrate`](../commands/migrate.md#ai-agent-behavior--ai-代理行為)
189
+
190
+ ## 授權
191
+
192
+ CC BY 4.0