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.
Files changed (134) hide show
  1. package/bin/uds.js +2 -0
  2. package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +31 -0
  3. package/bundled/ai/standards/ai-instruction-standards.ai.yaml +190 -3
  4. package/bundled/ai/standards/forward-derivation-standards.ai.yaml +23 -0
  5. package/bundled/ai/standards/knowledge-graph-memory.ai.yaml +83 -0
  6. package/bundled/core/acceptance-criteria-traceability.md +46 -0
  7. package/bundled/core/ai-instruction-standards.md +136 -11
  8. package/bundled/core/forward-derivation-standards.md +19 -0
  9. package/bundled/core/knowledge-graph-memory.md +119 -0
  10. package/bundled/locales/COVERAGE.md +226 -0
  11. package/bundled/locales/zh-CN/CHANGELOG.md +42 -3
  12. package/bundled/locales/zh-CN/README.md +1 -1
  13. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  14. package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +46 -0
  15. package/bundled/locales/zh-CN/core/ai-instruction-standards.md +111 -5
  16. package/bundled/locales/zh-CN/core/forward-derivation-standards.md +19 -0
  17. package/bundled/locales/zh-CN/skills/ac-coverage/SKILL.md +194 -0
  18. package/bundled/locales/zh-CN/skills/adr-assistant/SKILL.md +135 -40
  19. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +217 -63
  20. package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +599 -0
  21. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +92 -25
  22. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +78 -16
  23. package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +85 -26
  24. package/bundled/locales/zh-CN/skills/deploy-assistant/SKILL.md +189 -0
  25. package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +110 -0
  26. package/bundled/locales/zh-CN/skills/dev-methodology/guide.md +255 -0
  27. package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +70 -11
  28. package/bundled/locales/zh-CN/skills/journey-test-assistant/SKILL.md +209 -0
  29. package/bundled/locales/zh-CN/skills/knowledge-graph/SKILL.md +58 -0
  30. package/bundled/locales/zh-CN/skills/knowledge-graph/guide.md +74 -0
  31. package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +125 -8
  32. package/bundled/locales/zh-CN/skills/observability-assistant/guide.md +188 -0
  33. package/bundled/locales/zh-CN/skills/orchestrate/SKILL.md +173 -0
  34. package/bundled/locales/zh-CN/skills/plan/SKILL.md +240 -0
  35. package/bundled/locales/zh-CN/skills/push/SKILL.md +242 -0
  36. package/bundled/locales/zh-CN/skills/retrospective-assistant/SKILL.md +104 -36
  37. package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +88 -32
  38. package/bundled/locales/zh-CN/skills/runbook-assistant/guide.md +216 -0
  39. package/bundled/locales/zh-CN/skills/skill-builder/SKILL.md +149 -0
  40. package/bundled/locales/zh-CN/skills/slo-assistant/guide.md +188 -0
  41. package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +86 -0
  42. package/bundled/locales/zh-CN/skills/spec-derivation/guide.md +476 -0
  43. package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +155 -81
  44. package/bundled/locales/zh-CN/skills/sweep/SKILL.md +151 -0
  45. package/bundled/locales/zh-CN/skills/testing-guide/SKILL.md +207 -110
  46. package/bundled/locales/zh-TW/CHANGELOG.md +46 -3
  47. package/bundled/locales/zh-TW/README.md +1 -1
  48. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  49. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +46 -0
  50. package/bundled/locales/zh-TW/core/ai-instruction-standards.md +130 -5
  51. package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +222 -5
  52. package/bundled/locales/zh-TW/core/contract-testing-standards.md +184 -5
  53. package/bundled/locales/zh-TW/core/cross-flow-regression.md +192 -5
  54. package/bundled/locales/zh-TW/core/forward-derivation-standards.md +19 -0
  55. package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +127 -0
  56. package/bundled/locales/zh-TW/core/release-readiness-gate.md +186 -5
  57. package/bundled/locales/zh-TW/core/self-review-protocol.md +9 -1
  58. package/bundled/locales/zh-TW/skills/ac-coverage/SKILL.md +192 -0
  59. package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +21 -42
  60. package/bundled/locales/zh-TW/skills/ai-collaboration-standards/SKILL.md +5 -1
  61. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +212 -59
  62. package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +266 -579
  63. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +91 -26
  64. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +77 -15
  65. package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +75 -16
  66. package/bundled/locales/zh-TW/skills/deploy-assistant/SKILL.md +187 -0
  67. package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +108 -0
  68. package/bundled/locales/zh-TW/skills/dev-methodology/guide.md +255 -0
  69. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +125 -64
  70. package/bundled/locales/zh-TW/skills/journey-test-assistant/SKILL.md +222 -0
  71. package/bundled/locales/zh-TW/skills/knowledge-graph/SKILL.md +56 -0
  72. package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +74 -0
  73. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +128 -11
  74. package/bundled/locales/zh-TW/skills/observability-assistant/guide.md +188 -0
  75. package/bundled/locales/zh-TW/skills/orchestrate/SKILL.md +173 -0
  76. package/bundled/locales/zh-TW/skills/plan/SKILL.md +240 -0
  77. package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +5 -1
  78. package/bundled/locales/zh-TW/skills/push/SKILL.md +242 -0
  79. package/bundled/locales/zh-TW/skills/retrospective-assistant/SKILL.md +94 -28
  80. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +84 -28
  81. package/bundled/locales/zh-TW/skills/runbook-assistant/guide.md +216 -0
  82. package/bundled/locales/zh-TW/skills/skill-builder/SKILL.md +165 -0
  83. package/bundled/locales/zh-TW/skills/slo-assistant/guide.md +188 -0
  84. package/bundled/locales/zh-TW/skills/spec-derivation/SKILL.md +83 -0
  85. package/bundled/locales/zh-TW/skills/spec-derivation/guide.md +476 -0
  86. package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +148 -77
  87. package/bundled/locales/zh-TW/skills/sweep/SKILL.md +149 -0
  88. package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +141 -44
  89. package/bundled/skills/adr-assistant/SKILL.md +1 -1
  90. package/bundled/skills/ai-collaboration-standards/SKILL.md +1 -1
  91. package/bundled/skills/ai-friendly-architecture/SKILL.md +1 -1
  92. package/bundled/skills/ai-instruction-standards/SKILL.md +1 -1
  93. package/bundled/skills/api-design-assistant/SKILL.md +1 -1
  94. package/bundled/skills/audit-assistant/SKILL.md +1 -1
  95. package/bundled/skills/brainstorm-assistant/SKILL.md +142 -106
  96. package/bundled/skills/brainstorm-assistant/guide.md +256 -661
  97. package/bundled/skills/ci-cd-assistant/SKILL.md +1 -1
  98. package/bundled/skills/commands/brainstorm.md +51 -30
  99. package/bundled/skills/contract-test-assistant/SKILL.md +1 -1
  100. package/bundled/skills/database-assistant/SKILL.md +1 -1
  101. package/bundled/skills/deploy-assistant/SKILL.md +1 -1
  102. package/bundled/skills/documentation-guide/SKILL.md +1 -1
  103. package/bundled/skills/error-code-guide/SKILL.md +1 -1
  104. package/bundled/skills/git-workflow-guide/SKILL.md +1 -1
  105. package/bundled/skills/incident-response-assistant/SKILL.md +1 -1
  106. package/bundled/skills/journey-test-assistant/SKILL.md +1 -1
  107. package/bundled/skills/knowledge-graph/SKILL.md +58 -0
  108. package/bundled/skills/knowledge-graph/guide.md +69 -0
  109. package/bundled/skills/logging-guide/SKILL.md +1 -1
  110. package/bundled/skills/observability-assistant/SKILL.md +1 -1
  111. package/bundled/skills/orchestrate/SKILL.md +1 -1
  112. package/bundled/skills/plan/SKILL.md +1 -1
  113. package/bundled/skills/pr-automation-assistant/SKILL.md +1 -1
  114. package/bundled/skills/project-structure-guide/SKILL.md +1 -1
  115. package/bundled/skills/push/SKILL.md +1 -1
  116. package/bundled/skills/retrospective-assistant/SKILL.md +1 -1
  117. package/bundled/skills/reverse-engineer/SKILL.md +1 -1
  118. package/bundled/skills/runbook-assistant/SKILL.md +1 -1
  119. package/bundled/skills/security-assistant/SKILL.md +1 -1
  120. package/bundled/skills/security-scan-assistant/SKILL.md +1 -1
  121. package/bundled/skills/slo-assistant/SKILL.md +1 -1
  122. package/bundled/skills/sweep/SKILL.md +1 -1
  123. package/bundled/skills/testing-guide/SKILL.md +1 -1
  124. package/package.json +2 -2
  125. package/src/commands/check.js +80 -0
  126. package/src/commands/init.js +8 -1
  127. package/src/commands/update.js +49 -14
  128. package/src/i18n/messages.js +32 -5
  129. package/src/installers/skills-installer.js +49 -0
  130. package/src/lint/i18n.js +424 -0
  131. package/src/utils/config-manager.js +39 -0
  132. package/src/utils/skills-installer.js +39 -7
  133. package/standards-registry.json +16 -4
  134. package/bundled/locales/zh-TW/docs/SKILL-FALLBACK-GUIDE.md +0 -407
