speccrew 0.7.30 → 0.7.32

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,26 +1,29 @@
1
1
  ---
2
2
  name: speccrew-fd-feature-design
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.
3
+ description: Unified Feature Analysis & Design SOP. Performs complete feature analysis (read PRD, load system knowledge, function breakdown with [NEW]/[MODIFIED]/[EXISTING] markers) followed by detailed design (frontend/backend/data) and generates complete Feature Spec document using template-first workflow. Combines analysis and design in a single unified workflow without producing intermediate analysis artifacts. Use when Feature Designer needs to analyze PRD requirements and produce Feature Spec in one pass.
4
4
  tools: Read, Write, Glob, Grep, search_replace
5
5
  ---
6
6
 
7
7
  # Methodology Foundation
8
8
 
9
- ISA-95 Stages 4-6 as internal thinking framework:
9
+ This skill applies ISA-95 Stages 1-6 as an internal thinking framework:
10
10
 
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 |
11
+ | ISA-95 Stage | Phase | Purpose |
12
+ |--------------|-------|---------|
13
+ | Stage 1: Domain Description | Analysis | Understand business context, scope boundaries, glossary |
14
+ | Stage 2: Information Flows | Analysis | Identify data sources, destinations, and cross-module exchanges |
15
+ | Stage 3: Categories of Information | Analysis | Classify data entities and establish information hierarchy |
16
+ | Stage 4: Information Flows | Design | Map cross-module data flows, identify API endpoints |
17
+ | Stage 5: Categories of Information | Design | Classify data entities, build data dictionary |
18
+ | Stage 6: Information Descriptions | Design | Define validation rules, output standards, traceability |
16
19
 
17
20
  > No separate modeling documents. Methodology guides thinking quality.
18
21
 
19
22
  # Trigger Scenarios
20
23
 
21
- - Function decomposition completed (`.feature-analysis.md` exists)
22
- - Checkpoint A passed (function breakdown confirmed)
23
- - Feature Spec document generation needed
24
+ - PRD has been confirmed, user requests to start feature analysis and design
25
+ - Feature Designer Agent needs to analyze PRD and produce Feature Spec in one pass
26
+ - User asks "Design this feature" or "Analyze and design this requirement"
24
27
 
25
28
  ## AgentFlow Definition
26
29
 
@@ -30,11 +33,24 @@ ISA-95 Stages 4-6 as internal thinking framework:
30
33
 
31
34
  ## Workflow
32
35
 
36
+ **MANDATORY:**
37
+ - **Business Perspective Only** — Feature Analysis is a PURE BUSINESS document. It describes WHAT the system does from a business/user perspective, NOT HOW it's technically implemented.
38
+ - **Mermaid for all diagrams** — ALL business flows, interaction sequences, and cross-function flows MUST use Mermaid syntax (`flowchart TB`, `sequenceDiagram`). Plain text ASCII flowcharts are FORBIDDEN.
39
+
33
40
  ## Absolute Constraints
34
41
 
42
+ > **Violation = task failure**
43
+
35
44
  **ABORT CONDITIONS:**
36
- - `.feature-analysis.md` missing OR Checkpoint A not passed → HARD STOP
45
+ - PRD document missing → HARD STOP
37
46
  - Template file missing → HARD STOP
47
+ - System overview missing → HARD STOP
48
+
49
+ 1. **FORBIDDEN: Script execution failure** — If `update-progress.js` fails, HARD STOP and report error
50
+ 2. **FORBIDDEN: Hand-written `.checkpoints.json`** — ALWAYS use `update-progress.js` script
51
+ 3. **FORBIDDEN: Skip Checkpoint A** — User confirmation required before proceeding to design phase (unless `skip_analysis_checkpoint=true`)
52
+ 4. **FORBIDDEN: Skip Checkpoint B** — User confirmation required before generating documents (unless `skip_checkpoint=true`)
53
+ 5. **FORBIDDEN: Rename features** — Output filename MUST use the exact `feature_name` parameter value. DO NOT translate, abbreviate, paraphrase, or substitute with alternative names found in PRD content. The `feature_name` parameter is the SINGLE SOURCE OF TRUTH for file naming.
38
54
 
