speccrew 0.5.1 → 0.5.2

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.
@@ -26,22 +26,18 @@ Phase 2: Knowledge Loading
26
26
  └── Read PRDs → Discover platforms → Extract Features
27
27
  └── Write .checkpoints.json → HARD STOP (user confirms Feature Registry)
28
28
 
29
- Phase 3: Feature Design — Three-Stage Pipeline
29
+ Phase 3: Feature Design — Two-Stage Pipeline
30
30
  └── 3a: Analyze (fd-feature-analyze)
31
31
  │ └── 1 Feature? → Direct skill invocation
32
32
  │ └── 2+ Features? → Batch dispatch workers (6/batch)
33
33
  │ └── Output: .feature-analysis.md per Feature
34
- └── 3b: Design (fd-feature-design)
35
- │ └── 1 Feature? → Direct skill invocation
36
- │ └── 2+ Features? → Batch dispatch workers (6/batch)
37
- │ └── Output: .feature-design-data.md per Feature
34
+ └── 3b: Design & Generate (fd-feature-design)
35
+ │ └── 1 Feature? → Direct skill invocation (with Checkpoint B)
36
+ │ └── 2+ Features? → Batch dispatch workers (6/batch, skip_checkpoint=true)
37
+ │ └── Output: {feature-id}-{feature-name}-feature-spec.md per Feature
38
38
  └── 3c: Confirm (HARD STOP for multi-Feature)
39
- └── 1 Feature? → Checkpoint B handled inside generate skill
40
- └── 2+ Features? → Agent presents batch summary → HARD STOP
41
- └── 3d: Generate (fd-feature-generate)
42
- └── 1 Feature? → Direct skill invocation (with Checkpoint B)
43
- └── 2+ Features? → Batch dispatch workers (skip_checkpoint=true)
44
- └── Output: {feature-id}-{feature-name}-feature-spec.md
39
+ └── 1 Feature? → Checkpoint B handled inside design skill
40
+ └── 2+ Features? → Agent presents batch summary → HARD STOP
45
41
 
46
42
  Phase 4: API Contract Generation
47
43
  └── Dispatch API Contract workers (same batch pattern)
@@ -57,9 +53,8 @@ Phase 4: API Contract Generation
57
53
  | Phase 0 | STAGE GATE | PRD must be confirmed before starting. If not → STOP |
58
54
  | Phase 2 | HARD STOP | Feature Registry must be confirmed by user before Phase 3 |
59
55
  | Phase 3a | SKILL-ONLY | Analyze workers MUST use speccrew-fd-feature-analyze skill. Agent MUST NOT perform function decomposition itself |
60
- | Phase 3b | SKILL-ONLY | Design workers MUST use speccrew-fd-feature-design skill. Agent MUST NOT design features itself |
61
- | Phase 3c | HARD STOP (multi) | For 2+ Features: Agent MUST present batch summary and wait for user confirmation before generating |
62
- | Phase 3d | SKILL-ONLY | Generate workers MUST use speccrew-fd-feature-generate skill. Agent MUST NOT write Feature Spec documents itself |
56
+ | Phase 3b | SKILL-ONLY | Design & Generate workers MUST use speccrew-fd-feature-design skill. Agent MUST NOT design features or write Feature Spec documents itself |
57
+ | Phase 3c | HARD STOP (multi) | For 2+ Features: Agent MUST present batch summary and wait for user confirmation after Feature Specs are generated |
63
58
  | Phase 4 | SKILL-ONLY | API Contract workers MUST use speccrew-fd-api-contract skill |
64
59
  | Phase 4 | HARD STOP | Joint Confirmation must be confirmed by user before finalizing |
65
60
  | ALL | ABORT ON FAILURE | If any skill invocation fails → STOP and report. Do NOT attempt to generate content manually as fallback |
@@ -71,7 +66,7 @@ Phase 4: API Contract Generation
71
66
 
72
67
  1. **Skill Invocation Failure**: Any skill call returns error → STOP. Do NOT generate content manually.
73
68
  2. **Script Execution Failure**: `node ... update-progress.js` fails → STOP. Do NOT manually create/edit JSON files.
74
- 3. **Missing Intermediate Artifacts**: `.feature-analysis.md` missing before Phase 3b, or `.feature-design-data.md` missing before Phase 3d → STOP.
69
+ 3. **Missing Intermediate Artifacts**: `.feature-analysis.md` missing before Phase 3b → STOP.
75
70
  4. **User Rejection**: User rejects Feature Registry, batch design summary, or Joint Confirmation → STOP, ask for specific revision requirements.
76
71
  5. **Worker Batch Failure**: If >50% workers in a batch fail → STOP entire batch, report to user.
77
72
 