@@ -3,145 +3,216 @@ name: spec-driven-dev
3
3
  source: ../../../../skills/spec-driven-dev/SKILL.md
4
4
  source_version: 1.2.0
5
5
  translation_version: 1.2.0
6
- last_synced: 2026-03-23
6
+ last_synced: 2026-06-02
7
+ source_hash: 195f50bcbfb7
7
8
  status: current
8
9
  description: "[UDS] 在撰寫程式碼前,建立、審查和管理規格文件"
9
10
  ---
11
+ <!-- DEPRECATION NOTICE (XSPEC-086 Phase 4, 2026-04-28):
12
+ SDD 生命週期編排(7 階段狀態機、階段轉換、閘門檢查)已遷移至
13
+ 採用層(adoption layer,XSPEC-095,2026-04-28)。本 Skill 保留:規格格式定義、狀態
14
+ 描述、delta 操作、決策樹。
15
+ 若需強制執行的生命週期,請使用你的採用層工具鏈。
16
+ -->
10
17
 
11
- # 規格驅動開發助手
18
+ # Spec-Driven Development Assistant | 規格驅動開發助手
19
+
20
+ 在撰寫程式碼前,建立、審查和管理規格文件。
12
21
 
13
22
  > **語言**: [English](../../../../skills/spec-driven-dev/SKILL.md) | 繁體中文
