speccrew 0.4.4 → 0.5.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.
@@ -1,261 +1,73 @@
1
1
  ---
2
2
  name: speccrew-fd-feature-design
3
- description: Feature Design SOP. Guide Feature Designer Agent to transform PRD requirements into system feature specifications, including frontend prototypes, backend interface logic, and data model design. Does not involve specific technology implementation details. Use when Feature Designer needs to create feature spec from confirmed PRD.
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
4
  tools: Read, Write, Glob, Grep
5
5
  ---
6
6
 
7
7
  # Methodology Foundation
8
8
 
9
- This skill applies the ISA-95 six-stage methodology (Stages 4-6) as an internal thinking framework:
9
+ ISA-95 Stages 4-6 as internal thinking framework:
10
10
 
11
- | ISA-95 Stage | Integrated Into | Purpose |
12
- |---|---|---|
13
- | Stage 4: Information Flows | Feature Spec Section 3 (Interaction Flow) | Map cross-module data flows, identify API endpoints |
14
- | Stage 5: Categories of Information | Feature Spec Section 4 (Data Field Definition) | Classify data entities, build data dictionary |
15
- | Stage 6: Information Descriptions | Feature Spec Section 5 (Business Rules) + API Contract | Define validation rules, output standards, traceability |
11
+ | Stage | Integrated Into | Purpose |
12
+ |-------|-----------------|---------|
13
+ | Stage 4: Information Flows | Interaction Flow | Map cross-module data flows, identify API endpoints |
14
+ | Stage 5: Categories of Information | Data Model | Classify data entities, build data dictionary |
15
+ | Stage 6: Information Descriptions | Business Rules | Define validation rules, output standards, traceability |
16
16
 
17
- > ⚠️ **No separate modeling documents.** The methodology guides thinking quality, not document quantity.
17
+ > No separate modeling documents. Methodology guides thinking quality.
18
18
 
19
19
  # Trigger Scenarios
20
20
 
21
- - PRD has been confirmed, user requests to start feature design
22
- - User asks "Design this feature" or "Create feature specification" or "How should this feature work"
23
- - Feature Designer Agent receives task to design system features from PRD
21
+ - Function decomposition completed (`.feature-analysis.md` exists)
22
+ - Checkpoint A passed (function breakdown confirmed)
23
+ - User requests feature specifications design
24
24
 
25
25
  # Workflow
26
26
 
27
27
  ## Absolute Constraints
28
28
 
29
- > **These rules apply to ALL steps. Violation = task failure.**
29
+ **ABORT CONDITIONS:** `.feature-analysis.md` does not exist OR Checkpoint A not passed → HARD STOP
30
30
 
31
- 1. **FORBIDDEN: `create_file` for documents** — NEVER use `create_file` to write the feature spec document. Documents MUST be created by copying the template (Step 10.2a) then filling sections with `search_replace` (Step 10.2b). `create_file` produces truncated output on large files.
31
+ **FORBIDDEN:** `create_file` for final feature-spec documents (use template + search_replace in generate skill)
32
32
 
33
- 2. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
33
+ ## Step 0: Precondition Check
34
34
 
35
- 3. **MANDATORY: Template-first workflow** — Step 10.2a (copy template) MUST execute before Step 10.2b (fill sections). Skipping Step 10.2a and writing content directly is FORBIDDEN.
35
+ **MANDATORY:** Verify `.feature-analysis.md` exists.
36
36
 
37
- ## Step 1: Read PRD Input
37
+ **IF missing → ABORT:** `ERROR: .feature-analysis.md not found. Run speccrew-fd-feature-analysis first.`
38
38
 
39
- ### 1.1 Input Parameters
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[]
40
44
 
41
- The skill receives the following parameters from the calling agent:
45
+ ## Step 1: Determine Output Structure
42
46
 
43
- | Parameter | Required | Description |
44
- |-----------|----------|-------------|
45
- | `feature_id` | No | Feature identifier (e.g., `F-CRM-01`). If not provided, processes entire PRD (backward compatibility) |
46
- | `feature_name` | No | Feature name in English (e.g., `customer-list`). Used for file naming |
47
- | `feature_type` | No | `Page+API` or `API-only`. `API-only` skips frontend design steps |
48
- | `iteration_id` | No | Current iteration identifier. Paths come from `prd_path`/`output_path`; `iteration_id` is used only for progress messages when available |
49
- | `prd_path` | Yes | Path to the Sub-PRD document |
47
+ ### 1.1 Single Feature Output (when feature_id provided)
50
48
 