39
55
  ⛔ **ABSOLUTE PROHIBITION — Phase B Content Filling:**
40
56
  - NEVER use `create_file` to rewrite or recreate the document after Step 5 skeleton creation
@@ -46,48 +62,160 @@ ISA-95 Stages 4-6 as internal thinking framework:
46
62
  - Template-first workflow — Step 5 (copy template) MUST precede Step 6 (fill content)
47
63
  - **Mermaid for all diagrams** — ALL interaction flows, processing logic flows, and cross-function sequences MUST use Mermaid syntax (`sequenceDiagram`, `flowchart TD`). Plain text ASCII flowcharts are FORBIDDEN for these sections. Reference: `speccrew-workspace/docs/rules/mermaid-rule.md`.
48
64
 
49
- **NOTE:** Design process is internal — no intermediate design-data files are produced.
65
+ **NOTE:** Analysis and design process is internal — no intermediate analysis or design-data files are produced.
50
66
 
51
67
  **FORBIDDEN: Rename features** — Output filename MUST use the exact `feature_name` parameter value. DO NOT translate, abbreviate, paraphrase, or substitute with names derived from analysis content. The `feature_name` parameter is the SINGLE SOURCE OF TRUTH for file naming.
52
68
 
53
- ## Step 0: Precondition Check
54
-
55
- ### Step 0 Input Parameters
69
+ ## Step 0: Input Parameters
56
70
 
57
71
  | Parameter | Required | Description |
58
72
  |-----------|----------|-------------|
59
- | `feature_analysis_path` | Yes | Path to `.feature-analysis.md` |
60
73
  | `prd_path` | Yes | Path to the Sub-PRD document |
61
74
  | `feature_id` | No | Feature identifier (e.g., `F-CRM-01`) |
62
- | `feature_name` | No | Feature name in English |
75
+ | `feature_name` | No | Feature name in English (e.g., `customer-list`) |
63
76
  | `feature_type` | No | `Page+API` or `API-only` |
64
- | `frontend_platforms` | No | List of frontend platforms |
65
- | `output_path` | No | Custom output path for Feature Spec (auto-generated if not provided) |
77
+ | `iteration_id` | No | Current iteration identifier |
78
+ | `frontend_platforms` | No | List of frontend platforms (auto-discover if not provided) |
79
+ | `skip_analysis_checkpoint` | No | Boolean, default `false`. Skip Checkpoint A if `true` (batch mode) |
66
80
  | `skip_checkpoint` | No | Boolean, default `false`. Skip Checkpoint B if `true` (batch mode) |
81
+ | `output_path` | No | Custom output path for Feature Spec (auto-generated if not provided) |
82
+
83
+ ## Step 0.1: Read PRD Input
84
+
85
+ ### 0.1.1 Read PRD
86
+
87
+ Read the PRD document at `{prd_path}` (typically `speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/[module-name]-prd.md`)
88
+
89
+ ### 0.1.2 Focus on Specific Feature (when feature_id provided)
90
+
91
+ If `feature_id` is provided:
92
+ - Locate the specific Feature in PRD Section 3.4 "Feature Breakdown"
93
+ - Extract only the user stories and requirements related to this Feature
94
+ - Ignore other Features in the same PRD
95
+
96
+ ### 0.1.3 Backward Compatibility (when feature_id not provided)
97
+
98
+ If `feature_id` is NOT provided, process entire PRD using legacy mode.
99
+
100
+ ## Step 0.2: Load System Knowledge
101
+
102
+ ### 0.2.1 Read System Overview
103
+
104
+ Read: `speccrew-workspace/knowledges/bizs/system-overview.md`
105
+
106
+ ### 0.2.2 Load Related Module Overviews
107
+
108
+ Based on PRD content, identify related modules and read:
109
+ ```
110
+ speccrew-workspace/knowledges/bizs/{module-name}/{module-name}-overview.md
111
+ ```
112
+
113
+ ### 0.2.3 Discover Frontend Platforms
114
+
115
+ Read `speccrew-workspace/knowledges/techs/techs-manifest.json` to identify frontend platforms:
116
+
117
+ | Platform Type | Examples |
118
+ |---------------|----------|
119
+ | `web-*` | web-vue, web-react |
120
+ | `mobile-*` | mobile-uniapp, mobile-flutter |
121
+
122
+ - If `frontend_platforms` parameter provided, use that list
123
+ - Otherwise, read techs-manifest.json directly
124
+
125
+ ### 0.2.4 Query Knowledge Graph (Optional)
126
+
127
+ If cross-module relationships need analysis, use `speccrew-knowledge-graph-query` skill.
128
+
129
+ ## Step 0.3: Function Breakdown
67
130
 