14
23
 
15
- 在撰寫程式碼前,建立、審查和管理規格文件。
24
+ ## When to Use `/sdd` vs `uds spec` | 何時使用
25
+
26
+ | 情境 | `/sdd` | `uds spec` |
27
+ |----------|--------|------------|
28
+ | 具審查循環的正式功能開發 | ✅ | ❌ |
29
+ | 完整規格生命週期(Draft → Archived) | ✅ | ❌ |
30
+ | 快速原型 / Vibe coding | ❌ | ✅ |
31
+ | 小型漸進式變更 | ❌ | ✅ |
32
+ | 需要利害關係人簽核 | ✅ | ❌ |
33
+ | 從自然語言意圖產生微規格(micro-spec) | ❌ | ✅ |
16
34
 
17
- ## 快速檢查清單
35
+ > **`/sdd`** = 正式開發的完整規格生命週期
36
+ > **`uds spec`** = 快速迭代的輕量微規格
37
+
38
+ ## TL;DR Quick Checklist | 快速檢查清單
18
39
 
19
40
  - 搜尋現有規格:查看 `specs/`、`docs/specs/` 或專案規格目錄
20
41
  - 決定範圍:新功能 vs 修改現有功能
21
- - 選擇唯一的規格 ID:`SPEC-NNN` 或 kebab-case 變更 ID
22
- - 撰寫包含明確 AC(Given/When/Then 格式)的提案
23
- - 實作前取得核准
24
- - 依序實作任務,對照規格驗證
25
- - 完成後歸檔規格
42
+ - 挑選唯一的規格 ID:`SPEC-NNN` 或 kebab-case 變更 ID
43
+ - 撰寫提案並附明確的 AC(Given/When/Then 格式)
44
+ - 在開始實作前取得核准
45
+ - 依序實作任務,並對照規格驗證
46
+ - 完成後將規格歸檔
26
47
 
27
- ## 決策樹
48
+ ## Decision Tree | 決策樹
28
49
 