51
- ### 1.2 Read PRD
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` |
52
52
 
53
- Read in order:
53
+ ### 1.2 Legacy Output (backward compatibility)
54
54
 
55
- 1. **Current iteration PRD**: `{prd_path}` (typically `speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/[module-name]-prd.md`)
56
- 2. **Feature spec template**: `speccrew-fd-feature-design/templates/FEATURE-SPEC-TEMPLATE.md`
55
+ When `feature_id` is NOT provided: Single PRD Single file; Master-Sub PRD → Master + Sub files
57
56
 
58
- ### 1.3 Focus on Specific Feature (when feature_id provided)
57
+ **Master Design Data MUST include:** overall overview, cross-module diagram, module boundaries, interface contracts, shared data structures.
59
58
 
60
- If `feature_id` is provided:
61
- - Locate the specific Feature in PRD Section 3.4 "Feature Breakdown"
62
- - Extract only the user stories and requirements related to this Feature
63
- - Ignore other Features in the same PRD
64
- - Use the Feature's scope to guide function breakdown
59
+ ## Step 2: Frontend Design (Per Function)
65
60
 
66
- ### 1.4 Backward Compatibility (when feature_id not provided)
61
+ ### 2.0 Conditional Execution
67
62
 
68
- If `feature_id` is NOT provided, process entire PRD using legacy mode. For Master-Sub PRD structure, read master PRD and all sub PRDs. See Reference Guides for detailed behavior.
63
+ `feature_type = "Page+API"` Execute design; `feature_type = "API-only"` Skip; Not provided Execute (backward compatibility)
69
64
 
70
- ## Step 2: Load System Knowledge
65
+ **Multi-Platform Rule:** Repeat design for EACH platform with platform-specific headers.
71
66
 
72
- ### 2.1 Read System Overview
67
+ **Mobile Wireframe Patterns:**
73
68
 
74
- Read the file to understand system context:
75
69
  ```