68
- ### Step 0 Actions
131
+ Break down PRD functional requirements into implementable system functions.
69
132
 
70
- 1. Read `.feature-analysis.md` at `feature_analysis_path`
71
- 2. Verify Checkpoint A: `function_decomposition.passed == true`
72
- 3. IF not passed → ABORT: `ERROR: Checkpoint A not passed. Run speccrew-fd-feature-analysis first.`
73
- 4. Extract key data:
74
- - `feature_id`: From analysis file or parameter
75
- - `feature_name`: From analysis file or parameter
76
- - `feature_type`: From analysis file or parameter (`Page+API` or `API-only`)
77
- - `functions[]`: Function breakdown list
78
- - `platforms[]`: Frontend platforms list
133
+ ### 0.3.1 Feature-Based Decomposition (when feature_id provided)
79
134
 
80
- ### 0.3 Verify Feature Name Consistency
135
+ When processing a single Feature:
81
136
 
82
- 1. Read the `Feature Name` field from `.feature-analysis.md` header
83
- 2. Compare with `feature_name` parameter
84
- 3. If different:
85
- - Log: "⚠️ Name discrepancy: parameter='{feature_name}', analysis='{analysis_name}'"
86
- - Continue with `feature_name` parameter value for all file naming
87
- - Use the analysis file's actual content (not its filename) for design work
137
+ 1. **Extract Feature Scope**: From PRD Section 3.4, locate the specific Feature by `feature_id`
138
+ 2. **Identify Related User Stories**: Extract only user stories mapped to this Feature
139
+ 3. **Decompose into Functions**: Break down into 3-8 focused Functions
140
+ 4. **Check feature_type**: Mark `API-only` for backend-only design
141
+
142
+ ### 0.3.2 Full PRD Decomposition (backward compatibility)
143
+
144
+ When `feature_id` is NOT provided (legacy mode):
145
+ - Decompose entire PRD into all required Functions
146
+ - May result in 10-20 Functions for complex modules
147
+
148
+ ### 0.3.3 Function Analysis
149
+
150
+ For each function, identify:
151
+
152
+ | Aspect | Analysis Content |
153
+ |--------|------------------|
154
+ | **Frontend Changes** | New pages, components, or modifications to existing UI |
155
+ | **Backend Changes** | New interfaces or modifications to existing logic |
156
+ | **Data Changes** | New data structures or modifications to existing data |
157
+ | **System Relationship** | How this relates to existing system capabilities |
158
+
159
+ ### Mark Relationship to Existing System
160
+
161
+ | Marker | Meaning | Example |
162
+ |--------|---------|---------|
163
+ | `[EXISTING]` | Reuse current system capability | `[EXISTING] User authentication system` |
164
+ | `[MODIFIED]` | Enhance/change existing feature | `[MODIFIED] Add validation to user profile form` |
165
+ | `[NEW]` | Create brand new functionality | `[NEW] Order management module` |
166
+
167
+ ## Step 0.4: Checkpoint A — Function Breakdown Confirmation
168
+
169
+ **Conditional Execution:** If `skip_analysis_checkpoint=true`, skip user confirmation and proceed to Step 1.
170
+
171
+ If `skip_analysis_checkpoint=false` (default):
172
+ 1. Present function breakdown with [EXISTING]/[MODIFIED]/[NEW] markers to user
173
+ 2. Ask: "Does this function breakdown align with your understanding of the requirements?"
174
+ 3. **HARD STOP** — Wait for user confirmation before proceeding
175
+
176
+ ### Checkpoint A Progress Update
177
+
178
+ After user confirms (or if skipped):
179
+
180
+ ```bash
181
+ node speccrew-workspace/scripts/update-progress.js write-checkpoint \
182
+ --file speccrew-workspace/iterations/{iteration_id}/02.feature-design/.checkpoints.json \
183
+ --stage 02_feature_design \
184
+ --checkpoint function_decomposition \
185
+ --passed true
186
+ ```
187
+
188
+ Log: "✅ Checkpoint A (function_decomposition) passed and recorded"
189
+
190
+ ### OUTPUT EFFICIENCY RULES
191
+
192
+ > **MANDATORY: Direct-to-File Output**
193
+ >
194
+ > When generating Feature Spec content:
195
+ > - **DO NOT** display design content (wireframes, interaction flows, API specs, data models) in the conversation
196
+ > - **DO NOT** output intermediate design results as chat messages
197
+ > - **DO** think through the design internally, then write directly to the output file
198
+ > - **DO** only report brief status messages: "[Block X] Designing frontend for Function N..."
199
+ >
200
+ > **Rationale**: In batch mode, multiple Workers run simultaneously. Displaying full design content in chat wastes context window and creates confusion.
201
+ >
202
+ > **Allowed output in conversation**:
203
+ > - Block execution announcements (1 line each)
204
+ > - Error messages
205
+ > - Checkpoint confirmation requests (when not skipped)
206
+ > - Final completion summary (1-2 lines)
207
+ >
208
+ > **FORBIDDEN output in conversation**:
209
+ > - ASCII wireframes / UI prototypes
210
+ > - Mermaid diagrams (these go in the file only)
211
+ > - API endpoint lists
212
+ > - Data model tables
213
+ > - Full section content
88
214
 