29
50
  ```
30
- 新需求?
31
- ├─ 修復符合規格行為的 Bug → 直接修復
32
- ├─ 錯字/格式/註解? → 直接修復
33
- ├─ 相依套件更新(不破壞相容性)? → 直接修復
34
- ├─ 新功能/能力? → 建立提案
35
- ├─ 破壞性變更? → 建立提案
36
- ├─ 架構變更? → 建立提案
37
- └─ 不確定?建立提案(較安全)
51
+ New request? | 新需求?
52
+ ├─ Bug fix restoring spec behavior? Fix directly | 直接修復
53
+ ├─ Typo/format/comment?Fix directly | 直接修復
54
+ ├─ Dependency update (non-breaking)? Fix directly | 直接修復
55
+ ├─ New feature/capability? Create proposal | 建立提案
56
+ ├─ Breaking change? Create proposal | 建立提案
57
+ ├─ Architecture change? Create proposal | 建立提案
58
+ ├─ Agent/role definition (spans multiple features)? Use spec-type: agent | 使用 Agent SPEC template
59
+ └─ Unclear? → Create proposal (safer) | 建立提案(較安全)
38
60
  ```
39
61
 
40
- ## 工作流程
62
+ ## Workflow | 工作流程
41
63
 
42
64
  ```
43
65
  DISCUSS ──► CREATE ──► REVIEW ──► APPROVE ──► IMPLEMENT ──► VERIFY ──► ARCHIVE
44
66
  ```
45
67
 
46
- ### 0. Discuss - 釐清範圍
47
- 在撰寫規格前,捕捉模糊地帶、建立治理原則、解決歧義。
68
+ ### 0. Discuss - Clarify Scope | 釐清範圍
69
+ 在撰寫規格前,捕捉灰色地帶、建立治理原則、解決模糊之處。
48
70
 
49
- ### 1. Create - 撰寫規格
50
- 定義需求、技術設計、驗收條件和測試計畫。
71
+ ### 1. Create - Write Spec | 撰寫規格
72
+ 定義需求、技術設計、驗收條件與測試計畫。
51
73
 
52
- ### 2. Review - 審查驗證
53
- 與利害關係人檢查完整性、一致性和可行性。
74
+ ### 2. Review - Validate | 審查驗證
75
+ 與利害關係人一同檢查完整性、一致性與可行性。
54
76
 
55
- ### 3. Approve - 核准
56
- 在實作開始前取得利害關係人簽核。
77
+ ### 3. Approve - Sign Off | 核准
78
+ 在開始實作前取得利害關係人簽核。
57
79
 
58
- ### 4. Implement - 實作
59
- 依據已核准的規格進行開發,參照需求和驗收條件。
80
+ ### 4. Implement - Code | 實作
81
+ 依照核准的規格進行開發,參照需求與 AC。
60
82
 
61
- ### 5. Verify - 驗證
62
- 確保實作符合規格,所有測試通過,驗收條件已滿足。
83
+ ### 5. Verify - Confirm | 驗證
84
+ 確保實作符合規格、所有測試通過、AC 已滿足。
63
85
 
64
- ### 6. Archive - 歸檔
65
- 歸檔已完成的規格,連結至 commits/PRs。
86
+ ### 6. Archive - Close | 歸檔
87
+ 將完成的規格歸檔,並附上 commit/PR 連結。
66
88
 
67
- ## 規格狀態
89
+ ## Spec States | 規格狀態
68
90
 
69
- | 狀態 | 說明 | State | Description |
70
- |------|------|-------|-------------|
71
- | **Draft** | 草稿中 | Draft | Work in progress |
72
- | **Review** | 審查中 | Review | Under review |
73
- | **Approved** | 已核准 | Approved | Ready for implementation |
74
- | **Implemented** | 已實作 | Implemented | Code complete |
75
- | **Archived** | 已歸檔 | Archived | Completed or deprecated |
91
+ | 狀態 | 說明(英) | 說明 |
92
+ |-------|-------------|------|
93
+ | **Draft** | Work in progress | 草稿中 |
94
+ | **Review** | Under review | 審查中 |
95
+ | **Approved** | Ready for implementation | 已核准 |
96
+ | **Implemented** | Code complete | 已實作 |
97
+ | **Archived** | Completed or deprecated | 已歸檔 |
76
98
 
77
- ## 規格結構
99
+ ## Spec Structure | 規格結構
78
100
 