76
- speccrew-workspace/knowledges/bizs/system-overview.md
77
- ```
78
-
79
- ### 2.2 Load Related Module Overviews
80
-
81
- Based on PRD content, identify related modules and read their overview files:
82
- ```
83
- speccrew-workspace/knowledges/bizs/{module-name}/{module-name}-overview.md
84
- ```
85
-
86
- ### 2.2b Discover Frontend Platforms
87
-
88
- Read `speccrew-workspace/knowledges/techs/techs-manifest.json` to identify frontend platforms:
89
-
90
- | Platform Type | Examples | Design Implications |
91
- |---------------|----------|---------------------|
92
- | `web-*` | web-vue, web-react | Desktop-width layouts, tables, modals, sidebars |
93
- | `mobile-*` | mobile-uniapp, mobile-flutter | Compact layouts, card lists, bottom nav, swipe actions |
94
-
95
- - If `frontend_platforms` parameter is provided by the agent, use that list
96
- - Otherwise, read techs-manifest.json directly
97
- - Store the platform list for use in Step 5
98
-
99
- ### 2.3 Query Knowledge Graph (Optional)
100
-
101
- If cross-module relationships need analysis, use `speccrew-knowledge-graph-query` skill:
102
-
103
- | Action | Use Case |
104
- |--------|----------|
105
- | `query-nodes` | Find all nodes in a module |
106
- | `search` | Find related entities by keyword |
107
- | `trace-upstream` | Impact analysis for existing entities |
108
- | `trace-downstream` | Dependency analysis |
109
-
110
- ## Step 3: Function Breakdown
111
-
112
- Break down PRD functional requirements into implementable system functions.
113
-
114
- ### 3.1 Feature-Based Decomposition (when feature_id provided)
115
-
116
- When processing a single Feature:
117
-
118
- 1. **Extract Feature Scope**: From PRD Section 3.4, locate the specific Feature by `feature_id`
119
- 2. **Identify Related User Stories**: Extract only user stories mapped to this Feature
120
- 3. **Decompose into Functions**: Break down into 3-8 focused Functions (not 10-20)
121
- 4. **Check feature_type**:
122
- - If `feature_type = API-only`: Mark for backend-only design (skip frontend in Step 5)
123
- - If `feature_type = Page+API`: Include both frontend and backend design
124
-
125
- ### 3.2 Full PRD Decomposition (backward compatibility)
126
-
127
- When `feature_id` is NOT provided (legacy mode):
128
- - Decompose entire PRD into all required Functions
129
- - May result in 10-20 Functions for complex modules
130
-
131
- ### 3.3 Function Analysis
132
-
133
- For each function, identify:
134
-
135
- | Aspect | Analysis Content |
136
- |--------|------------------|
137
- | **Frontend Changes** | New pages, components, or modifications to existing UI |
138
- | **Backend Changes** | New interfaces or modifications to existing logic |
139
- | **Data Changes** | New data structures or modifications to existing data |
140
- | **System Relationship** | How this relates to existing system capabilities |
141
-
142
- ### Mark Relationship to Existing System
143
-
144
- | Marker | Meaning | Example |
145
- |--------|---------|---------|
146
- | `[EXISTING]` | Reuse current system capability | `[EXISTING] User authentication system` |
147
- | `[MODIFIED]` | Enhance/change existing feature | `[MODIFIED] Add validation to user profile form` |
148
- | `[NEW]` | Create brand new functionality | `[NEW] Order management module` |
149
-
150
- **Checkpoint A: Present function breakdown to user for confirmation before proceeding.**
151
-
152
- Ask: "Here is the function breakdown with [EXISTING]/[MODIFIED]/[NEW] markers. Does this align with your understanding of the requirements?"
153
-
154
- ### Checkpoint A Progress Update
155
-
156
- After user confirms the function breakdown:
157
-
158
- 1. **Write/Update `.checkpoints.json`**:
159
- - Path: `speccrew-workspace/iterations/{iteration-id}/02.feature-design/.checkpoints.json`
160
- - Content:
161
- ```json
162
- {
163
- "stage": "02_feature_design",
164
- "checkpoints": {
165
- "function_decomposition": {
166
- "passed": true,
167
- "confirmed_at": "{current_timestamp}",
168
- "description": "Function decomposition confirmed"
169
- },
170
- "feature_spec_review": {
171
- "passed": false,
172
- "confirmed_at": null
173
- },
174
- "api_contract_joint": {
175
- "passed": false,
176
- "confirmed_at": null
177
- }
178
- }
179
- }
180
- ```
181
-
182
- 2. If the file already exists, merge with existing content (preserve other checkpoints)
183
-
184
- 3. Log: "✅ Checkpoint A (function_decomposition) passed and recorded"
185
-
186
- ## Step 4: Determine Output Structure
187
-
188
- ### 4.1 Single Feature Output (when feature_id provided)
189
-
190
- When processing a single Feature:
191
-
192
- | Output | Description |
193
- |--------|-------------|
194
- | **Single File** | One Feature Spec document for this Feature only |
195
- | **File Naming** | `[feature-id]-[feature-name]-feature-spec.md` |
196
- | **Example** | `F-CRM-01-customer-list-feature-spec.md` |
197
-
198
- **No Master-Sub structure** for single Feature mode.
199
-
200
- ### 4.2 Legacy Output (backward compatibility)
201
-
202
- When `feature_id` is NOT provided:
203
-
204
- | PRD Structure | Feature Spec Structure |
205
- |---------------|------------------------|
206
- | **Single PRD** | Single Feature Spec |
207
- | **Master-Sub PRD** | Master Feature Spec + Sub Feature Specs (one per module) |
208
-
209
- #### Master Feature Spec Structure (Legacy)
210
-
211
- ```
212
- 02.feature-design/
213
- ├── [feature-name]-feature-spec.md # Master Feature Spec (overview + cross-module)
214
- ├── [feature-name]-sub-[module1]-spec.md # Sub Feature Spec: Module 1
215
- ├── [feature-name]-sub-[module2]-spec.md # Sub Feature Spec: Module 2
216
- └── ...
217
- ```
218
-
219
- **Master Feature Spec MUST include:**
220
- - Overall feature overview and goals
221
- - Cross-module interaction diagram
222
- - Module list with scope boundaries
223
- - Cross-module interface contracts
224
- - Shared data structures
225
-
226
- **Each Sub Feature Spec covers ONE module:**
227
- - Module-specific frontend design
228
- - Module-specific backend interfaces
229
- - Module-internal data model
230
- - Interface contracts with other modules
231
-
232
- ## Step 5: Frontend Design (Per Function)
233
-
234
- ### 5.0 Conditional Execution Based on feature_type
235
-
236
- **Execution Logic:**
237
- ```
238
- IF feature_type = "Page+API" THEN
239
- → Execute Step 5 (Full frontend design)
240
- IF feature_type = "API-only" THEN
241
- → Skip Step 5 entirely (No frontend design needed)
242
- IF feature_type is NOT provided THEN
243
- → Execute Step 5 (backward compatibility)
244
- ```
245
-
246
- **Multi-Platform Rule**: If multiple frontend platforms are identified, repeat the frontend design (5.1 UI Prototype + 5.2 Interface Elements + 5.3 Interaction Flow) for EACH platform. Use platform-specific section headers:
247
-
248
- | Platforms | Section Structure |
249
- |-----------|-------------------|
250
- | Single platform | `#### 2.N.1 Frontend Prototype` (as-is) |
251
- | Multiple platforms | `#### 2.N.1 Frontend Prototype - Web` + `#### 2.N.1b Frontend Prototype - Mobile` |
252
-
253
- **Mobile-specific wireframe patterns:**
254
-
255
- > **Note**: These are ASCII wireframe design specifications, NOT actual template files in the `templates/` directory.
256
-
257
- ```
258
- Pattern M-A: Card List (replaces PC table list)
70
+ Pattern M-A: Card List
259
71
  +----------------------------------+
260
72
  | [Search...] [Filter] |
261
73
  +----------------------------------+
@@ -269,13 +81,12 @@ Pattern M-A: Card List (replaces PC table list)
269
81
  | | Subtitle / Key info | |
270
82
  | | Detail line [Action] | |
271
83
  | +----------------------------+ |
272
- | |
273
84
  | [Load More / Pull to Refresh] |
274
85
  +----------------------------------+
275
86
  | [Tab1] [Tab2] [Tab3] [Tab4] |
276
87
  +----------------------------------+
277
88
 
278
- Pattern M-B: Mobile Form (replaces PC wide form)
89
+ Pattern M-B: Mobile Form
279
90
  +----------------------------------+
280
91
  | < Back Title [Save] |
281
92
  +----------------------------------+
@@ -292,10 +103,9 @@ Pattern M-B: Mobile Form (replaces PC wide form)
292
103
  | [Switch toggle O ] |
293
104
  +----------------------------------+
294
105
 
295
- Pattern M-C: Action Sheet (replaces PC modal)
106
+ Pattern M-C: Action Sheet
296
107
  +----------------------------------+
297
108
  | (dimmed background) |
298
- | |
299
109
  | +----------------------------+ |
300
110
  | | Action Sheet Title | |
301
111
  | +----------------------------+ |
@@ -308,16 +118,11 @@ Pattern M-C: Action Sheet (replaces PC modal)
308
118
  +----------------------------------+
309
119
  ```