@@ -324,15 +319,15 @@ When involving related business domains, read `speccrew-workspace/knowledges/biz
324
319
  - Technical architecture documents (handled by speccrew-system-designer)
325
320
  - Code conventions (handled by speccrew-system-designer/speccrew-dev)
326
321
 
327
- ## Phase 3: Feature Design — Three-Stage Pipeline
322
+ ## Phase 3: Feature Design — Two-Stage Pipeline
328
323
 
329
324
  > ⚠️ **MANDATORY RULES FOR PHASE 3:**
330
325
  > 1. **DO NOT ask user which strategy to use** — the strategy is determined by Phase 2 extraction results.
331
326
  > 2. **DO NOT invoke skills directly** when there are multiple Features. You MUST dispatch `speccrew-task-worker` agents.
332
327
  > 3. **Dispatch granularity is PER FEATURE, not per module.** Each Feature gets its own worker per phase.
333
328
  > 4. **DO NOT generate Feature Spec documents yourself.** Your role is to DISPATCH workers.
334
- > 5. **Phase 3a → 3b → 3c → 3d is STRICTLY SERIAL.** Each phase must complete before the next begins.
335
- > 6. **Intermediate artifacts are MANDATORY.** .feature-analysis.md must exist before Phase 3b. .feature-design-data.md must exist before Phase 3d.
329
+ > 5. **Phase 3a → 3b → 3c is STRICTLY SERIAL.** Each phase must complete before the next begins.
330
+ > 6. **Intermediate artifacts are MANDATORY.** .feature-analysis.md must exist before Phase 3b.
336
331
 
337
332
  ---
338
333
 
@@ -388,9 +383,9 @@ If **2+ Features** in registry:
388
383
 
389
384
  ---
390
385
 
391
- ### Phase 3b: Design — Feature Specification
386
+ ### Phase 3b: Design & Generate — Feature Spec Production
392
387
 
393
- **Purpose**: Transform function decomposition into complete feature specifications.
388
+ **Purpose**: Transform function decomposition into complete Feature Spec documents in a single pass (design + document generation).
394
389
 
395
390
  **Prerequisite**: All Phase 3a outputs exist (`.feature-analysis.md` for each Feature)
396
391
 
@@ -398,6 +393,8 @@ If **2+ Features** in registry:
398
393
 
399
394
  #### Single Feature (Direct Invocation)
400
395
 
396
+ If only **1 Feature** in registry:
397
+
401
398
  - Skill path: `speccrew-fd-feature-design/SKILL.md`
402
399
  - Parameters:
403
400
  - `feature_analysis_path`: Path to `.feature-analysis.md` from Phase 3a
@@ -406,12 +403,14 @@ If **2+ Features** in registry:
406
403
  - `feature_name`: Feature name
407
404
  - `feature_type`: `Page+API` or `API-only`
408
405
  - `frontend_platforms`: Platform list
406
+ - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md`
407
+ - Checkpoint B handled inside skill (user confirmation before writing)
409
408
 
410
409
  #### Multiple Features (Worker Dispatch)
411
410
 
412
411
  1. **Update DISPATCH-PROGRESS.json**:
413
412
  ```bash
414
- node speccrew-workspace/scripts/update-progress.js update-stage --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_design
413
+ node speccrew-workspace/scripts/update-progress.js update-stage --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_spec
415
414
  ```
416
415
 
417
416
  2. **Dispatch Workers** (batch of 6):
@@ -424,22 +423,27 @@ If **2+ Features** in registry:
424
423
  - `feature_name`: Feature name
425
424
  - `feature_type`: `Page+API` or `API-only`
426
425
  - `frontend_platforms`: Platform list
426
+ - `output_path`: Path for final spec
427
+ - `skip_checkpoint`: `true` (batch mode — Checkpoint B deferred to Phase 3c)
428
+
429
+ 3. **Wait for batch completion**, update progress per worker
427
430
 
428
- 3. **Wait for batch completion**, update progress
431
+ 4. **Update `.checkpoints.json`** for each completed Feature:
432
+ - Set `feature_spec_status` = `completed`
429
433
 
430
- **Output**: One `.feature-design-data.md` per Feature
434
+ **Output**: One `{feature-id}-{feature-name}-feature-spec.md` per Feature
431
435
 
432
436
  ---
433
437
 
434
- ### Phase 3c: Confirm — Batch Design Review (Multi-Feature Only)
438
+ ### Phase 3c: Confirm — Batch Spec Review (Multi-Feature Only)
435
439
 
436
440
  **Condition**: Execute ONLY when 2+ Features exist
437
441
 
438
- **Purpose**: Present batch design summary and obtain user confirmation before final generation.
442
+ **Purpose**: Present batch Feature Spec summary and obtain user confirmation before proceeding to API Contract generation.
439
443
 
440
- 1. **Read all `.feature-design-data.md` files**
444
+ 1. **Read all `feature-spec.md` files** generated in Phase 3b
441
445
 
442
- 2. **Build Batch Design Summary**:
446
+ 2. **Build Batch Spec Summary**:
443
447
 
444
448
  | Feature ID | Feature Name | Functions | Frontend Components | APIs | Data Entities |
445
449
  |------------|--------------|-----------|---------------------|------|---------------|
@@ -449,7 +453,7 @@ If **2+ Features** in registry:
449
453
 
450
454
  3. **Present to User**:
451
455
  ```
452
- 📋 Batch Design Summary
456
+ 📋 Batch Feature Spec Summary
453
457
 
454
458
  Total Features: {N}
455
459
  ├── Functions Designed: {total}
@@ -459,73 +463,23 @@ If **2+ Features** in registry:
459
463
 
460
464
  [Summary table above]
461
465
 
462
- ⚠️ HARD STOP — Please review all designs before proceeding to document generation.
466
+ ⚠️ HARD STOP — Please review all Feature Specs before proceeding to API Contract generation.
463
467
  ```
464
468
 
465
469
  4. **HARD STOP**: Wait for user confirmation
466
470
  - If user requests modification for specific Feature → Re-dispatch design worker for that Feature only
467
- - If user confirms → Update `.checkpoints.json` for all Features:
471
+ - If user confirms → Update `.checkpoints.json`:
468
472
  ```bash
469
473
  node speccrew-workspace/scripts/update-progress.js write-checkpoint --file speccrew-workspace/iterations/{iteration}/02.feature-design/.checkpoints.json --checkpoint feature_spec_review --passed true
470
474
  ```
471
475
 
472
476
  ---
473
477
 