79
101
  ```markdown
80
102
  # [SPEC-ID] Feature: [Name]
81
103
 
82
104
  ## Overview
83
- 簡短描述提案變更。
105
+ Brief description of the proposed change.
84
106
 
85
107
  ## Motivation
86
- 為什麼需要這個變更?解決什麼問題?
108
+ Why is this change needed? What problem does it solve?
87
109
 
88
110
  ## Requirements
89
111
  ### Requirement: [Name]
90
- 系統 SHALL [行為描述]
112
+ The system SHALL [behavior description].
91
113
 
92
- #### Scenario: [成功案例]
93
- - **GIVEN** [初始情境]
94
- - **WHEN** [執行動作]
95
- - **THEN** [預期結果]
114
+ #### Scenario: [Success case]
115
+ - **GIVEN** [initial context]
116
+ - **WHEN** [action performed]
117
+ - **THEN** [expected result]
96
118
 
97
119
  ## Acceptance Criteria
98
120
  - AC-1: Given [context], when [action], then [result]
99
121
 
100
122
  ## Technical Design
101
- [架構、API 變更、資料庫變更]
123
+ [Architecture, API changes, database changes]
102
124
 
103
125
  ## Test Plan
104
- - [ ] [元件] 的單元測試
105
- - [ ] [流程] 的整合測試
126
+ - [ ] Unit tests for [component]
127
+ - [ ] Integration tests for [flow]
128
+ ```
129
+
130
+ ### Agent SPEC Structure | Agent 規格結構(`spec-type: agent`)
131
+
132
+ ```markdown
133
+ # [SPEC-ID] Agent: [Role Name]
134
+ <!-- spec-type: agent -->
135
+ <!-- agent-id auto-referenced by feature SPECs -->
136
+
137
+ ## Role Definition
138
+ - **Role**: [Agent Name]
139
+ - **Responsibility**: [One sentence]
140
+ - **Autonomy Level**: L[1-5] (per DEC-065)
141
+
142
+ ## Capability Scope
143
+ **Owns:**
144
+ - [Capability 1]
145
+ - [Capability 2]
146
+
147
+ **Does NOT own:**
148
+ - [Explicit exclusion]
149
+
150
+ ## Interface Contract
151
+ ### Input
152
+ | Message Type | Required Fields | Optional Fields |
153
+ |---|---|---|
154
+ | [Type] | [fields] | [fields] |
155
+
156
+ ### Output
157
+ | Artifact Type | Success Condition | Failure Condition |
158
+ |---|---|---|
159
+ | [Type] | [condition] | [condition] |
160
+
161
+ ## Agent Interactions
162
+ - **Upstream**: [Who calls this agent]
163
+ - **Downstream**: [Who this agent calls]
164
+ - **Parallel**: [Agents working alongside]
165
+
166
+ ## Related Feature SPECs
167
+ - [SPEC-NNN] — [This agent's role in that spec]
106
168
  ```
107
169
 
108
- ### 場景格式規則
170
+ ### Scenario Formatting Rules | 場景格式規則
109
171
 
110
- - 使用 `#### Scenario:` (h4 標題) 撰寫每個場景
111
- - 每個需求必須至少有一個場景
172
+ - 每個場景使用 `#### Scenario:`(h4 標題)
173
+ - 每個需求至少要有一個場景
112
174
  - 使用 **GIVEN/WHEN/THEN** 格式描述結構化行為
113
- - 使用 **SHALL/MUST** 表達強制需求,**SHOULD** 表達建議
175
+ - 規範性需求使用 **SHALL/MUST**,建議性內容使用 **SHOULD**
114
176
 
115
- ## 變更操作
177
+ ## Delta Operations | 變更操作
116
178
 
117
179
  修改現有規格時,使用 delta 區段:
118
180
 
119
- | 操作 | 說明 |
120
- |------|------|
121
- | `## ADDED Requirements` | 新增功能 |
122
- | `## MODIFIED Requirements` | 修改行為 |
123
- | `## REMOVED Requirements` | 移除功能 |
124
- | `## RENAMED Requirements` | 重新命名 |
181
+ | 操作 | 說明(英) | 說明 |
182
+ |-----------|-------------|------|
183
+ | `## ADDED Requirements` | New capabilities | 新增功能 |
184
+ | `## MODIFIED Requirements` | Changed behavior | 修改行為 |
185
+ | `## REMOVED Requirements` | Deprecated features | 移除功能 |
186
+ | `## RENAMED Requirements` | Name changes | 重新命名 |
125
187
 
126
- ## 使用方式
188
+ ## Usage | 使用方式
127
189
 