310
120
 
311
- For each function requiring frontend changes:
121
+ ### 2.1 UI Prototype
312
122
 
313
- ### 5.1 UI Prototype
123
+ Create ASCII wireframes showing layout, UI elements, navigation.
314
124
 
315
- Create ASCII wireframes showing:
316
- - Page/component layout
317
- - Key UI elements and their positions
318
- - Navigation structure
319
-
320
- **Example ASCII Wireframe:**
125
+ **PC Wireframe Example:**
321
126
  ```
322
127
  +--------------------------------------------------+
323
128
  | Header: User Management |
@@ -334,454 +139,168 @@ Create ASCII wireframes showing:
334
139
  +--------------------------------------------------+
335
140
  ```
336
141
 
337
- ### 5.2 Interface Element Descriptions
142
+ ### 2.2 Interface Element Descriptions
338
143
 
339
144
  | Element | Type | Behavior |
340
145
  |---------|------|----------|
341
- | {element name} | {component type} | {description of behavior} |
342
-
343
- ### 5.3 Interaction Flow
344
-
345
- Document user actions and system responses:
146
+ | {name} | {component type} | {behavior description} |
346
147
 
347
- ```
348
- User Action → Frontend Response → Backend API Call
349
- ```
148
+ ### 2.3 Interaction Flow
350
149
 
351
- > **ISA-95 Stage 4 Thinking Information Flows of Interest**
352
- > When designing interaction flows:
353
- > - **Cross-module Information Flow**: Map all data flows between this feature and other modules/systems. Identify data source, destination, format, and frequency.
354
- > - **Sequence Diagram Coverage**: The sequence diagram must cover the complete interaction chain — user action → frontend → backend → database → external systems.
355
- > - **Interface Identification**: Every data exchange point becomes a potential API endpoint. List all interface interactions with direction, format, and core fields.
356
- > - **Exception Flows**: Identify and document alternative/exception paths, not just the happy path.
357
- > These elements flow into Feature Spec Section 3 (Interaction Flow) — no separate DFD document needed.
150
+ Document: `User Action Frontend Response Backend API Call`
358
151
 
359
- **Example:**
360
- ```
361
- 1. User clicks "New User" button
362
- Frontend displays modal form
363
- No API call yet
364
-
365
- 2. User fills form and clicks "Save"
366
- → Frontend validates input
367
- → Calls POST /api/users
368
- → On success: closes modal, refreshes list
369
- → On error: displays error message
370
- ```
152
+ > **ISA-95 Stage 4 Thinking — Information Flows**
153
+ > - Cross-module flows: Map data flows between feature and other modules
154
+ > - Sequence coverage: Complete chain user→frontend→backend→database→external
155
+ > - Interface identification: Every data exchange point = potential API endpoint
156
+ > - Exception flows: Document alternative paths, not just happy path
371
157
 
372
- ### 5.4 Backend API Mapping
158
+ ### 2.4 Backend API Mapping
373
159
 
374
160
  | Frontend Action | Backend API | Purpose |
375
161
  |-----------------|-------------|---------|
376
- | {action} | {API endpoint} | {what data is exchanged} |
162
+ | {action} | {API endpoint} | {data exchanged} |
377
163
 
378
- ## Step 6: Backend Design (Per Function)
164
+ ## Step 3: Backend Design (Per Function)
379
165
 
380
- For each function requiring backend changes:
381
-
382
- ### 6.1 API/Interface List
166
+ ### 3.1 API/Interface List
383
167
 
384
168
  | Interface | Method | Description |
385
169
  |-----------|--------|-------------|
386
- | {name} | {GET/POST/PUT/DELETE} | {purpose, no technical implementation details} |
387
-
388
- ### 6.2 Processing Logic Flow
170
+ | {name} | {GET/POST/PUT/DELETE} | {purpose} |
389
171
 
390
- For each interface, document:
172
+ ### 3.2 Processing Logic Flow
391
173
 
392
174
  | Stage | Description |
393
175
  |-------|-------------|
394
- | **Input Validation** | What business rules validate the input |
395
- | **Business Logic** | Core processing steps (conceptual, not code) |
396
- | **Data Operations** | What data to read/write |
397
- | **Response** | What data to return |
398
-
399
- **Example:**
400
- ```
401
- Interface: Create Order
176
+ | Input Validation | Business rules validating input |
177
+ | Business Logic | Core processing steps (conceptual) |
178
+ | Data Operations | What data to read/write |
179
+ | Response | What data to return |
402
180
 
403
- Input Validation:
404
- - User must be authenticated
405
- - Product must be available
406
- - Quantity must be positive
407
-
408
- Business Logic:
409
- 1. Check product inventory
410
- 2. Calculate total price
411
- 3. Create order record
412
- 4. Reserve inventory
413
-
414
- Data Operations:
415
- - Read: product info, inventory count
416
- - Write: order record, inventory reservation
417
-
418
- Response:
419
- - Order ID, status, estimated delivery
420
- ```
421
-
422
- ### 6.3 Data Access Scheme
181
+ ### 3.3 Data Access Scheme
423
182
 
