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
|
+
# 正向推演指南
|
|
17
|
+
|
|
18
|
+
> **语言**:English | [繁體中文](../../locales/zh-TW/skills/forward-derivation/SKILL.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-engineer/SKILL.md) 的对称对应物:
|
|
35
|
+
- **逆向工程**:代码 → 规格
|
|
36
|
+
- **正向推演**:规格 → 测试
|
|
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. 受规格约束的生成
|
|
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. 来源标注
|
|
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. 推演标签(来自统一标签系统)
|
|
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 内容转换而来 | 从条目式 AC 转出的 GWT |
|
|
110
|
+
| `[Generated]` | AI 生成的结构 | 测试骨架 |
|
|
111
|
+
| `[TODO]` | 需要人工实现 | 断言、step 定义 |
|
|
112
|
+
|
|
113
|
+
## 工作流程阶段
|
|
114
|
+
|
|
115
|
+
### 阶段 1:SPEC 解析
|
|
116
|
+
|
|
117
|
+
**输入**:已批准的规格文件
|
|
118
|
+
**输出**:结构化的验收条件列表
|
|
119
|
+
|
|
120
|
+
**操作**:
|
|
121
|
+
1. 读取规格文件
|
|
122
|
+
2. 识别验收条件章节
|
|
123
|
+
3. 解析 AC 格式(Given-When-Then 或条目式)
|
|
124
|
+
4. 验证 AC 完整性
|
|
125
|
+
|
|
126
|
+
**验证清单**:
|
|
127
|
+
- [ ] SPEC 状态为「Approved」或「Ready」
|
|
128
|
+
- [ ] 存在验收条件章节
|
|
129
|
+
- [ ] 每个 AC 都有唯一标识符(AC-1、AC-2 等)
|
|
130
|
+
- [ ] AC 格式可解析(GWT 或条目式)
|
|
131
|
+
|
|
132
|
+
### 阶段 2:BDD 推演
|
|
133
|
+
|
|
134
|
+
**输入**:已解析的验收条件
|
|
135
|
+
**输出**:Gherkin .feature 文件
|
|
136
|
+
|
|
137
|
+
**转换规则**:
|
|
138
|
+
|
|
139
|
+
| AC 格式 | 转换方式 |
|
|
140
|
+
|-----------|----------------|
|
|
141
|
+
| Given-When-Then | 直接映射为 Gherkin |
|
|
142
|
+
| 条目式 | 使用 GWT 模式匹配进行转换 |
|
|
143
|
+
| 清单式 | 将条件 → 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
|
+
**输入**:已解析的验收条件
|
|
170
|
+
**输出**:测试骨架文件
|
|
171
|
+
|
|
172
|
+
**操作**:
|
|
173
|
+
1. 为 SPEC 创建 describe 块
|
|
174
|
+
2. 为每个 AC 创建 describe 块
|
|
175
|
+
3. 生成带有描述性名称的 it 块
|
|
176
|
+
4. 添加带 TODO 注释的 AAA 结构
|
|
177
|
+
5. 包含占位断言
|
|
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
|
+
**输入**:已解析的验收条件
|
|
193
|
+
**输出**:验收测试表文档
|
|
194
|
+
|
|
195
|
+
**操作**:
|
|
196
|
+
1. 为每个 AC 创建测试表
|
|
197
|
+
2. 生成逐步操作列
|
|
198
|
+
3. 添加预期结果列
|
|
199
|
+
4. 包含通过/失败复选框
|
|
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(规格驱动开发)
|
|
312
|
+
|
|
313
|
+
1. 使用 `/sdd` 工作流程完成 SPEC
|
|
314
|
+
2. 经审查使 SPEC 获批准
|
|
315
|
+
3. 运行 `/derive-all` 生成测试结构
|
|
316
|
+
4. 在 BDD/TDD 工作流程中使用生成的输出
|
|
317
|
+
|
|
318
|
+
### 与 /bdd(行为驱动开发)
|
|
319
|
+
|
|
320
|
+
1. 使用 `/derive-bdd` 生成 BDD 场景
|
|
321
|
+
2. 与利益相关者一起审查并优化场景
|
|
322
|
+
3. 使用 `/bdd` 继续进行 BDD 表述
|
|
323
|
+
4. 实现 step 定义
|
|
324
|
+
|
|
325
|
+
### 与 /tdd(测试驱动开发)
|
|
326
|
+
|
|
327
|
+
1. 使用 `/derive-tdd` 生成 TDD 骨架
|
|
328
|
+
2. 用实际断言填充 [TODO] 章节
|
|
329
|
+
3. 以生成的测试结构进入 TDD 红灯阶段
|
|
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
|
+
## 应避免的反模式
|
|
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
|
+
### 应该做的
|
|
421
|
+
|
|
422
|
+
- ✅ 只从已批准的规格推演
|
|
423
|
+
- ✅ 保持严格的 AC 与输出 1:1 映射
|
|
424
|
+
- ✅ 在所有输出中包含来源标注
|
|
425
|
+
- ✅ 为实现章节使用 [TODO] 标记
|
|
426
|
+
- ✅ 与利益相关者一起审查生成的输出
|
|
427
|
+
- ✅ 将 step 语言保持在业务层级
|
|
428
|
+
|
|
429
|
+
### 不应该做的
|
|
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)
|