128
- - `/sdd` - 互動式規格建立精靈
129
- - `/sdd auth-flow` - 為特定功能建立規格
130
- - `/sdd review` - 審查現有規格
131
- - `/sdd --sync-check` - 檢查同步狀態
190
+ ```
191
+ /sdd - Interactive spec creation wizard | 互動式規格建立精靈
192
+ /sdd auth-flow - Create spec for specific feature | 為特定功能建立規格
193
+ /sdd review - Review existing specs | 審查現有規格
194
+ /sdd --sync-check - Check sync status | 檢查同步狀態
195
+ ```
132
196
 
133
- ## 下一步引導
197
+ ## Next Steps Guidance | 下一步引導
134
198
 
135
199
  `/sdd` 完成後,AI 助手應建議:
136
200
 
137
- > **規格文件已建立。建議下一步:**
138
- > - 執行 `/derive` 從規格推導測試工件
139
- > - 執行 `/derive bdd` 僅推導 BDD 場景
140
- > - 執行 `/derive tdd` 僅推導 TDD 骨架
141
- > - 審查 AC 完整性,確保所有驗收條件可測試
142
- > - 檢查 UDS 規範覆蓋率 → 執行 `/audit --patterns`
201
+ > **規格文件已建立。建議下一步 / Specification document created. Suggested next steps:**
202
+ > - 執行 `/derive` 從規格推導測試工件 ⭐ **Recommended / 推薦** — Derive test artifacts from spec
203
+ > - 執行 `/derive bdd` 僅推導 BDD 場景 — Derive BDD scenarios only
204
+ > - 執行 `/derive tdd` 僅推導 TDD 骨架 — Derive TDD skeletons only
205
+ > - 審查 AC 完整性,確保所有驗收條件可測試 — Review AC completeness
206
+ > - 檢查 UDS 規範覆蓋率 → 執行 `/audit --patterns` — Check UDS standard coverage → Run `/audit --patterns`
143
207
 
144
- ## 參考
208
+ ## Reference | 參考
145
209
 
146
210
  - 詳細指南:[guide.md](./guide.md)