424
183
  | Operation | Data Target | Type |
425
184
  |-----------|-------------|------|
426
- | Read | {existing/new data} | [EXISTING]/[NEW] |
427
- | Write | {existing/new data} | [EXISTING]/[NEW] |
428
-
429
- ### 6.4 Cross-Module Interactions
185
+ | Read | {data} | [EXISTING]/[NEW] |
186
+ | Write | {data} | [EXISTING]/[NEW] |
430
187
 
431
- **[Cross-module functions only]**
188
+ ### 3.4 Cross-Module Interactions
432
189
 
433
190
  | This Module | Interacts With | Interface | Data Exchanged |
434
191
  |-------------|----------------|-----------|----------------|
435
192
  | {module} | {other module} | {API/Event} | {what data} |
436
193
 
437
- ## Step 7: Data Model Design
194
+ ## Step 4: Data Model Design
438
195
 
439
- ### 7.1 New Data Structures
440
-
441
- For each new entity:
196
+ ### 4.1 New Data Structures
442
197
 
443
198
  | Field | Type | Constraints | Description |
444
199
  |-------|------|-------------|-------------|
445
- | {field name} | {data type} | {required/unique/etc} | {purpose} |
200
+ | {field} | {data type} | {required/unique} | {purpose} |
446
201
 
447
202
  > **ISA-95 Stage 5 Thinking — Categories of Information**
448
- > When defining data fields:
449
- > - **Information Classification**: Categorize data entities (master data, transactional data, reference data, computed data). This determines storage strategy and update frequency.
450
- > - **Data Dictionary Rigor**: Every field must have: name, type, constraints, semantic description, and data source.
451
- > - **Semantic Consistency**: Field names and definitions must align with the domain glossary established in the PRD clarification phase. No "同物异名" (same thing, different names).
452
- > - **Entity Relationships**: Identify core entity relationships (1:1, 1:N, N:N) that will drive database design downstream.
453
- > These elements flow into Feature Spec Section 4 (Data Field Definition) — no separate data dictionary document needed.
203
+ > - Classification: Categorize data (master, transactional, reference, computed)
204
+ > - Dictionary rigor: Every field needs name, type, constraints, semantic description
205
+ > - Semantic consistency: Align with domain glossary
206
+ > - Relationships: Identify core relationships (1:1, 1:N, N:N)
454
207
 
455
- ### 7.2 Modifications to Existing Data Structures
208
+ ### 4.2 Modifications to Existing Data Structures
456
209
 
457
210
  | Entity | Change Type | Details | Impact |
458
211
  |--------|-------------|---------|--------|
459
- | {entity} | Add field / Modify field / Remove field | {description} | {affected areas} |
212
+ | {entity} | Add/Modify/Remove field | {description} | {affected areas} |
460
213
 
461
- ### 7.3 Data Relationships
214
+ ### 4.3 Data Relationships
462
215
 
463
- **New Entity Relationships:**
464
- ```
465
- EntityA --1:N--> EntityB
466
- EntityA --N:1--> EntityC
467
- ```
216
+ **New Relationships:** `EntityA --1:N--> EntityB`
468
217
 
469
- **Relationships with Existing Entities:**
470
218
  | New Entity | Existing Entity | Relationship |
471
219
  |------------|-----------------|--------------|
472
220
  | {new} | {existing} | {1:1 / 1:N / N:M} |
473
221
 
474
- ### 7.4 Data Source Descriptions
222
+ ### 4.4 Data Source Descriptions
475
223
 
476
224
  | Data | Source | Update Frequency |
477
225
  |------|--------|------------------|
478
- | {data item} | {internal system / external API / user input} | {real-time / periodic / on-demand} |
226
+ | {item} | {internal/external/user} | {real-time/periodic/on-demand} |
479
227
 
480
- ## Step 8: Business Rules and Constraints
228
+ ## Step 5: Business Rules and Constraints
481
229
 
482
230
  > **ISA-95 Stage 6 Thinking — Information Descriptions**
483
- > When defining business rules and constraints:
484
- > - **Validation Rules**: Define field-level validation (format, range, required), cross-field validation, and business logic validation.
485
- > - **Output Format Standards**: Specify information output format (JSON for API, specific encoding), ensuring consistency with downstream API Contract.
486
- > - **Permission Rules**: Define data access permissions that will map to API authorization logic.
487
- > - **Traceability**: Every business rule should trace back to a PRD requirement. Every data field should trace to a user story.
488
- > These elements flow into Feature Spec Section 5 (Business Rules) and prepare the foundation for API Contract generation.
231
+ > - Validation: Field-level, cross-field, business logic rules
232
+ > - Output standards: Format specifications for downstream API Contract
233
+ > - Permissions: Data access rules mapping to API authorization
234
+ > - Traceability: Every rule traces back to PRD requirement
489
235
 