474
- ### Phase 3d: Generate — Document Assembly
475
-
476
- **Purpose**: Assemble final Feature Spec documents from design data.
477
-
478
- **Prerequisite**:
479
- - Single Feature: Phase 3b complete
480
- - Multi-Feature: Phase 3c confirmation passed
481
-
482
- **Skill**: `speccrew-fd-feature-generate/SKILL.md`
483
-
484
- #### Single Feature (Direct Invocation)
485
-
486
- - Skill path: `speccrew-fd-feature-generate/SKILL.md`
487
- - Parameters:
488
- - `feature_analysis_path`: Path to `.feature-analysis.md`
489
- - `feature_design_data_path`: Path to `.feature-design-data.md`
490
- - `feature_id`: Feature ID
491
- - `feature_name`: Feature name
492
- - `feature_type`: `Page+API` or `API-only`
493
- - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md`
494
- - Checkpoint B handled inside skill (user confirmation before writing)
495
-
496
- #### Multiple Features (Worker Dispatch)
497
-
498
- 1. **Update DISPATCH-PROGRESS.json**:
499
- ```bash
500
- node speccrew-workspace/scripts/update-progress.js update-stage --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_generate
501
- ```
502
-
503
- 2. **Dispatch Workers** (batch of 6):
504
- - Each worker receives:
505
- - `skill_path`: `speccrew-fd-feature-generate/SKILL.md`
506
- - `context`:
507
- - `feature_analysis_path`: Path to `.feature-analysis.md`
508
- - `feature_design_data_path`: Path to `.feature-design-data.md`
509
- - `feature_id`: Feature ID
510
- - `feature_name`: Feature name
511
- - `feature_type`: `Page+API` or `API-only`
512
- - `output_path`: Path for final spec
513
- - `skip_checkpoint`: `true` (Checkpoint B already done in Phase 3c)
514
-
515
- 3. **Wait for batch completion**
516
-
517
- 4. **Update `.checkpoints.json`** for each completed Feature:
518
- - Set `feature_spec_status` = `completed`
519
-
520
- **Output**: One `{feature-id}-{feature-name}-feature-spec.md` per Feature
521
-
522
- ---
523
-
524
478
  ### Phase 3 Error Handling
525
479
 
526
- When any worker (analyze/design/generate) reports failure:
480
+ When any worker (analyze/design) reports failure:
527
481
 
528
- 1. **Identify Phase**: Record which phase failed (3a/3b/3d) and which skill
482
+ 1. **Identify Phase**: Record which phase failed (3a/3b) and which skill
529
483
 
530
484
  2. **Update status**: Set the failed feature's status in `.checkpoints.json`:
531
485
  ```bash
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: speccrew-fd-feature-design
3
- description: Feature Design SOP. Transforms function decomposition into complete feature specifications including frontend prototypes, backend interface logic, and data model design. Reads .feature-analysis.md as input and outputs .feature-design-data.md as interface contract for downstream generate skill. Does not involve specific technology implementation details.
4
- tools: Read, Write, Glob, Grep
3
+ description: Feature Design & Spec Generation SOP. Reads .feature-analysis.md and PRD documents, performs frontend/backend/data design, and generates complete Feature Spec document using template-first workflow. Combines design thinking with document generation in a single pass, without producing any intermediate design-data artifacts. Use when Feature Designer needs to produce Feature Spec from completed analysis.
4
+ tools: Read, Write, Glob, Grep, search_replace
5
5
  ---
6
6
 
7
7
  # Methodology Foundation
@@ -20,45 +20,55 @@ ISA-95 Stages 4-6 as internal thinking framework:
20
20
 
21
21
  - Function decomposition completed (`.feature-analysis.md` exists)
22
22
  - Checkpoint A passed (function breakdown confirmed)
23
- - User requests feature specifications design
23
+ - Feature Spec document generation needed
24
24
 
25
25
  # Workflow
26
26
 
27
27
  ## Absolute Constraints
28
28
 
29
- **ABORT CONDITIONS:** `.feature-analysis.md` does not exist OR Checkpoint A not passed → HARD STOP
29
+ **ABORT CONDITIONS:**
30
+ - `.feature-analysis.md` missing OR Checkpoint A not passed → HARD STOP
31
+ - Template file missing → HARD STOP
30
32
 
31
- **FORBIDDEN:** `create_file` for final feature-spec documents (use template + search_replace in generate skill)
33
+ **FORBIDDEN:**
34
+ - `create_file` for final documents in section-fill phase — use template + search_replace
35
+ - Full-file rewrite — use targeted search_replace per section
32
36
 
33
- ## Step 0: Precondition Check
34
-
35
- **MANDATORY:** Verify `.feature-analysis.md` exists.
36
-
37
- **IF missing → ABORT:** `ERROR: .feature-analysis.md not found. Run speccrew-fd-feature-analysis first.`
38
-
39
- **Actions:**
40
- 1. Read `.feature-analysis.md`
41
- 2. Verify Checkpoint A: `function_decomposition.passed == true`
42
- 3. IF not passed → STOP
43
- 4. Extract: feature_id, feature_name, feature_type, functions[], platforms[]
37
+ **MANDATORY:**
38
+ - Template-first workflow — Step 5 (copy template) MUST precede Step 6 (fill content)
44
39
 
45
- ## Step 1: Determine Output Structure
40
+ **NOTE:** Design process is internal — no intermediate design-data files are produced.
46
41
 
47
- ### 1.1 Single Feature Output (when feature_id provided)
42
+ ## Step 0: Precondition Check
48
43
 
49
- | Output | File Naming | Example |
50
- |--------|-------------|---------|
51
- | Single File | `{feature-id}-{feature-name}.feature-design-data.md` | `F-CRM-01-customer-list.feature-design-data.md` |
44
+ ### Step 0 Input Parameters
52
45
 
53
- ### 1.2 Legacy Output (backward compatibility)
46
+ | Parameter | Required | Description |
47
+ |-----------|----------|-------------|
48
+ | `feature_analysis_path` | Yes | Path to `.feature-analysis.md` |
49
+ | `prd_path` | Yes | Path to the Sub-PRD document |
50
+ | `feature_id` | No | Feature identifier (e.g., `F-CRM-01`) |
51
+ | `feature_name` | No | Feature name in English |
52
+ | `feature_type` | No | `Page+API` or `API-only` |
53
+ | `frontend_platforms` | No | List of frontend platforms |
54
+ | `output_path` | No | Custom output path for Feature Spec (auto-generated if not provided) |
55
+ | `skip_checkpoint` | No | Boolean, default `false`. Skip Checkpoint B if `true` (batch mode) |
54
56
 
