universal-dev-standards 5.15.1 → 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/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +31 -0
- package/bundled/ai/standards/forward-derivation-standards.ai.yaml +23 -0
- package/bundled/ai/standards/knowledge-graph-memory.ai.yaml +1 -1
- package/bundled/core/acceptance-criteria-traceability.md +46 -0
- package/bundled/core/forward-derivation-standards.md +19 -0
- package/bundled/core/knowledge-graph-memory.md +2 -2
- package/bundled/locales/zh-CN/CHANGELOG.md +13 -3
- package/bundled/locales/zh-CN/README.md +1 -1
- package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +46 -0
- 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 +13 -3
- package/bundled/locales/zh-TW/README.md +1 -1
- package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +46 -0
- 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 +2 -2
- package/bundled/locales/zh-TW/core/release-readiness-gate.md +186 -5
- package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +21 -42
- 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/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/knowledge-graph/SKILL.md +5 -5
- 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 +3 -2
- package/bundled/locales/zh-TW/skills/plan/SKILL.md +3 -2
- package/bundled/locales/zh-TW/skills/push/SKILL.md +3 -2
- 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/slo-assistant/guide.md +188 -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/testing-guide/SKILL.md +141 -44
- package/bundled/skills/brainstorm-assistant/SKILL.md +142 -106
- package/bundled/skills/brainstorm-assistant/guide.md +256 -661
- package/bundled/skills/commands/brainstorm.md +51 -30
- package/bundled/skills/knowledge-graph/SKILL.md +5 -5
- package/bundled/skills/knowledge-graph/guide.md +4 -4
- package/package.json +2 -2
- package/src/commands/check.js +11 -2
- package/src/lint/i18n.js +109 -23
- package/standards-registry.json +4 -4
- package/bundled/locales/zh-TW/docs/SKILL-FALLBACK-GUIDE.md +0 -407
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../../skills/spec-derivation/guide.md
|
|
3
|
+
source_version: 1.0.0
|
|
4
|
+
translation_version: 1.0.0
|
|
5
|
+
last_synced: 2026-06-02
|
|
6
|
+
source_hash: 218670e49db0
|
|
7
|
+
status: current
|
|
8
|
+
scope: partial
|
|
9
|
+
description: |
|
|
10
|
+
從已核准的 SDD 規格推演 BDD 場景與 TDD 測試骨架。
|
|
11
|
+
ATDD 驗收測試表格為選用輸出,供特殊需求使用。
|
|
12
|
+
使用時機:規格已核准、開始 BDD/TDD 實作、產生測試結構。
|
|
13
|
+
關鍵字:forward derivation、spec to test、BDD generation、TDD skeleton、test derivation、正向推演、規格轉測試、測試生成。
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# 正向推演指南(Forward Derivation Guide)
|
|
17
|
+
|
|
18
|
+
> **語言**:[English](../../../../skills/spec-derivation/guide.md) | 繁體中文
|
|
19
|
+
|
|
20
|
+
**版本**:2.0.0
|
|
21
|
+
**最後更新**:2026-01-25
|
|
22
|
+
**適用範圍**:Claude Code Skills
|
|
23
|
+
|
|
24
|
+
> **核心標準**:此 skill 實作 [Forward Derivation Standards](../../core/forward-derivation-standards.md)。如需任何 AI 工具皆可存取的完整方法論文件,請參閱該核心標準。
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 目的
|
|
29
|
+
|
|
30
|
+
此 skill 引導你從已核准的 SDD 規格推演 BDD 場景與 TDD 測試骨架,並嚴格遵循反幻覺(Anti-Hallucination)標準。
|
|
31
|
+
|
|
32
|
+
> **注意**:ATDD 測試表格為選用,可透過 `/derive-atdd` 取得。BDD 場景本身即可作為可執行的驗收測試,因此在多數情境下 ATDD 表格屬於冗餘。
|
|
33
|
+
|
|
34
|
+
正向推演(Forward Derivation)是 [逆向工程(Reverse Engineering)](../reverse-engineer/SKILL.md) 的對稱對應:
|
|
35
|
+
- **逆向工程(Reverse Engineering)**:程式碼 → 規格
|
|
36
|
+
- **正向推演(Forward Derivation)**:規格 → 測試
|
|
37
|
+
|
|
38
|
+
## 快速參考
|
|
39
|
+
|
|
40
|
+
### 正向推演工作流程
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
44
|
+
│ Forward Derivation Workflow │
|
|
45
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
46
|
+
│ │
|
|
47
|
+
│ 1️⃣ SPEC Parsing (AI Automated) │
|
|
48
|
+
│ ├─ Read approved specification │
|
|
49
|
+
│ ├─ Extract Acceptance Criteria (GWT or bullet) │
|
|
50
|
+
│ └─ Validate SPEC structure and completeness │
|
|
51
|
+
│ │
|
|
52
|
+
│ 2️⃣ Derivation (AI Automated) │
|
|
53
|
+
│ ├─ AC → BDD Gherkin scenarios │
|
|
54
|
+
│ ├─ AC → TDD test skeletons with TODOs │
|
|
55
|
+
│ └─ (Optional) AC → ATDD acceptance test tables │
|
|
56
|
+
│ │
|
|
57
|
+
│ 3️⃣ Human Review (Required) │
|
|
58
|
+
│ ├─ Verify generated scenarios match AC intent │
|
|
59
|
+
│ ├─ Fill in [TODO] sections │
|
|
60
|
+
│ └─ Refine step definitions if needed │
|
|
61
|
+
│ │
|
|
62
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 指令總覽
|
|
66
|
+
|
|
67
|
+
| 指令 | 輸入 | 輸出 | 目的 |
|
|
68
|
+
|---------|-------|--------|---------|
|
|
69
|
+
| `/derive-bdd` | SPEC-XXX.md | .feature | AC → Gherkin 場景 |
|
|
70
|
+
| `/derive-tdd` | SPEC-XXX.md | .test.ts | AC → 測試骨架 |
|
|
71
|
+
| `/derive-all` | SPEC-XXX.md | .feature + .test.ts | 完整推演管線 |
|
|
72
|
+
| `/derive-atdd` | SPEC-XXX.md | acceptance.md | AC → 驗收測試表格(選用) |
|
|
73
|
+
|
|
74
|
+
## 核心原則
|
|
75
|
+
|
|
76
|
+
### 1. 受規格約束的生成(Spec-Bounded Generation)
|
|
77
|
+
|
|
78
|
+
**至關重要**:只推演規格中存在的內容。絕不新增超出 Acceptance Criteria 明確定義範圍的場景、測試或功能。
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
# Anti-Hallucination Rule
|
|
82
|
+
Input: SPEC with N Acceptance Criteria
|
|
83
|
+
Output: Exactly N scenarios (BDD)
|
|
84
|
+
Exactly N test groups (TDD)
|
|
85
|
+
Exactly N acceptance tests (ATDD, if requested)
|
|
86
|
+
|
|
87
|
+
If output count ≠ input count → VIOLATION
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 2. 來源歸屬(Source Attribution)
|
|
91
|
+
|
|
92
|
+
每個生成的項目都「必須」包含 traceability:
|
|
93
|
+
|
|
94
|
+
```gherkin
|
|
95
|
+
# Generated from: specs/SPEC-001.md
|
|
96
|
+
# AC: AC-1
|
|
97
|
+
|
|
98
|
+
@SPEC-001 @AC-1
|
|
99
|
+
Scenario: User login with valid credentials
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 3. 推演標籤(Derivation Tags,來自統一標籤系統)
|
|
103
|
+
|
|
104
|
+
此 skill 使用 **推演標籤(Derivation Tags)** 從規格生成新內容。完整的標籤參考請見 [Anti-Hallucination Standards](../../core/anti-hallucination.md#certainty-classification-tags)。
|
|
105
|
+
|
|
106
|
+
| 標籤 | 使用時機 | 範例 |
|
|
107
|
+
|-----|----------|---------|
|
|
108
|
+
| `[Source]` | 直接取自 SPEC 的內容 | 功能標題、AC 文字 |
|
|
109
|
+
| `[Derived]` | 從 SPEC 內容轉換而來 | 由 bullet AC 轉成 GWT |
|
|
110
|
+
| `[Generated]` | AI 生成的結構 | 測試骨架 |
|
|
111
|
+
| `[TODO]` | 需要人工實作 | 斷言、step definition |
|
|
112
|
+
|
|
113
|
+
## 工作流程階段
|
|
114
|
+
|
|
115
|
+
### 階段 1:SPEC 解析
|
|
116
|
+
|
|
117
|
+
**輸入**:已核准的規格檔案
|
|
118
|
+
**輸出**:結構化的 Acceptance Criteria 清單
|
|
119
|
+
|
|
120
|
+
**動作**:
|
|
121
|
+
1. 讀取規格檔案
|
|
122
|
+
2. 辨識 Acceptance Criteria 區段
|
|
123
|
+
3. 解析 AC 格式(Given-When-Then 或 Bullet)
|
|
124
|
+
4. 驗證 AC 完整性
|
|
125
|
+
|
|
126
|
+
**驗證檢查清單**:
|
|
127
|
+
- [ ] SPEC 狀態為「Approved」或「Ready」
|
|
128
|
+
- [ ] Acceptance Criteria 區段存在
|
|
129
|
+
- [ ] 每個 AC 都有唯一識別碼(AC-1、AC-2 等)
|
|
130
|
+
- [ ] AC 格式可解析(GWT 或 bullet)
|
|
131
|
+
|
|
132
|
+
### 階段 2:BDD 推演
|
|
133
|
+
|
|
134
|
+
**輸入**:已解析的 Acceptance Criteria
|
|
135
|
+
**輸出**:Gherkin .feature 檔案
|
|
136
|
+
|
|
137
|
+
**轉換規則**:
|
|
138
|
+
|
|
139
|
+
| AC 格式 | 轉換方式 |
|
|
140
|
+
|-----------|----------------|
|
|
141
|
+
| Given-When-Then | 直接對應到 Gherkin |
|
|
142
|
+
| Bullet points | 使用 GWT 模式比對轉換 |
|
|
143
|
+
| Checklist | 條件 → Given、動作 → When、結果 → Then |
|
|
144
|
+
|
|
145
|
+
**範例**:
|
|
146
|
+
```markdown
|
|
147
|
+
# Input AC (Bullet)
|
|
148
|
+
- [ ] User can login with email and password
|
|
149
|
+
- [ ] Login shows error for invalid credentials
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```gherkin
|
|
153
|
+
# Output BDD
|
|
154
|
+
@SPEC-001 @AC-1
|
|
155
|
+
Scenario: User login with email and password
|
|
156
|
+
Given a user with valid credentials
|
|
157
|
+
When the user submits login form
|
|
158
|
+
Then the user is logged in successfully
|
|
159
|
+
|
|
160
|
+
@SPEC-001 @AC-2
|
|
161
|
+
Scenario: Login shows error for invalid credentials
|
|
162
|
+
Given a user with invalid credentials
|
|
163
|
+
When the user submits login form
|
|
164
|
+
Then an error message is displayed
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 階段 3:TDD 推演
|
|
168
|
+
|
|
169
|
+
**輸入**:已解析的 Acceptance Criteria
|
|
170
|
+
**輸出**:測試骨架檔案
|
|
171
|
+
|
|
172
|
+
**動作**:
|
|
173
|
+
1. 為 SPEC 建立 describe 區塊
|
|
174
|
+
2. 為每個 AC 建立 describe 區塊
|
|
175
|
+
3. 以具描述性的名稱產生 it 區塊
|
|
176
|
+
4. 加入帶有 TODO 註解的 AAA 結構
|
|
177
|
+
5. 包含占位用的斷言(placeholder assertions)
|
|
178
|
+
|
|
179
|
+
**參數**:
|
|
180
|
+
| 參數 | 選項 | 預設 |
|
|
181
|
+
|-----------|---------|---------|
|
|
182
|
+
| `--lang` | typescript、javascript、python、java、go | typescript |
|
|
183
|
+
| `--framework` | vitest、jest、pytest、junit、go-test | vitest |
|
|
184
|
+
|
|
185
|
+
### 階段 4:ATDD 推演(選用)
|
|
186
|
+
|
|
187
|
+
> **注意**:ATDD 測試表格為選用。BDD 場景本身即可作為可執行的驗收測試。僅在以下情況使用 ATDD 表格:
|
|
188
|
+
> - 需要人工測試流程
|
|
189
|
+
> - 利害關係人偏好表格式的測試文件
|
|
190
|
+
> - 法規遵循要求特定的測試證據格式
|
|
191
|
+
|
|
192
|
+
**輸入**:已解析的 Acceptance Criteria
|
|
193
|
+
**輸出**:驗收測試表格文件
|
|
194
|
+
|
|
195
|
+
**動作**:
|
|
196
|
+
1. 為每個 AC 建立測試表格
|
|
197
|
+
2. 產生逐步動作欄位
|
|
198
|
+
3. 加入預期結果欄位
|
|
199
|
+
4. 包含 Pass/Fail 勾選框
|
|
200
|
+
5. 加入測試員簽核區段
|
|
201
|
+
|
|
202
|
+
### 階段 5:人工審查
|
|
203
|
+
|
|
204
|
+
**輸入**:生成的檔案
|
|
205
|
+
**輸出**:經審查與精修的檔案
|
|
206
|
+
|
|
207
|
+
**審查檢查清單**:
|
|
208
|
+
- [ ] 生成的場景符合 AC 意圖
|
|
209
|
+
- [ ] 沒有超出 AC 數量的多餘場景
|
|
210
|
+
- [ ] 來源歸屬正確
|
|
211
|
+
- [ ] 已標出 [TODO] 區段供實作
|
|
212
|
+
- [ ] step 語言為業務層級(非技術性)
|
|
213
|
+
|
|
214
|
+
## 輸出格式
|
|
215
|
+
|
|
216
|
+
### BDD Feature 檔案
|
|
217
|
+
|
|
218
|
+
```gherkin
|
|
219
|
+
# Generated from: specs/SPEC-001.md
|
|
220
|
+
# Generator: /derive-bdd v1.0.0
|
|
221
|
+
# Generated at: 2026-01-19T10:00:00Z
|
|
222
|
+
|
|
223
|
+
@SPEC-001
|
|
224
|
+
Feature: User Authentication
|
|
225
|
+
[Source] From SPEC-001 Summary
|
|
226
|
+
|
|
227
|
+
@AC-1 @happy-path
|
|
228
|
+
Scenario: User login with valid credentials
|
|
229
|
+
# [Source] From SPEC-001 AC-1
|
|
230
|
+
Given a registered user with valid credentials
|
|
231
|
+
When the user submits login form
|
|
232
|
+
Then the user is redirected to dashboard
|
|
233
|
+
|
|
234
|
+
@AC-2 @error-handling
|
|
235
|
+
Scenario: Login fails with invalid credentials
|
|
236
|
+
# [Source] From SPEC-001 AC-2
|
|
237
|
+
Given a user with invalid credentials
|
|
238
|
+
When the user submits login form
|
|
239
|
+
Then an error message is displayed
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### TDD 測試骨架
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
/**
|
|
246
|
+
* Tests for SPEC-001: User Authentication
|
|
247
|
+
* Generated from: specs/SPEC-001.md
|
|
248
|
+
* Generated at: 2026-01-19T10:00:00Z
|
|
249
|
+
* AC Coverage: AC-1, AC-2
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
describe('SPEC-001: User Authentication', () => {
|
|
253
|
+
describe('AC-1: User login with valid credentials', () => {
|
|
254
|
+
it('should redirect to dashboard on successful login', async () => {
|
|
255
|
+
// Arrange
|
|
256
|
+
// [TODO] Set up registered user with valid credentials
|
|
257
|
+
|
|
258
|
+
// Act
|
|
259
|
+
// [TODO] Submit login form
|
|
260
|
+
|
|
261
|
+
// Assert
|
|
262
|
+
// [TODO] Verify redirect to dashboard
|
|
263
|
+
expect(true).toBe(true); // Placeholder
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
describe('AC-2: Login fails with invalid credentials', () => {
|
|
268
|
+
it('should display error message', async () => {
|
|
269
|
+
// Arrange
|
|
270
|
+
// [TODO] Set up user with invalid credentials
|
|
271
|
+
|
|
272
|
+
// Act
|
|
273
|
+
// [TODO] Submit login form
|
|
274
|
+
|
|
275
|
+
// Assert
|
|
276
|
+
// [TODO] Verify error message is displayed
|
|
277
|
+
expect(true).toBe(true); // Placeholder
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### ATDD 驗收測試表格(選用)
|
|
284
|
+
|
|
285
|
+
> 當需要 ATDD 測試表格時,透過 `/derive-atdd` 生成。
|
|
286
|
+
|
|
287
|
+
```markdown
|
|
288
|
+
# SPEC-001 Acceptance Tests
|
|
289
|
+
|
|
290
|
+
**Specification**: SPEC-001
|
|
291
|
+
**Generated**: 2026-01-19
|
|
292
|
+
**Status**: Pending
|
|
293
|
+
|
|
294
|
+
## AT-001: User login with valid credentials
|
|
295
|
+
**Source**: AC-1
|
|
296
|
+
|
|
297
|
+
| Step | Action | Expected | Pass/Fail |
|
|
298
|
+
|------|--------|----------|-----------|
|
|
299
|
+
| 1 | Navigate to login page | Login form displayed | [ ] |
|
|
300
|
+
| 2 | Enter valid credentials | Fields accept input | [ ] |
|
|
301
|
+
| 3 | Click Login | Form submitted | [ ] |
|
|
302
|
+
| 4 | Verify redirect | Dashboard displayed | [ ] |
|
|
303
|
+
|
|
304
|
+
**Tester**: _______________
|
|
305
|
+
**Date**: _______________
|
|
306
|
+
**Result**: [ ] Pass / [ ] Fail
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## 與其他 Skill 的整合
|
|
310
|
+
|
|
311
|
+
### 與 /sdd(Spec-Driven Development)
|
|
312
|
+
|
|
313
|
+
1. 使用 `/sdd` 工作流程完成 SPEC
|
|
314
|
+
2. 透過審查取得 SPEC 核准
|
|
315
|
+
3. 執行 `/derive-all` 產生測試結構
|
|
316
|
+
4. 在 BDD/TDD 工作流程中使用生成的輸出
|
|
317
|
+
|
|
318
|
+
### 與 /bdd(Behavior-Driven Development)
|
|
319
|
+
|
|
320
|
+
1. 使用 `/derive-bdd` 產生 BDD 場景
|
|
321
|
+
2. 與利害關係人審查並精修場景
|
|
322
|
+
3. 使用 `/bdd` 繼續進行 BDD 構思
|
|
323
|
+
4. 實作 step definition
|
|
324
|
+
|
|
325
|
+
### 與 /tdd(Test-Driven Development)
|
|
326
|
+
|
|
327
|
+
1. 使用 `/derive-tdd` 產生 TDD 骨架
|
|
328
|
+
2. 在 [TODO] 區段填入實際的斷言
|
|
329
|
+
3. 以生成的測試結構進入 TDD Red 階段
|
|
330
|
+
4. 實作程式碼以讓測試通過
|
|
331
|
+
|
|
332
|
+
### 與整合式流程(Integrated Flow)
|
|
333
|
+
|
|
334
|
+
正向推演融入整合式流程(Integrated Flow)方法論:
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
spec-review (approved) → forward-derivation → discovery (BDD)
|
|
338
|
+
│
|
|
339
|
+
├─→ .feature files for BDD
|
|
340
|
+
└─→ .test.ts skeletons for TDD
|
|
341
|
+
|
|
342
|
+
Optional: /derive-atdd → acceptance.md for manual testing
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## 完整推演管線
|
|
346
|
+
|
|
347
|
+
```
|
|
348
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
349
|
+
│ Complete Forward Derivation Pipeline │
|
|
350
|
+
├─────────────────────────────────────────────────────────────────────────┤
|
|
351
|
+
│ │
|
|
352
|
+
│ Approved SPEC │
|
|
353
|
+
│ │ │
|
|
354
|
+
│ ▼ │
|
|
355
|
+
│ /derive-all specs/SPEC-XXX.md │
|
|
356
|
+
│ │ │
|
|
357
|
+
│ ├─→ /derive-bdd │
|
|
358
|
+
│ │ └─→ features/SPEC-XXX.feature │
|
|
359
|
+
│ │ │
|
|
360
|
+
│ └─→ /derive-tdd │
|
|
361
|
+
│ └─→ tests/SPEC-XXX.test.ts │
|
|
362
|
+
│ │
|
|
363
|
+
│ Optional: /derive-atdd specs/SPEC-XXX.md │
|
|
364
|
+
│ └─→ acceptance/SPEC-XXX-acceptance.md │
|
|
365
|
+
│ │
|
|
366
|
+
│ Human Review │
|
|
367
|
+
│ │ │
|
|
368
|
+
│ ├─→ Verify 1:1 AC mapping │
|
|
369
|
+
│ ├─→ Fill [TODO] sections │
|
|
370
|
+
│ └─→ Refine step definitions │
|
|
371
|
+
│ │
|
|
372
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### 使用範例
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
# Generate BDD scenarios
|
|
379
|
+
/derive-bdd specs/SPEC-001.md
|
|
380
|
+
|
|
381
|
+
# Generate TDD skeleton with Python/pytest
|
|
382
|
+
/derive-tdd specs/SPEC-001.md --lang python --framework pytest
|
|
383
|
+
|
|
384
|
+
# Generate all test structures
|
|
385
|
+
/derive-all specs/SPEC-001.md
|
|
386
|
+
|
|
387
|
+
# Preview without creating files
|
|
388
|
+
/derive-all specs/SPEC-001.md --dry-run
|
|
389
|
+
|
|
390
|
+
# Specify output directory
|
|
391
|
+
/derive-all specs/SPEC-001.md --output-dir ./generated
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## 應避免的反模式(Anti-Patterns)
|
|
395
|
+
|
|
396
|
+
### ❌ 不要這樣做
|
|
397
|
+
|
|
398
|
+
1. **新增多餘場景**
|
|
399
|
+
- 錯誤:SPEC 有 3 個 AC,卻生成 5 個場景
|
|
400
|
+
- 正確:SPEC 有 3 個 AC,恰好生成 3 個場景
|
|
401
|
+
|
|
402
|
+
2. **從草稿 SPEC 推演**
|
|
403
|
+
- 錯誤:對未核准的規格執行 `/derive-all`
|
|
404
|
+
- 正確:只從已核准的規格推演
|
|
405
|
+
|
|
406
|
+
3. **略過來源歸屬**
|
|
407
|
+
- 錯誤:場景沒有 @SPEC-XXX 標籤
|
|
408
|
+
- 正確:每個場景都標上來源 SPEC 與 AC
|
|
409
|
+
|
|
410
|
+
4. **過度指定技術細節**
|
|
411
|
+
- 錯誤:`Given database connection is established using PostgreSQL driver`
|
|
412
|
+
- 正確:`Given user data exists in the system`
|
|
413
|
+
|
|
414
|
+
5. **把骨架當成已完成**
|
|
415
|
+
- 錯誤:未填入 [TODO] 就使用生成的測試
|
|
416
|
+
- 正確:執行測試前先填完所有 [TODO] 區段
|
|
417
|
+
|
|
418
|
+
## 最佳實踐
|
|
419
|
+
|
|
420
|
+
### 該做的(Do's)
|
|
421
|
+
|
|
422
|
+
- ✅ 只從已核准的規格推演
|
|
423
|
+
- ✅ 維持嚴格的 1:1 AC 對輸出對應
|
|
424
|
+
- ✅ 在所有輸出中包含來源歸屬
|
|
425
|
+
- ✅ 以 [TODO] 標記實作區段
|
|
426
|
+
- ✅ 與利害關係人審查生成的輸出
|
|
427
|
+
- ✅ 讓 step 語言保持在業務層級
|
|
428
|
+
|
|
429
|
+
### 不該做的(Don'ts)
|
|
430
|
+
|
|
431
|
+
- ❌ 新增超出 AC 定義範圍的場景
|
|
432
|
+
- ❌ 從草稿或未核准的規格推演
|
|
433
|
+
- ❌ 略過對生成輸出的人工審查
|
|
434
|
+
- ❌ 把生成的骨架當成完整的測試
|
|
435
|
+
- ❌ 移除來源歸屬註解
|
|
436
|
+
- ❌ 過度指定實作細節
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## 配置偵測
|
|
441
|
+
|
|
442
|
+
此 skill 會自動偵測專案配置:
|
|
443
|
+
|
|
444
|
+
1. 檢查既有的 `specs/` 目錄結構
|
|
445
|
+
2. 從 package.json/pyproject.toml 偵測測試框架
|
|
446
|
+
3. 辨識偏好的輸出目錄
|
|
447
|
+
4. 配置語言專屬的範本
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## 相關標準
|
|
452
|
+
|
|
453
|
+
- [Forward Derivation Standards](../../core/forward-derivation-standards.md) - **核心方法論標準(主要參考)**
|
|
454
|
+
- [Reverse Engineering Standards](../../core/reverse-engineering-standards.md) - 對稱對應
|
|
455
|
+
- [Spec-Driven Development](../../core/spec-driven-development.md) - 輸入規格格式
|
|
456
|
+
- [Behavior-Driven Development](../../core/behavior-driven-development.md) - BDD 輸出格式
|
|
457
|
+
- [Test-Driven Development](../../core/test-driven-development.md) - TDD 輸出用途
|
|
458
|
+
- [Anti-Hallucination Guidelines](../../core/anti-hallucination.md) - 生成合規性
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## 版本歷史
|
|
463
|
+
|
|
464
|
+
| 版本 | 日期 | 變更 |
|
|
465
|
+
|---------|------|---------|
|
|
466
|
+
| 2.0.0 | 2026-01-25 | ATDD 從必要輸出改為選用輸出;/derive-all 現在只輸出 BDD + TDD |
|
|
467
|
+
| 1.1.0 | 2026-01-25 | 新增:對統一標籤系統的參考 |
|
|
468
|
+
| 1.0.0 | 2026-01-19 | 初始發布 |
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## 授權
|
|
473
|
+
|
|
474
|
+
此 skill 以 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 釋出。
|
|
475
|
+
|
|
476
|
+
**來源**:[universal-dev-standards](https://github.com/AsiaOstrich/universal-dev-standards)
|