speccrew 0.5.0 → 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.
@@ -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