490
- ### 8.1 Permission Rules
236
+ ### 5.1 Permission Rules
491
237
 
492
238
  | Function | Required Permission | Scope |
493
239
  |----------|---------------------|-------|
494
- | {function} | {permission name} | {global / module-specific / resource-specific} |
240
+ | {function} | {permission} | {global/module/resource-specific} |
495
241
 
496
- ### 8.2 Business Logic Rules
242
+ ### 5.2 Business Logic Rules
497
243
 
498
244
  | Rule ID | Description | Trigger | Action |
499
245
  |---------|-------------|---------|--------|
500
- | BR-{number} | {rule description} | {when it applies} | {what happens} |
246
+ | BR-{number} | {description} | {when applies} | {what happens} |
501
247
 
502
- ### 8.3 Validation Rules
248
+ ### 5.3 Validation Rules
503
249
 
504
250
  | Field | Frontend Validation | Backend Validation |
505
251
  |-------|---------------------|---------------------|
506
- | {field} | {client-side rules} | {server-side rules} |
507
-
508
- ## Step 9: Present Complete Feature Spec for Confirmation (Checkpoint B)
509
-
510
- Present summary to user before writing files:
511
-
512
- ### Summary Structure
513
-
252
+ | {field} | {client rules} | {server rules} |
253
+
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]
514
303
  ```
515
- Feature Design Summary for: {feature-name}
516
-
517
- Functions Designed: {count}
518
- ├── [EXISTING] {count} functions reuse existing capabilities
519
- ├── [MODIFIED] {count} functions enhance existing features
520
- └── [NEW] {count} functions are brand new
521
-
522
- Frontend Components: {count} pages/components
523
- Backend Interfaces: {count} APIs
524
- Data Entities: {count} new, {count} modified
525
-
526
- Output File: {filename}
527
- ```
528
-
529
- **Ask user to confirm:**
530
- 1. Is the frontend prototype appropriate for user needs? (if applicable)
531
- 2. Is the backend logic flow correct and complete?
532
- 3. Is the data model reasonable and extensible?
533
- 4. Are all business rules and constraints captured?
534
- 5. **[Legacy Master-Sub]** Is the module breakdown appropriate?
535
-
536
- ### Checkpoint B Progress Update
537
-
538
- After user confirms the complete feature spec:
539
-
540
- 1. **Update `.checkpoints.json`**:
541
- - Path: `speccrew-workspace/iterations/{iteration-id}/02.feature-design/.checkpoints.json`
542
- - Update content:
543
- ```json
544
- {
545
- "stage": "02_feature_design",
546
- "checkpoints": {
547
- "function_decomposition": {
548
- "passed": true,
549
- "confirmed_at": "..."
550
- },
551
- "feature_spec_review": {
552
- "passed": true,
553
- "confirmed_at": "{current_timestamp}",
554
- "description": "Feature specification confirmed"
555
- },
556
- "api_contract_joint": {
557
- "passed": false,
558
- "confirmed_at": null
559
- }
560
- }
561
- }
562
- ```
563
-
564
- 2. Preserve `function_decomposition` checkpoint status when updating
565
-
566
- 3. Log: "✅ Checkpoint B (feature_spec_review) passed and recorded"
567
-
568
- ## Step 10: Write Files
569
-
570
- ### 10.1 Determine Output Paths
571
-
572
- #### Single Feature Mode (when feature_id provided)
573
-
574
- ```
575
- speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md
576
- ```
577
-
578
- **Naming Rules:**
579
- - `feature-id`: As provided in input (e.g., `F-CRM-01`)
580
- - `feature-name`: Converted to kebab-case (lowercase with hyphens)
581
- - **Example**: `F-CRM-01-customer-list-feature-spec.md`
582
-
583
- #### Legacy Mode (backward compatibility)
584
-
585
- **Single Feature Spec:**
586
- ```
587
- speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/[feature-name]-feature-spec.md
588
- ```
589
-
590
- **Master-Sub Feature Specs:**
591
- ```
592
- speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/
593
- ├── [feature-name]-feature-spec.md
594
- ├── [feature-name]-sub-[module1]-spec.md
595
- ├── [feature-name]-sub-[module2]-spec.md
596
- └── ...
597
- ```
598
-
599
- If the iteration directory does not exist, refer to the `000-sample` directory structure to create it.
600
-
601
- ### 10.2a Copy Template to Document Path
602
-
603
- 1. **Read the template file**: `templates/FEATURE-SPEC-TEMPLATE.md`
604
- 2. **Replace top-level placeholders** in the template content:
605
- - `{Feature Name}` → actual feature name
606
- - Other top-level identifiers from PRD input
607
- 3. **Create the document file** using `create_file`:
608
- - Target path: determined in Step 10.1
609
- - Content: Template with top-level placeholders replaced
610
- 4. **Verify**: Document should have complete section structure ready for filling
611
-
612
- ### 10.2b Fill Each Section Using search_replace
613
-
614
- Fill each section of the document with actual data from analysis steps.
615
-
616
- > ⚠️ **CRITICAL CONSTRAINTS:**
617
- > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
618
- > - **MUST use `search_replace` to fill each section individually**
619
- > - **All section titles and numbering MUST be preserved** — do not delete or renumber
620
- > - If a section has no applicable content, keep the section title and replace placeholder with "N/A"
621
-
622
- **Section Filling Order:**
623
-
624
- Fill sections sequentially using `search_replace` for each content block:
625
-
626
- | Section | Content Source |
627
- |---------|---------------|
628
- | **Feature Overview** | One paragraph explaining what this feature does |
629
- | **Function Breakdown** | All functions with [EXISTING]/[MODIFIED]/[NEW] markers |
630
- | **Frontend Design** | ASCII wireframes, interaction flows, API mapping |
631
- | **Backend Design** | Interface list, logic flows, data access schemes |
632
- | **Data Model** | Entity definitions, relationships, modifications |
633
- | **Business Rules** | Permissions, validation, business logic rules |
634
- | **Cross-Module Interactions** | **[If applicable]** Interface contracts between modules |
635
-
636
- For legacy Master-Sub specs (when feature_id not provided), repeat Step 10.2a + 10.2b for each sub-spec document.
637
-
638
- ### 10.3 Mermaid Diagram Requirements
639
-
640
- When generating Mermaid diagrams (architecture diagrams, flow diagrams, etc.), you **MUST** follow the compatibility guidelines defined in:
641
- - **Reference**: `speccrew-workspace/docs/rules/mermaid-rule.md`
642
-
643
- Key requirements:
644
- - Use only basic node definitions: `A[text content]`
645
- - No HTML tags (e.g., `<br/>`)
646
- - No nested subgraphs
647
- - No `direction` keyword
648
- - No `style` definitions
649
- - No special characters in node text
650
- - Use standard `graph TB/LR` or `sequenceDiagram` syntax only
651
-
652
- ### 10.4 Call API Contract Skill
653
-
654
- After feature spec documents are complete, call `speccrew-fd-api-contract/SKILL.md` to generate API contract document.
655
-
656
- ### 10.5 Multi-Platform Dispatch Progress Management
657
-
658
- **For multi-platform feature design (multiple frontend platforms):**
659
-
660
- #### 10.5.1 Pre-Dispatch: Check Resume State
661
-
662
- Before dispatching to multiple platforms:
663
-
664
- 1. **Read existing `DISPATCH-PROGRESS.json`**:
665
- - Path: `speccrew-workspace/iterations/{iteration-id}/02.feature-design/DISPATCH-PROGRESS.json`
666
- - If exists, analyze task status:
667
- ```json
668
- {
669
- "stage": "02_feature_design",
670
- "total": 3,
671
- "completed": 2,
672
- "failed": 0,
673
- "pending": 1,
674
- "tasks": [
675
- {
676
- "id": "fd-web-vue",
677
- "platform": "web-vue",
678
- "skill": "speccrew-fd-feature-design",
679
- "status": "completed",
680
- "started_at": "...",
681
- "completed_at": "...",
682
- "output": "02.feature-design/[feature]-web-vue-feature-spec.md",
683
- "error": null
684
- }
685
- ]
686
- }
687
- ```
688
-
689
- 2. **Resume Strategy**:
690
- - Skip tasks with `status == "completed"`
691
- - Re-execute tasks with `status == "failed"`
692
- - Execute tasks with `status == "pending"`
693
-
694
- #### 10.5.2 Initialize/Update Dispatch Progress
695
-
696
- Create or update `DISPATCH-PROGRESS.json` before starting dispatch:
697
-
698
- ```json
699
- {
700
- "stage": "02_feature_design",
701
- "total": {count},
702
- "completed": 0,
703
- "failed": 0,
704
- "pending": {count},
705
- "tasks": [
706
- {
707
- "id": "fd-{platform}",
708
- "platform": "{platform}",
709
- "skill": "speccrew-fd-feature-design",
710
- "status": "pending",
711
- "started_at": null,
712
- "completed_at": null,
713
- "output": null,
714
- "error": null
715
- }
716
- ]
717
- }
718
- ```
719
-
720
- #### 10.5.3 Update Task Status on Completion
721
-
722
- After each worker completes:
723
-
724
- 1. **Read current `DISPATCH-PROGRESS.json`**
725
-
726
- 2. **Update the corresponding task entry**:
727
- - On success:
728
- ```json
729
- {
730
- "status": "completed",
731
- "completed_at": "{timestamp}",
732
- "output": "{output_file_path}"
733
- }
734
- ```
735
- - On failure:
736
- ```json
737
- {
738
- "status": "failed",
739
- "completed_at": "{timestamp}",
740
- "error": "{error_message}"
741
- }
742
- ```
743
-
744
- 3. **Update summary counters** (`completed`, `failed`, `pending`)
745
-
746
- 4. **Write updated `DISPATCH-PROGRESS.json`**
747
-
748
- 5. Log progress: "📊 Dispatch progress: {completed}/{total} completed, {failed} failed, {pending} pending"
749
-
750
- ---
751
-
752
- # Reference Guides
753
-
754
- ## Backward Compatibility Details (Legacy Mode)
755
-
756
- When `feature_id` is NOT provided, the skill operates in legacy mode:
757
-
758
- ### Master-Sub PRD Structure
759
-
760
- If master PRD exists, also read all sub PRDs:
761
- - Master PRD: `[feature-name]-prd.md`
762
- - Sub PRDs: `[feature-name]-sub-[module1].md`, `[feature-name]-sub-[module2].md`, etc.
763
-
764
- ### Output Structure (Legacy)
765
-
766
- **Single Feature Spec:**
767
- ```
768
- speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/[feature-name]-feature-spec.md
769
- ```
770
-
771
- **Master-Sub Feature Specs:**
772
- ```
773
- 02.feature-design/
774
- ├── [feature-name]-feature-spec.md # Master Feature Spec (overview + cross-module)
775
- ├── [feature-name]-sub-[module1]-spec.md # Sub Feature Spec: Module 1
776
- ├── [feature-name]-sub-[module2]-spec.md # Sub Feature Spec: Module 2
777
- ```
778
-
779
- **Master Feature Spec MUST include:**
780
- - Overall feature overview and goals
781
- - Cross-module interaction diagram
782
- - Module list with scope boundaries
783
- - Cross-module interface contracts
784
- - Shared data structures
785
304
 