89
215
  ## Step 1: Frontend Design
90
216
 
217
+ > ⚠️ **OUTPUT REMINDER**: Design content goes directly into the output file. DO NOT display wireframes or UI elements in conversation.
218
+
91
219
  ### 1.0 Conditional Execution
92
220
 
93
221
  `feature_type = "Page+API"` → Execute design; `feature_type = "API-only"` → Skip; Not provided → Execute (backward compatibility)
@@ -195,6 +323,8 @@ Document: `User Action → Frontend Response → Backend API Call`
195
323
 
196
324
  ## Step 2: Backend Design
197
325
 
326
+ > ⚠️ **OUTPUT REMINDER**: Backend API designs go directly into the output file. DO NOT display API lists or processing logic in conversation.
327
+
198
328
  > **CRITICAL CONSTRAINT**: Backend design in Feature Spec must remain at the BUSINESS API level:
199
329
  > - Describe API endpoints as business operations (e.g., "Create Shop" operation with business parameters)
200
330
  > - Describe business validation rules in plain language (e.g., "Shop name must be unique within tenant")
@@ -233,6 +363,8 @@ Document: `User Action → Frontend Response → Backend API Call`
233
363
 
234
364
  ## Step 3: Data Model & Business Rules
235
365
 
366
+ > ⚠️ **OUTPUT REMINDER**: Data models and business rules go directly into the output file. DO NOT display tables or validation rules in conversation.
367
+
236
368
  ### 3.1 New Data Structures
237
369
 
238
370
  | Field | Type | Constraints | Description |
@@ -379,7 +511,7 @@ Log: "✅ Checkpoint B (feature_design_review) passed and recorded"
379
511
  ### Phase A: Skeleton Construction (BEFORE any content filling)
380
512
 
381
513
  1. Read FEATURE-SPEC-TEMPLATE.md to identify the complete section structure