147
- - 核心規範:[spec-driven-development.md](../../../../core/spec-driven-development.md)
211
+ - 核心標準:[spec-driven-development.md](../../core/spec-driven-development.md)
212
+
213
+
214
+ ## AI Agent Behavior | AI 代理行為
215
+
216
+ > 完整的 AI 行為定義請參閱對應的命令文件:[`/sdd`](../commands/sdd.md#ai-agent-behavior--ai-代理行為)
217
+ >
218
+ > For complete AI agent behavior definition, see the corresponding command file: [`/sdd`](../commands/sdd.md#ai-agent-behavior--ai-代理行為)
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: sweep
3
+ source: ../../../../skills/sweep/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: |
9
+ [UDS] 掃描程式庫的除錯殘留與程式碼品質問題;可自動修正安全模式。
10
+ Use when: before committing, during PR review, or periodic codebase cleanup.
11
+ Keywords: sweep, debug cleanup, console.log, debugger, TODO, ts-any, code quality, 掃描, 清理.
12
+ allowed-tools: Read, Grep, Glob, Bash(find:*), Edit, Write
13
+ argument-hint: "[--fix] [--report] [--path <dir>] [--exclude <pattern>]"
14
+ ---
15
+
16
+ # 掃碼助手
17
+
18
+ > **語言**: [English](../../../../skills/sweep/SKILL.md) | 繁體中文
19
+
20
+ 掃描程式庫的除錯殘留、程式碼品質問題與技術債標記。
21
+ 可選擇性自動修正安全模式(console.log、debugger 等語句)。
22
+
23
+ ---
24
+
25
+ ## 掃描模式
26
+
27
+ | Pattern ID | 名稱 | 可自動修正 | 說明 |
28
+ |------------|------|-----------|------|
29
+ | `console-log` | console.log / console.debug / console.trace | ✅ 是 | 留在正式環境的除錯輸出 |
30
+ | `debugger` | debugger 語句 | ✅ 是 | 留在程式碼中的中斷點 |
31
+ | `todo-fixme` | TODO / FIXME / HACK / XXX | ❌ 僅回報 | 技術債標記 |
32
+ | `ts-any` | TypeScript `any` 型別 | ❌ 僅回報 | 型別安全違規 |
33
+
34
+ ---
35
+
36
+ ## 使用方式
37
+
38
+ ```bash
39
+ /sweep # 掃描目前目錄,回報發現
40
+ /sweep --fix # 掃描並自動修正可修復項目
41
+ /sweep --report # 掃描並將報告寫入 .uds/sweep-report.json
42
+ /sweep --path src/ # 掃描指定目錄
43
+ /sweep --exclude "**/*.test.ts" # 排除模式(glob)
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 執行工作流程
49
+
50
+ ### Step 1:搜尋檔案
51
+ 使用 Glob tool 找出目標路徑下所有原始碼檔案。
52
+ 預設排除:`node_modules/`、`dist/`、`.git/`、`*.min.js`、`coverage/`。
53
+
54
+ ### Step 2:逐 Pattern 掃描
55
+ 對每個 pattern 使用 Grep 在所有檔案中尋找比對結果。
56
+ 彙整發現:`{ file, line, column, pattern_id, label, fixable, content }`。
57
+
58
+ ### Step 3:回報發現
59
+ 輸出結構化摘要:
60
+ ```
61
+ 📊 掃描結果
62
+ ─────────────────────────────────────
63
+ console-log: 12 筆 (可自動修正)
64
+ debugger: 2 筆 (可自動修正)
65
+ todo-fixme: 28 筆 (僅回報)
66
+ ts-any: 5 筆 (僅回報)
67
+ ─────────────────────────────────────
68
+ 合計:47 筆 | 可修正:14 筆
69
+ ```
70
+
71
+ ### Step 4:HITL 閘門(--fix 且發現數 > 20)
72
+ 若設定 `--fix` **且**可修正發現總數超過 20:
73
+ **暫停並要求使用者明確確認**才套用修正。
74
+ 顯示將被修改的檔案清單。
75
+
76
+ ### Step 5:套用修正(確認 --fix 後)
77
+ 對每筆可修正發現:
78
+ - `console-log`:若該行僅含 console 語句則刪除該行
79
+ - `debugger`:若該行僅含 debugger 語句則刪除該行
80
+
81
+ 使用 Edit tool 逐檔套用變更。
82
+ 回報:「已修正 N 筆,影響 M 個檔案。」
83
+
84
+ ### Step 6:儲存報告(--report)
85
+ 將發現寫入 `.uds/sweep-report.json`:
86
+ ```json
87
+ {
88
+ "timestamp": "<ISO8601>",
89
+ "total_findings": 47,
90
+ "fixable": 14,
91
+ "fixed": 14,
92
+ "findings_by_pattern": { "console-log": 12, "debugger": 2, "todo-fixme": 28, "ts-any": 5 },
93
+ "files_modified": ["src/auth.ts", "src/utils.ts"]
94
+ }
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 設定
100
+
101
+ 透過 `uds.project.yaml` 設定:
102
+
103
+ ```yaml
104
+ sweep:
105
+ default_path: "src/"
106
+ exclude_patterns:
107
+ - "**/*.test.ts"
108
+ - "**/*.spec.ts"
109
+ - "**/fixtures/**"
110
+ hitl_threshold: 20 # 可修正項目超過此值時需確認
111
+ patterns:
112
+ enabled:
113
+ - console-log
114
+ - debugger
115
+ - todo-fixme
116
+ - ts-any
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 下一步引導
122
+
123
+ `/sweep` 完成後建議:
124
+
125
+ > - 執行 `/checkin` 在提交前驗證整體程式碼品質
126
+ > - 執行 `/review` 審查清理後的變更
127
+ > - 執行 `/commit` 提交修正
128
+
129
+ ---
130
+
131
+ ## 相關標準
132
+
133
+ - [Checkin Standards](../../../../.standards/checkin-standards.ai.yaml) — Pre-commit 品質閘門
134
+ - [Code Review](../code-review-assistant/SKILL.md) — 程式碼審查助手
135
+ - [Testing Guide](../testing-guide/SKILL.md) — 測試標準
136
+
137
+ ---
138
+
139
+ ## 版本歷程
140
+
141
+ | 版本 | 日期 | 變更 |
142
+ |------|------|------|
143
+ | 1.0.0 | 2026-04-28 | 初始版本 — XSPEC-097 Phase 1(從上游遷移) |
144
+
145
+ ---
146
+
147
+ ## 授權
148
+
149
+ 本 Skill 採用 [MIT License](https://opensource.org/licenses/MIT) 與 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 雙重授權發布。