786
305
  ---
787
306
 
@@ -789,36 +308,23 @@ speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/[feature-
789
308
 
790
309
  | Rule | Description |
791
310
  |------|-------------|
792
- | **No Technology Decisions** | Do NOT specify frameworks, databases, or implementation technologies |
793
- | **Focus on WHAT not HOW** | Describe what the system does, not how it's technically implemented |
794
- | **ASCII Wireframes Only** | Use ASCII art for UI prototypes, not specific design tools |
795
- | **Mermaid Compatibility** | All diagrams must follow mermaid-rule.md guidelines |
796
- | **Clear Markers** | Always use [EXISTING]/[MODIFIED]/[NEW] to indicate system relationship |
797
- | **Checkpoint Before Write** | Always get user confirmation at Checkpoint B before writing files |
311
+ | No Technology Decisions | Do NOT specify frameworks, databases, technologies |
312
+ | Focus on WHAT not HOW | Describe what system does, not how it's implemented |
313
+ | ASCII Wireframes Only | Use ASCII art for UI prototypes |
314
+ | Mermaid Compatibility | Follow mermaid-rule.md guidelines |
315
+ | Clear Markers | Use [EXISTING]/[MODIFIED]/[NEW] markers |
798
316
 
799
317
  # Checklist
800
318
 
801
- - [ ] PRD has been read, all P0 requirements covered
802
- - [ ] **[Single Feature Mode]** Feature ID and name parameters received
803
- - [ ] **[Single Feature Mode]** Only related Feature content extracted from PRD
804
- - [ ] **[Legacy Mode]** All sub PRDs have been read (if master-sub structure)
805
- - [ ] System overview loaded for context
806
- - [ ] Related module overviews loaded
807
- - [ ] **[Cross-module]** Knowledge graph queried for relationship analysis
808
- - [ ] Function breakdown completed with [EXISTING]/[MODIFIED]/[NEW] markers
809
- - [ ] **[Single Feature Mode]** 3-8 focused Functions defined
810
- - [ ] Checkpoint A passed: function breakdown confirmed with user
811
- - [ ] Output structure determined (single file for Feature mode)
812
- - [ ] **[API-only]** Frontend design step skipped correctly
813
- - [ ] **[Page+API]** Frontend design includes ASCII wireframes and interaction flows
814
- - [ ] **[Multi-platform]** Each frontend platform has separate wireframes and interaction flows
815
- - [ ] Backend design includes interface list and logic flows
816
- - [ ] Data model includes new entities and modifications to existing
817
- - [ ] Business rules and constraints documented
818
- - [ ] Checkpoint B passed: complete feature spec confirmed with user
819
- - [ ] **[Legacy Master-Sub]** Master spec includes cross-module overview and contracts
820
- - [ ] **[Legacy Master-Sub]** Each sub spec covers exactly one module
821
- - [ ] All Mermaid diagrams follow mermaid-rule.md
822
- - [ ] No specific technology decisions included
823
- - [ ] Files written to correct paths with proper naming (`{feature-id}-{feature-name}-feature-spec.md`)
824
- - [ ] API contract skill called after writing
319
+ - [ ] `.feature-analysis.md` verified
320
+ - [ ] Checkpoint A passed
321
+ - [ ] Output structure determined
322
+ - [ ] **[API-only]** Frontend design skipped
323
+ - [ ] **[Page+API]** ASCII wireframes and flows included
324
+ - [ ] **[Multi-platform]** Per-platform designs
325
+ - [ ] Backend interfaces and logic documented
326
+ - [ ] Data model with entities and modifications
327
+ - [ ] Business rules documented
328
+ - [ ] ISA-95 Stage 4/5/6 thinking applied
329
+ - [ ] `.feature-design-data.md` created
330
+ - [ ] No technology decisions included