382
- 2. Count the number of functions from `.feature-analysis.md` input
514
+ 2. Count the number of functions from Step 0.3 function breakdown results
383
515
  3. For Section 2 Function Details, replicate the template's Function block structure for EACH function:
384
516
  - Copy the EXACT template structure (all 4 sub-sections) from FEATURE-SPEC-TEMPLATE.md
385
517
  - Create `### 2.1 Function: {function_name}` through `### 2.N Function: {function_name}`
@@ -467,8 +599,9 @@ This rule has ZERO exceptions. "Document too long" is NOT a valid reason to swit
467
599
 
468
600
  | Template Section | Data Source |
469
601
  |------------------|-------------|
470
- | 1. Overview (Basic Information, Feature Scope) | `.feature-analysis.md` Feature Information + summary |
471
- | 1.3 Relationship to Existing System | `.feature-analysis.md` System Relationships |
602
+ | 0. Feature Analysis Summary | Step 0.3 Function Breakdown results (internal memory) |
603
+ | 1. Overview (Basic Information, Feature Scope) | PRD Feature Information + Step 0 analysis summary |
604
+ | 1.3 Relationship to Existing System | Step 0.3 System Relationship markers |
472
605
  | 2. Function Details | Step 1 Frontend Design + Step 2 Backend Design results (internal) |
473
606
  | 2.1.x Frontend Prototype | Step 1.1 UI Prototype results |
474
607
  | 2.1.x Interaction Flow | Step 1.3 Interaction Flow results |
@@ -556,9 +689,17 @@ Where:
556
689
 
557
690
  | Rule | Description |
558
691
  |------|-------------|
692
+ | **Business Perspective Only (Analysis)** | Feature Analysis describes business capabilities and functional requirements. Every section must describe WHAT from user/business perspective |
559
693
  | No Technology Decisions | Do NOT specify frameworks, databases, technologies |
560
694
  | Focus on WHAT not HOW | Describe what system does, not how it's implemented |
561
695
  | ASCII Wireframes Only | Use ASCII art for UI prototypes |
696
+ | **FORBIDDEN: Analysis File Paths** | Do NOT include any file paths, code paths, or directory structures (e.g., views/appointment/AppointmentIndex.vue, yudao-module-appointment/...) |
697
+ | **FORBIDDEN: Framework Code in Analysis** | Do NOT include code snippets in any language — no Java classes, SQL DDL/DML, Vue templates, TypeScript API code, HTML markup, annotations (@PreAuthorize, @OperateLog, @TableLogic, @TableName) |
698
+ | **FORBIDDEN: Framework/Library Names in Analysis** | Do NOT reference specific framework/library names as implementation details (MyBatis-Plus, MapStruct, Element Plus, wot-design-uni, ElDatePicker, wd-cell, BaseMapperX, etc.) |
699
+ | **FORBIDDEN: Database Artifacts in Analysis** | Do NOT include database table names (appointment_info), column names (customer_id, staff_id), SQL types (BIGINT, VARCHAR), indexes, or any SQL statements |
700
+ | **FORBIDDEN: Technical Types in Analysis** | Do NOT use programming language types (Long, String, Integer). Use business types: Text, Number, Date, Boolean, Enum, Identifier |
701
+ | **FORBIDDEN: ASCII Diagrams in Analysis** | Do NOT use plain text or ASCII art flowcharts. ALL diagrams MUST use Mermaid syntax |
702
+ | **Mermaid Required** | Use `flowchart TB` for business process flows, `sequenceDiagram` for interaction flows. Reference mermaid-rule.md for syntax compliance |
562
703
  | **FORBIDDEN: File Paths** | Do NOT include any file paths, code paths, or directory structures (e.g., src/views/..., yudao-module-base/..., pages/...) |
563
704
  | **FORBIDDEN: Framework Code** | Do NOT include actual code snippets in any language — no Java classes, SQL DDL/DML, Vue templates, TypeScript API code, HTML markup |