55
- When `feature_id` is NOT provided: Single PRD → Single file; Master-Sub PRD → Master + Sub files
57
+ ### Step 0 Actions
56
58
 
57
- **Master Design Data MUST include:** overall overview, cross-module diagram, module boundaries, interface contracts, shared data structures.
59
+ 1. Read `.feature-analysis.md` at `feature_analysis_path`
60
+ 2. Verify Checkpoint A: `function_decomposition.passed == true`
61
+ 3. IF not passed → ABORT: `ERROR: Checkpoint A not passed. Run speccrew-fd-feature-analysis first.`
62
+ 4. Extract key data:
63
+ - `feature_id`: From analysis file or parameter
64
+ - `feature_name`: From analysis file or parameter
65
+ - `feature_type`: From analysis file or parameter (`Page+API` or `API-only`)
66
+ - `functions[]`: Function breakdown list
67
+ - `platforms[]`: Frontend platforms list
58
68
 
59
- ## Step 2: Frontend Design (Per Function)
69
+ ## Step 1: Frontend Design
60
70
 
61
- ### 2.0 Conditional Execution
71
+ ### 1.0 Conditional Execution
62
72
 
63
73
  `feature_type = "Page+API"` → Execute design; `feature_type = "API-only"` → Skip; Not provided → Execute (backward compatibility)
64
74
 
@@ -118,7 +128,7 @@ Pattern M-C: Action Sheet
118
128
  +----------------------------------+
119
129
  ```
120
130
 
121
- ### 2.1 UI Prototype
131
+ ### 1.1 UI Prototype
122
132
 
123
133
  Create ASCII wireframes showing layout, UI elements, navigation.
124
134
 
@@ -139,13 +149,13 @@ Create ASCII wireframes showing layout, UI elements, navigation.
139
149
  +--------------------------------------------------+
140
150
  ```
141
151
 
142
- ### 2.2 Interface Element Descriptions
152
+ ### 1.2 Interface Element Descriptions
143
153
 
144
154
  | Element | Type | Behavior |
145
155
  |---------|------|----------|
146
156
  | {name} | {component type} | {behavior description} |
147
157
 
148
- ### 2.3 Interaction Flow
158
+ ### 1.3 Interaction Flow
149
159
 
150
160
  Document: `User Action → Frontend Response → Backend API Call`
151
161
 
@@ -155,21 +165,21 @@ Document: `User Action → Frontend Response → Backend API Call`
155
165
  > - Interface identification: Every data exchange point = potential API endpoint
156
166
  > - Exception flows: Document alternative paths, not just happy path
157
167
 
158
- ### 2.4 Backend API Mapping
168
+ ### 1.4 Backend API Mapping
159
169
 
160
170
  | Frontend Action | Backend API | Purpose |
161
171
  |-----------------|-------------|---------|
162
172
  | {action} | {API endpoint} | {data exchanged} |
163
173
 
164
- ## Step 3: Backend Design (Per Function)
174
+ ## Step 2: Backend Design
165
175
 
166
- ### 3.1 API/Interface List
176
+ ### 2.1 API/Interface List
167
177
 
168
178
  | Interface | Method | Description |
169
179
  |-----------|--------|-------------|
170
180
  | {name} | {GET/POST/PUT/DELETE} | {purpose} |
171
181
 
172
- ### 3.2 Processing Logic Flow
182
+ ### 2.2 Processing Logic Flow
173
183
 
174
184
  | Stage | Description |
175
185
  |-------|-------------|
@@ -178,22 +188,22 @@ Document: `User Action → Frontend Response → Backend API Call`
178
188
  | Data Operations | What data to read/write |
179
189
  | Response | What data to return |
180
190
 
181
- ### 3.3 Data Access Scheme
191
+ ### 2.3 Data Access Scheme
182
192
 
183
193
  | Operation | Data Target | Type |
184
194
  |-----------|-------------|------|
185
195
  | Read | {data} | [EXISTING]/[NEW] |
186
196
  | Write | {data} | [EXISTING]/[NEW] |
187
197
 
188
- ### 3.4 Cross-Module Interactions
198
+ ### 2.4 Cross-Module Interactions
189
199
 
190
200
  | This Module | Interacts With | Interface | Data Exchanged |
191
201
  |-------------|----------------|-----------|----------------|
192
202
  | {module} | {other module} | {API/Event} | {what data} |
193
203
 
194
- ## Step 4: Data Model Design
204
+ ## Step 3: Data Model & Business Rules
195
205
 
196
- ### 4.1 New Data Structures
206
+ ### 3.1 New Data Structures
197
207
 
198
208
  | Field | Type | Constraints | Description |
199
209
  |-------|------|-------------|-------------|
@@ -205,13 +215,13 @@ Document: `User Action → Frontend Response → Backend API Call`
205
215
  > - Semantic consistency: Align with domain glossary
206
216
  > - Relationships: Identify core relationships (1:1, 1:N, N:N)
207
217
 
208
- ### 4.2 Modifications to Existing Data Structures
218
+ ### 3.2 Modifications to Existing Data Structures
209
219
 
210
220
  | Entity | Change Type | Details | Impact |
211
221
  |--------|-------------|---------|--------|
212
222
  | {entity} | Add/Modify/Remove field | {description} | {affected areas} |
213
223
 
214
- ### 4.3 Data Relationships
224
+ ### 3.3 Data Relationships
215
225
 
216
226
  **New Relationships:** `EntityA --1:N--> EntityB`
217
227
 
@@ -219,13 +229,13 @@ Document: `User Action → Frontend Response → Backend API Call`
219
229
  |------------|-----------------|--------------|
220
230
  | {new} | {existing} | {1:1 / 1:N / N:M} |
221
231
 
222
- ### 4.4 Data Source Descriptions
232
+ ### 3.4 Data Source Descriptions
223
233
 
224
234
  | Data | Source | Update Frequency |