564
705
  | **FORBIDDEN: Framework Names as Implementation** | Do NOT reference specific framework/library names as implementation choices (MyBatis-Plus, Flyway, Element Plus component names like el-button, wot-design-uni widget names like wd-cell) |
@@ -570,13 +711,23 @@ Where:
570
711
  | Clear Markers | Use [EXISTING]/[MODIFIED]/[NEW] consistently |
571
712
  | Template-First | Copy template before filling content |
572
713
  | search_replace Only | Never use create_file for section updates after template copy |
714
+ | Checkpoint A | Get user confirmation on function breakdown before design (unless skipped) |
573
715
  | Checkpoint B | Get user confirmation before writing files (unless skipped) |
574
- | No Intermediate Files | Design process is internal — do NOT output any intermediate design-data artifacts |
716
+ | No Intermediate Files | Analysis and design process is internal — do NOT output any intermediate analysis or design-data artifacts |
575
717
 
576
718
  # Checklist
577
719
 
578
- - [ ] `.feature-analysis.md` verified and exists
579
- - [ ] Checkpoint A passed (`function_decomposition.passed == true`)
720
+ - [ ] PRD has been read, all P0 requirements covered
721
+ - [ ] **[Single Feature Mode]** Feature ID and name parameters received
722
+ - [ ] **[Single Feature Mode]** Only related Feature content extracted from PRD
723
+ - [ ] **[Legacy Mode]** All sub PRDs have been read (if master-sub structure)
724
+ - [ ] System overview loaded for context
725
+ - [ ] Related module overviews loaded
726
+ - [ ] **[Cross-module]** Knowledge graph queried for relationship analysis
727
+ - [ ] Function breakdown completed with [EXISTING]/[MODIFIED]/[NEW] markers
728
+ - [ ] **[Single Feature Mode]** 3-8 focused Functions defined
729
+ - [ ] Checkpoint A passed: function breakdown confirmed with user (or skipped)
730
+ - [ ] `.checkpoints.json` updated via script for Checkpoint A
580
731
  - [ ] All input parameters resolved (feature_id, feature_name, feature_type)
581
732
  - [ ] Template file `templates/FEATURE-SPEC-TEMPLATE.md` exists
582
733
  - [ ] **[API-only]** Frontend design skipped
@@ -38,7 +38,7 @@ This Feature Spec is a PURE BUSINESS document describing WHAT the system does, N
38
38
 
39
39
  ✅ CORRECT (Business):
40
40
  Shop List Page — displays all shops with search/filter, includes "Add Shop" button (visible to Admin role only)
41
- -->
41
+ ---
42
42
 
43
43
  > **Applicable Scenario**: System feature specification for a single feature or module
44
44
  > **Target Audience**: speccrew-feature-designer, speccrew-designer, speccrew-dev
@@ -46,6 +46,27 @@ Shop List Page — displays all shops with search/filter, includes "Add Shop" bu
46
46
 
47
47
  ---
48
48
 
49
+ ## 0. Feature Analysis Summary
50
+
51
+ <!-- AI-NOTE: Auto-populated during unified analyze+design workflow.
52
+ Serves as audit trail for the analysis phase. Can be removed in final delivery.
53
+ DO NOT use this section as substitute for Sections 1-6. -->
54
+
55
+ ### 0.1 Function Breakdown
56
+
57
+ | # | Function Name | Type | System Relationship | Related User Stories |
58
+ |---|--------------|------|-------------------|---------------------|
59
+ | 1 | {function_name} | {Page+API/API-only} | {[NEW]/[MODIFIED]/[EXISTING]} | {stories} |
60
+
61
+ ### 0.2 Summary Statistics
62
+
63
+ - **Total Functions**: {count}
64
+ - **[NEW]**: {count}
65
+ - **[MODIFIED]**: {count}
66
+ - **[EXISTING]**: {count}
67
+
68
+ ---
69
+
49
70
  ## 1. Overview
50
71
 
51
72
  ### 1.1 Basic Information