225
235
  |------|--------|------------------|
226
236
  | {item} | {internal/external/user} | {real-time/periodic/on-demand} |
227
237
 
228
- ## Step 5: Business Rules and Constraints
238
+ ### 3.5 Permission Rules
229
239
 
230
240
  > **ISA-95 Stage 6 Thinking — Information Descriptions**
231
241
  > - Validation: Field-level, cross-field, business logic rules
@@ -233,74 +243,182 @@ Document: `User Action → Frontend Response → Backend API Call`
233
243
  > - Permissions: Data access rules mapping to API authorization
234
244
  > - Traceability: Every rule traces back to PRD requirement
235
245
 
236
- ### 5.1 Permission Rules
237
-
238
246
  | Function | Required Permission | Scope |
239
247
  |----------|---------------------|-------|
240
248
  | {function} | {permission} | {global/module/resource-specific} |
241
249
 
242
- ### 5.2 Business Logic Rules
250
+ ### 3.6 Business Logic Rules
243
251
 
244
252
  | Rule ID | Description | Trigger | Action |
245
253
  |---------|-------------|---------|--------|
246
254
  | BR-{number} | {description} | {when applies} | {what happens} |
247
255
 
248
- ### 5.3 Validation Rules
256
+ ### 3.7 Validation Rules
249
257
 
250
258
  | Field | Frontend Validation | Backend Validation |
251
259
  |-------|---------------------|---------------------|
252
260
  | {field} | {client rules} | {server rules} |
253
261
 
254
- ## Step 6: Write Output Contract
255
-
256
- Write to `{feature-id}-{feature-name}.feature-design-data.md`:
257
-
258
- ```markdown
259
- # Feature Design Data: {feature-name}
260
-
261
- ## Output Structure
262
- - Mode: {single-feature/legacy-master-sub}
263
- - Output path: {planned path}
264
-
265
- ## Frontend Design
266
- ### Platforms: {list}
267
- ### UI Prototypes
268
- [Per-platform ASCII wireframes]
269
- ### Interface Elements
270
- [Element tables]
271
- ### Interaction Flows
272
- [Mermaid diagrams + descriptions]
273
- ### Backend API Mapping
274
- [Action API mapping tables]
275
-
276
- ## Backend Design
277
- ### API/Interface List
278
- [Interface tables]
279
- ### Processing Logic
280
- [Logic flows]
281
- ### Data Access Scheme
282
- [Operation tables]
283
- ### Cross-Module Interactions
284
- [Cross-module tables]
285
-
286
- ## Data Model
287
- ### New Data Structures
288
- [Entity field tables]
289
- ### Modified Data Structures
290
- [Modification tables]
291
- ### Data Relationships
292
- [Relationship diagrams]
293
- ### Data Sources
294
- [Source tables]
295
-
296
- ## Business Rules
297
- ### Permission Rules
298
- [Permission tables]
299
- ### Business Logic Rules
300
- [Rule tables with BR-{number} IDs]
301
- ### Validation Rules
302
- [Validation tables]
262
+ ## Step 4: Checkpoint B — User Confirmation
263
+
264
+ **Conditional Execution:** Skip if `skip_checkpoint=true`
265
+
266
+ ### 4.1 Present Design Summary
267
+
268
+ ```
269
+ ╔══════════════════════════════════════════════════════════════╗
270
+ ║ FEATURE DESIGN SUMMARY - CHECKPOINT B ║
271
+ ╠══════════════════════════════════════════════════════════════╣
272
+ ║ Feature: {feature_name} ({feature_id}) ║
273
+ ╠══════════════════════════════════════════════════════════════╣
274
+ FUNCTIONS DESIGNED ║
275
+ Total: {N} functions ║
276
+ ║ ║
277
+ Function Breakdown: ║
278
+ ║ • {Function 1} - [EXISTING/MODIFIED/NEW]
279
+ {Function 2} - [EXISTING/MODIFIED/NEW] ║
280
+ {Function 3} - [EXISTING/MODIFIED/NEW]
281
+ ╠══════════════════════════════════════════════════════════════╣
282
+ SYSTEM RELATIONSHIP SUMMARY ║
283
+ ║ • [EXISTING]: {count} - Reuse existing capabilities ║
284
+ [MODIFIED]: {count} - Enhance existing features ║
285
+ [NEW]: {count} - Create new functionality ║
286
+ ╠══════════════════════════════════════════════════════════════╣
287
+ FRONTEND COMPONENTS ║
288
+ • Platforms: {platform list} ║
289
+ UI Patterns: {list of wireframe patterns used} ║
290
+ • Total Functions with UI: {count} ║
291
+ ╠══════════════════════════════════════════════════════════════╣
292
+ BACKEND INTERFACES ║
293
+ ║ • Total APIs: {count} ║
294
+ New APIs: {count} ║
295
+ Modified APIs: {count} ║
296
+ Cross-Module Interactions: {count} ║
297
+ ╠══════════════════════════════════════════════════════════════╣
298
+ DATA ENTITIES ║
299
+ New Entities: {count} ║
300
+ • Modified Entities: {count} ║
301
+ Business Rules: {count} ║
302
+ ╚══════════════════════════════════════════════════════════════╝
303
+ ```
304
+
305
+ ### 4.2 HARD STOP — 5 Confirmation Questions
306
+
307
+ **STOP DO NOT PROCEED until user confirms:**
308
+
309
+ 1. **Function Coverage**: "Does this design cover all functions from the analysis? Are any functions missing?"
310
+
311
+ 2. **System Relationship Markers**: "Are the [EXISTING]/[MODIFIED]/[NEW] markers accurate for each component?"
312
+
313
+ 3. **UI/UX Approach**: "Do the ASCII wireframes and interaction flows match your expectations?"
314
+
315
+ 4. **Backend Interface Scope**: "Are the API endpoints and cross-module interactions correctly identified?"
316
+
317
+ 5. **Data Model Completeness**: "Does the data model cover all fields and relationships needed?"
318
+
319
+ **WAIT for user confirmation before proceeding to document generation.**
320
+
321
+ ### 4.3 Update Checkpoints
322
+
323
+ After user confirms (or if skipped):
324
+
325
+ ```bash
326
+ node speccrew-workspace/scripts/update-progress.js write-checkpoint \
327
+ --file speccrew-workspace/iterations/{iteration_id}/02.feature-design/.checkpoints.json \
328
+ --checkpoint feature_design_review \
329
+ --passed true
330
+ ```
331
+
332
+ Log: "✅ Checkpoint B (feature_design_review) passed and recorded"
333
+
334
+ ## Step 5: Determine Output Path & Copy Template
335
+
336
+ ### 5.1 Determine Output Path
337
+
338
+ **Single Feature Mode** (when `feature_id` provided):
339
+ ```
340
+ {iteration_path}/02.feature-design/{feature_id}-{feature_name}-feature-spec.md
341
+ ```
342
+
343
+ **Legacy Single Mode** (backward compatibility):
303
344
  ```
345
+ {iteration_path}/02.feature-design/[feature-name]-feature-spec.md
346
+ ```
347
+
348
+ **Legacy Master-Sub Mode** (backward compatibility):
349
+ - Master Spec: `{iteration_path}/02.feature-design/[master-name]-feature-spec.md`
350
+ - Sub Specs: `{iteration_path}/02.feature-design/[sub-name]-feature-spec.md` (one per sub-feature)
351
+
352
+ ### 5.2 Copy Template
353
+
354
+ 1. Read template: `templates/FEATURE-SPEC-TEMPLATE.md` (relative path from skill directory)
355
+ 2. Replace top-level placeholders:
356
+ - `[Feature Name]` → actual feature name
357
+ - `{Feature ID}` → actual feature ID
358
+ - `{Feature Name}` → actual feature name
359
+ - `{Page+API / API-only}` → actual feature type
360
+ - `{Link to Sub-PRD document}` → `prd_path` value
361
+ 3. Create document using `create_file` with template content
362
+ 4. Verify section structure exists (Sections 1-6 with proper numbering)
363
+
364
+ ## Step 6: Fill Sections Using search_replace
365
+
366
+ ### Section Mapping Table
367
+
368
+ | Template Section | Data Source |
369
+ |------------------|-------------|
370
+ | 1. Overview (Basic Information, Feature Scope) | `.feature-analysis.md` Feature Information + summary |
371
+ | 1.3 Relationship to Existing System | `.feature-analysis.md` System Relationships |
372
+ | 2. Function Details | Step 1 Frontend Design + Step 2 Backend Design results (internal) |
373
+ | 2.1.x Frontend Prototype | Step 1.1 UI Prototype results |
374
+ | 2.1.x Interaction Flow | Step 1.3 Interaction Flow results |
375
+ | 2.1.x Backend Interface | Step 2.1-2.3 Backend Design results |
376
+ | 2.1.x Data Definition | Step 3.1-3.4 Data Model results |
377
+ | 3. Cross-Function Concerns | Step 2.4 Cross-Module results |
378
+ | 4. Business Rules & Constraints | Step 3.5-3.7 Business Rules results |
379
+ | 5. API Contract Summary | Aggregated from Step 2.1 API List |
380
+ | 6. Notes | Contextual notes from analysis |
381
+
382
+ ### Filling Rules
383
+
384
+ - Use `search_replace` for each section individually
385
+ - Preserve all section titles and numbering
386
+ - No applicable content → "N/A"
387
+ - Multi-platform: Create separate sub-sections per platform
388
+
389
+ ### Legacy Master-Sub Mode
390
+
391
+ If processing Master-Sub structure:
392
+ - Repeat Step 5+6 for each sub-spec
393
+ - Master spec contains: Overview, Cross-module diagram, shared data structures
394
+ - Sub specs contain: Per-feature detailed design
395
+
396
+ ## Step 7: Mermaid Diagram Compliance
397
+
398
+ Verify all Mermaid diagrams follow compliance rules:
399
+
400
+ 1. **NO style definitions** — No `classDef`, `style`, or CSS-like syntax
401
+ 2. **NO HTML tags** — No `<br/>`, `<b>`, or other HTML in labels
402
+ 3. **Use standard syntax only:**
403
+ - `sequenceDiagram` for interaction flows
404
+ - `flowchart TD` for processing logic
405
+ - Plain text labels with standard characters
406
+ 4. **Reference:** `speccrew-workspace/docs/rules/mermaid-rule.md`
407
+
408
+ **Validation:** Before finalizing, scan all Mermaid blocks for non-compliant syntax.
409
+
410
+ ## Step 8: Update Checkpoints
411
+
412
+ Set final checkpoint status:
413
+
414
+ ```bash
415
+ node speccrew-workspace/scripts/update-progress.js write-checkpoint \
416
+ --file speccrew-workspace/iterations/{iteration_id}/02.feature-design/.checkpoints.json \
417
+ --checkpoint feature_spec_review \
418
+ --passed true
419
+ ```
420
+
421
+ Log: "✅ Feature Spec generation completed. Checkpoint feature_spec_review passed."
304
422
 
305
423
  ---
306
424
 
@@ -312,19 +430,30 @@ Write to `{feature-id}-{feature-name}.feature-design-data.md`:
312
430
  | Focus on WHAT not HOW | Describe what system does, not how it's implemented |
313
431
  | ASCII Wireframes Only | Use ASCII art for UI prototypes |
314
432
  | Mermaid Compatibility | Follow mermaid-rule.md guidelines |
315
- | Clear Markers | Use [EXISTING]/[MODIFIED]/[NEW] markers |
433
+ | Clear Markers | Use [EXISTING]/[MODIFIED]/[NEW] consistently |
434
+ | Template-First | Copy template before filling content |
435
+ | search_replace Only | Never use create_file for section updates after template copy |
436
+ | Checkpoint B | Get user confirmation before writing files (unless skipped) |
437
+ | No Intermediate Files | Design process is internal — do NOT output any intermediate design-data artifacts |
316
438
 
317
439
  # Checklist
318
440
 
319
- - [ ] `.feature-analysis.md` verified
320
- - [ ] Checkpoint A passed
321
- - [ ] Output structure determined
441
+ - [ ] `.feature-analysis.md` verified and exists
442
+ - [ ] Checkpoint A passed (`function_decomposition.passed == true`)
443
+ - [ ] All input parameters resolved (feature_id, feature_name, feature_type)
444
+ - [ ] Template file `templates/FEATURE-SPEC-TEMPLATE.md` exists
322
445
  - [ ] **[API-only]** Frontend design skipped
323
- - [ ] **[Page+API]** ASCII wireframes and flows included
324
- - [ ] **[Multi-platform]** Per-platform designs
446
+ - [ ] **[Page+API]** ASCII wireframes created for all platforms
447
+ - [ ] **[Multi-platform]** Per-platform designs completed
325
448
  - [ ] Backend interfaces and logic documented
326
- - [ ] Data model with entities and modifications
327
- - [ ] Business rules documented
449
+ - [ ] Data model with entities and modifications documented
450
+ - [ ] Business rules (permissions, logic, validation) documented
328
451
  - [ ] ISA-95 Stage 4/5/6 thinking applied
329
- - [ ] `.feature-design-data.md` created
452
+ - [ ] Checkpoint B passed: design summary confirmed with user (or skipped)
453
+ - [ ] Output path determined
454
+ - [ ] Template copied using `create_file`
455
+ - [ ] All sections filled using `search_replace`
456
+ - [ ] Mermaid diagrams verified for compliance
457
+ - [ ] `.checkpoints.json` updated via script
330
458
  - [ ] No technology decisions included
459
+ - [ ] No intermediate design-data artifact created
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -1,243 +0,0 @@
1
- ---
2
- name: speccrew-fd-feature-generate
3
- description: Feature Spec Generation SOP. Reads .feature-analysis.md and .feature-design-data.md interface contracts, assembles complete Feature Spec document using template-first workflow. Handles Checkpoint B user confirmation before writing files. Use when Feature Designer needs to generate final Feature Spec document from completed design data.
4
- tools: Read, Write, Glob, Grep
5
- ---
6
-
7
- # Skill Overview
8
-
9
- Generates final Feature Spec document from completed design data. Reads intermediate artifacts and assembles complete specification using template-first workflow.
10
-
11
- ## Trigger Scenarios
12
-
13
- - Feature design data ready (`.feature-design-data.md` exists)
14
- - Feature analysis complete (`.feature-analysis.md` exists)
15
- - Final Feature Spec document generation needed
16
-
17
- ---
18
-
19
- # Workflow
20
-
21
- ## Absolute Constraints
22
-
23
- > **Violation = task failure**
24
-
25
- ### ABORT CONDITIONS
26
- - `.feature-analysis.md` missing → **HARD STOP**
27
- - `.feature-design-data.md` missing → **HARD STOP**
28
- - Template file missing → **HARD STOP**
29
- - **NEVER skip preconditions verification**
30
-
31
- ### FORBIDDEN
32
- - `create_file` for final documents — use template + `search_replace`
33
- - Full-file rewrite — use targeted `search_replace` per section
34
-
35
- ### MANDATORY
36
- - **Template-first workflow** — Step 4 (copy template) MUST precede Step 5 (fill content)
37
-
38
- ---
39
-
40
- ## Step 1: Read Input & Verify Preconditions
41
-
42
- ### 1.1 Input Parameters
43
-
44
- | Parameter | Required | Description |
45
- |-----------|----------|-------------|
46
- | `feature_analysis_path` | Yes | Path to `.feature-analysis.md` |
47
- | `feature_design_data_path` | Yes | Path to `.feature-design-data.md` |
48
- | `feature_id` | No | Feature identifier (e.g., F-CRM-01) |
49
- | `feature_name` | No | Feature name |
50
- | `feature_type` | No | Page+API or API-only |
51
- | `output_path` | No | Custom output path (auto-generated if not provided) |
52
- | `skip_checkpoint` | No | Boolean. If true, skip Checkpoint B (batch mode) |
53
-
54
- ### 1.2 Verify Input Files
55
-
56
- **IF either file missing → ABORT:**
57
- ```
58
- ❌ ERROR: Prerequisite files not found.
59
- Missing: [filename]
60
-
61
- This skill requires completed feature analysis and design.
62
- Please run speccrew-fd-feature-analyze and speccrew-fd-feature-design first.
63
- ```
64
-
65
- ### 1.3 Read Files
66
-
67
- 1. Read `.feature-analysis.md` — extract: Function Breakdown, [EXISTING]/[MODIFIED]/[NEW] counts
68
- 2. Read `.feature-design-data.md` — extract: Frontend Design, Backend Design, Data Model, Business Rules
69
- 3. Read Feature Spec template: `speccrew-fd-feature-design/templates/FEATURE-SPEC-TEMPLATE.md`
70
-
71
- ---
72
-
73
- ## Step 2: Build Design Summary
74
-
75
- Extract statistics from intermediate artifacts:
76
-
77
- | Metric | Source |
78
- |--------|--------|
79
- | Functions Designed | `.feature-analysis.md` Function Breakdown section |
80
- | [EXISTING] / [MODIFIED] / [NEW] counts | Function markers in analysis |
81
- | Frontend Components | `.feature-design-data.md` Frontend Design (0 if API-only) |
82
- | Backend Interfaces | `.feature-design-data.md` Backend Design API count |
83
- | Data Entities | `.feature-design-data.md` Data Model (new/modified) |
84
-
85
- ---
86
-
87
- ## Step 3: Checkpoint B — User Confirmation
88
-
89
- > **Skip this step if `skip_checkpoint=true`**
90
-
91
- ### 3.1 Present Summary
92
-
93
- ```
94
- Feature Design Summary for: {feature-name}
95
-
96
- Functions Designed: {count}
97
- ├── [EXISTING] {count} functions reuse existing capabilities
98
- ├── [MODIFIED] {count} functions enhance existing features
99
- └── [NEW] {count} functions are brand new
100
-
101
- Frontend Components: {count} pages/components
102
- Backend Interfaces: {count} APIs
103
- Data Entities: {count} new, {count} modified
104
-
105
- Output File: {filename}
106
- ```
107
-
108
- ### 3.2 Confirm 5 Questions
109
-
110
- **HARD STOP** — Wait for user confirmation on:
111
-
112
- 1. Is the frontend prototype appropriate? (if applicable)
113
- 2. Is the backend logic flow correct and complete?
114
- 3. Is the data model reasonable and extensible?
115
- 4. Are all business rules captured?
116
- 5. [Legacy Master-Sub] Is the module breakdown appropriate?
117
-
118
- ### 3.3 Update Checkpoint
119
-
120
- Update `.checkpoints.json`:
121
- ```json
122
- {
123
- "feature_spec_review": {
124
- "passed": true,
125
- "confirmed_at": "{timestamp}",
126
- "description": "Feature specification confirmed"
127
- }
128
- }
129
- ```
130
-
131
- ---
132
-
133
- ## Step 4: Determine Output Path & Copy Template
134
-
135
- ### 4.1 Determine Output Path
136
-
137
- | Mode | Path Pattern |
138
- |------|--------------|
139
- | Single Feature | `{iteration}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md` |
140
- | Legacy Single | `{iteration}/02.feature-design/[feature-name]-feature-spec.md` |
141
- | Legacy Master-Sub | Multiple files (master + sub-specs) |
142
-
143
- ### 4.2 Copy Template
144
-
145
- 1. Read template: `speccrew-fd-feature-design/templates/FEATURE-SPEC-TEMPLATE.md`
146
- 2. Replace top-level placeholders: `{Feature Name}`, `{Feature ID}`, etc.
147
- 3. **Create document** using `create_file` with template content
148
- 4. Verify complete section structure exists
149
-
150
- ---
151
-
152
- ## Step 5: Fill Sections Using search_replace
153
-
154
- Map data sources to template sections:
155
-
156
- | Template Section | Data Source |
157
- |------------------|-------------|
158
- | Feature Overview | `.feature-analysis.md` Feature Information + summary |
159
- | Function Breakdown | `.feature-analysis.md` Function Breakdown |
160
- | Frontend Design | `.feature-design-data.md` Frontend Design |
161
- | Backend Design | `.feature-design-data.md` Backend Design |
162
- | Data Model | `.feature-design-data.md` Data Model |
163
- | Business Rules | `.feature-design-data.md` Business Rules |
164
- | Cross-Module Interactions | `.feature-design-data.md` Cross-Module (if applicable) |
165
-
166
- **Rules:**
167
- - Use `search_replace` for each section individually
168
- - Preserve all section titles and numbering
169
- - No applicable content → replace placeholder with "N/A"
170
- - Legacy Master-Sub: repeat Step 4+5 for each sub-spec
171
-
172
- ---
173
-
174
- ## Step 6: Mermaid Diagram Compliance
175
-
176
- Verify all Mermaid diagrams follow compatibility rules:
177
-
178
- - Use only basic node definitions: `A[text content]`
179
- - No HTML tags (e.g., `<br/>`)
180
- - No nested subgraphs
181
- - No `direction` keyword
182
- - No `style` definitions
183
- - Standard `graph TB/LR` or `sequenceDiagram` syntax only
184
-
185
- Reference: `speccrew-workspace/docs/rules/mermaid-rule.md`
186
-
187
- ---
188
-
189
- ## Step 7: Update Checkpoints
190
-
191
- Update `.checkpoints.json`:
192
- - Set `feature_spec_review.passed = true`
193
- - Set `confirmed_at` timestamp
194
- - Preserve existing checkpoint states
195
-
196
- ---
197
-
198
- # Reference Guides
199
-
200
- ## Legacy Mode Backward Compatibility
201
-
202
- When `feature_id` is NOT provided:
203
-
204
- **Single Feature Spec:**
205
- ```
206
- 02.feature-design/[feature-name]-feature-spec.md
207
- ```
208
-
209
- **Master-Sub Feature Specs:**
210
- ```
211
- 02.feature-design/
212
- ├── [feature-name]-feature-spec.md # Master (overview + cross-module)
213
- ├── [feature-name]-sub-[module1]-spec.md # Sub: Module 1
214
- └── [feature-name]-sub-[module2]-spec.md # Sub: Module 2
215
- ```
216
-
217
- Master spec MUST include: overall overview, cross-module diagram, module list, interface contracts.
218
-
219
- ---
220
-
221
- # Key Rules
222
-
223
- | Rule | Description |
224
- |------|-------------|
225
- | **Template-First** | Copy template before filling content |
226
- | **search_replace Only** | Never use `create_file` for section updates |
227
- | **Checkpoint B** | Get user confirmation before writing files |
228
- | **Mermaid Compliance** | Follow mermaid-rule.md guidelines |
229
- | **Clear Markers** | Use [EXISTING]/[MODIFIED]/[NEW] consistently |
230
-
231
- ---
232
-
233
- # Output Checklist
234
-
235
- - [ ] Both input files verified and read
236
- - [ ] Design summary built with statistics
237
- - [ ] Checkpoint B passed (or skipped via flag)
238
- - [ ] Output path determined
239
- - [ ] Template copied using `create_file`
240
- - [ ] All sections filled using `search_replace`
241
- - [ ] Mermaid diagrams verified compliant
242
- - [ ] `.checkpoints.json` updated
243
- - [ ] [Legacy Master-Sub] All sub-specs generated