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.
@@ -26,16 +26,55 @@ 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: Worker Dispatch
30
- └── 1 Feature? → Direct skill invocation
31
- └── 2+ Features? → Init DISPATCH-PROGRESS → Batch dispatch workers (6/batch)
32
- └── Error handlingRetry/skip/abort
29
+ Phase 3: Feature Design — Three-Stage Pipeline
30
+ └── 3a: Analyze (fd-feature-analyze)
31
+ └── 1 Feature? → Direct skill invocation
32
+ └── 2+ Features?Batch dispatch workers (6/batch)
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
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
33
45
 
34
46
  Phase 4: API Contract Generation
35
47
  └── Dispatch API Contract workers (same batch pattern)
36
48
  └── Joint Confirmation (HARD STOP) → Finalize stage
37
49
  ```
38
50
 
51
+ ## ORCHESTRATOR Rules
52
+
53
+ > **These rules govern the Feature Designer Agent's behavior across ALL phases. Violation = workflow failure.**
54
+
55
+ | Phase | Rule | Description |
56
+ |-------|------|-------------|
57
+ | Phase 0 | STAGE GATE | PRD must be confirmed before starting. If not → STOP |
58
+ | Phase 2 | HARD STOP | Feature Registry must be confirmed by user before Phase 3 |
59
+ | 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 |
63
+ | Phase 4 | SKILL-ONLY | API Contract workers MUST use speccrew-fd-api-contract skill |
64
+ | Phase 4 | HARD STOP | Joint Confirmation must be confirmed by user before finalizing |
65
+ | ALL | ABORT ON FAILURE | If any skill invocation fails → STOP and report. Do NOT attempt to generate content manually as fallback |
66
+ | ALL | SCRIPT ENFORCEMENT | All .checkpoints.json and WORKFLOW-PROGRESS.json updates via update-progress.js script. Manual JSON creation FORBIDDEN |
67
+
68
+ ## ABORT CONDITIONS
69
+
70
+ > **If ANY of the following conditions occur, the Feature Designer Agent MUST immediately STOP the workflow and report to user.**
71
+
72
+ 1. **Skill Invocation Failure**: Any skill call returns error → STOP. Do NOT generate content manually.
73
+ 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.
75
+ 4. **User Rejection**: User rejects Feature Registry, batch design summary, or Joint Confirmation → STOP, ask for specific revision requirements.
76
+ 5. **Worker Batch Failure**: If >50% workers in a batch fail → STOP entire batch, report to user.
77
+
39
78
  # Workflow
40
79
 
41
80
  ## Phase 0: Workflow Progress Management
@@ -66,6 +105,8 @@ Before starting any feature design work:
66
105
  node speccrew-workspace/scripts/update-progress.js update-workflow --file speccrew-workspace/iterations/{iteration-id}/WORKFLOW-PROGRESS.json --stage 02_feature_design --status in_progress
67
106
  ```
68
107
 
108
+ > **PowerShell Compatibility**: On Windows PowerShell, do not use backslash (`\`) for line continuation. Write the entire command on a single line.
109
+
69
110
  ### 0.2 Check Resume State (Checkpoint Recovery)
70
111
 
71
112
  If resuming from an interrupted session:
@@ -283,137 +324,231 @@ When involving related business domains, read `speccrew-workspace/knowledges/biz
283
324
  - Technical architecture documents (handled by speccrew-system-designer)
284
325
  - Code conventions (handled by speccrew-system-designer/speccrew-dev)
285
326
 
286
- ## Phase 3: Design — Worker Dispatch
327
+ ## Phase 3: Feature Design — Three-Stage Pipeline
287
328
 
288
329
  > ⚠️ **MANDATORY RULES FOR PHASE 3:**
289
- > 1. **DO NOT ask user which strategy to use** — the strategy is determined by Phase 2 extraction results, not user choice.
290
- > 2. **DO NOT invoke the Feature Design skill directly** when there are multiple Features. You MUST dispatch `speccrew-task-worker` agents.
291
- > 3. **Dispatch granularity is PER FEATURE, not per module.** Each Feature gets its own worker and its own output file.
292
- > 4. **DO NOT generate Feature Spec documents yourself.** Your role is to DISPATCH workers, not to write specs.
330
+ > 1. **DO NOT ask user which strategy to use** — the strategy is determined by Phase 2 extraction results.
331
+ > 2. **DO NOT invoke skills directly** when there are multiple Features. You MUST dispatch `speccrew-task-worker` agents.
332
+ > 3. **Dispatch granularity is PER FEATURE, not per module.** Each Feature gets its own worker per phase.
333
+ > 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.
293
336
 
294
- ### 3.1 Dispatch Mode Decision
337
+ ---
295
338
 
296
- Based on Phase 2 Feature Breakdown extraction:
339
+ ### Phase 3a: Analyze Function Decomposition
297
340
 
298
- | Condition | Dispatch Mode | Behavior |
299
- |-----------|---------------|----------|
300
- | 2+ Features in registry | Worker dispatch | Each Feature gets its own worker |
301
- | 1 Feature in registry | Direct skill invocation | Invoke skill directly |
341
+ **Purpose**: Decompose PRD requirements into implementable functions with system relationship markers.
302
342
 
303
- ### 3.2 Single Feature (Direct Skill Invocation)
343
+ **Skill**: `speccrew-fd-feature-analyze/SKILL.md`
304
344
 
305
- If the entire iteration has only **one Feature** in the registry:
345
+ #### Single Feature (Direct Invocation)
306
346
 
307
- Invoke Skill directly with parameters:
308
- - Skill path: `speccrew-fd-feature-design/SKILL.md`
347
+ If only **1 Feature** in registry:
348
+
349
+ - Skill path: `speccrew-fd-feature-analyze/SKILL.md`
309
350
  - Parameters:
310
- - `prd_path`: Path to the PRD document (Master PRD if exists, otherwise the single PRD)
351
+ - `prd_path`: Path to the Sub-PRD document
311
352
  - `feature_id`: Feature ID (e.g., `F-CRM-01`)
312
353
  - `feature_name`: Feature name (e.g., `Customer List Management`)
313
354
  - `feature_type`: `Page+API` or `API-only`
314
- - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature_id}-{feature-name-slug}-feature-spec.md`
355
+ - `iteration_id`: Current iteration identifier
315
356
  - `frontend_platforms`: List of frontend platforms from techs-manifest
357
+ - Wait for Checkpoint A completion (skill internal handling)
316
358
 
317
- ### 3.3 Multiple Features (Parallel Worker Dispatch)
359
+ #### Multiple Features (Worker Dispatch)
318
360
 
319
- If the iteration has **2+ Features** in the registry:
361
+ If **2+ Features** in registry:
320
362
 
321
- ⚠️ **YOU MUST dispatch `speccrew-task-worker` agents. DO NOT invoke the skill yourself.**
363
+ 1. **Initialize/Update DISPATCH-PROGRESS.json**:
364
+ ```bash
365
+ node speccrew-workspace/scripts/update-progress.js init-dispatch --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_analyze --tasks "F-CRM-01,F-CRM-02,F-CRM-03"
366
+ ```
322
367
 
323
- #### Step 1: Initialize Dispatch Progress Tracking
368
+ 2. **Dispatch Workers** (batch of 6):
369
+ - Each worker receives:
370
+ - `skill_path`: `speccrew-fd-feature-analyze/SKILL.md`
371
+ - `context`:
372
+ - `prd_path`: Path to Sub-PRD
373
+ - `feature_id`: Feature ID
374
+ - `feature_name`: Feature name
375
+ - `feature_type`: `Page+API` or `API-only`
376
+ - `iteration_id`: Current iteration
377
+ - `frontend_platforms`: Platform list
378
+ - `skip_checkpoint`: `true` (batch mode skips per-feature confirmation)
324
379
 
325
- Before dispatching workers, initialize `DISPATCH-PROGRESS.json`:
380
+ 3. **Wait for batch completion**, update progress per worker
326
381
 
327
- ```bash
328
- node speccrew-workspace/scripts/update-progress.js init-dispatch \
329
- --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json \
330
- --tasks "F-CRM-01,F-CRM-02,F-CRM-03"
331
- ```
382
+ 4. **All completed**: Agent presents function breakdown summary → **HARD STOP**
383
+ - Display summary table: Feature ID | Function Count | [EXISTING] | [MODIFIED] | [NEW]
384
+ - Ask user: "Does this function breakdown align with your understanding?"
385
+ - Wait for explicit confirmation before proceeding to Phase 3b
332
386
 
333
- Each task entry records:
334
- - `feature_id`: Feature identifier
335
- - `feature_name`: Feature name
336
- - `feature_type`: `Page+API` or `API-only`
337
- - `source_prd`: Path to the source PRD document
338
- - `status`: `pending` | `in_progress` | `completed` | `failed`
339
- - `output_path`: Path to the generated Feature Spec
387
+ **Output**: One `.feature-analysis.md` per Feature
340
388
 
341
- #### Step 2: Dispatch Workers
389
+ ---
342
390
 
343
- Invoke `speccrew-task-worker` agents in parallel, **one worker per Feature** (NOT per module):
344
- - Each worker receives:
345
- - `skill_path`: `speccrew-fd-feature-design/SKILL.md`
346
- - `context`:
347
- - `feature_id`: Feature ID (e.g., `F-CRM-01`)
348
- - `feature_name`: Feature name (e.g., `Customer List Management`)
349
- - `feature_type`: `Page+API` or `API-only`
350
- - `master_prd_path`: Path to the Master PRD document (if exists)
351
- - `source_prd_path`: Path to the Sub-PRD containing this Feature
352
- - `prd_path`: Path to the Sub-PRD containing this Feature (same as source_prd_path, required by speccrew-fd-feature-design skill)
353
- - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature_id}-{feature-name-slug}-feature-spec.md`
354
- - `frontend_platforms`: List of frontend platforms from techs-manifest
355
- - **Note**: `prd_path` and `source_prd_path` refer to the same Sub-PRD file. `prd_path` is the primary field required by the Feature Design skill.
356
-
357
- - **Parallel execution pattern**:
358
- - Worker 1: Feature F-CRM-01 → Feature Spec for Customer List
359
- - Worker 2: Feature F-CRM-02 → Feature Spec for Customer Detail
360
- - Worker N: Feature F-CRM-0N → Feature Spec for Feature N
361
-
362
- - **Batch dispatch for large feature counts**:
363
- When total features > 6, dispatch in batches to avoid overload:
364
- ```
365
- Batch 1: Dispatch up to 6 workers (Features 1-6)
366
- Wait for all workers in Batch 1 to complete
367
- Update .checkpoints.json feature_spec_status for completed features
368
-
369
- Batch 2: Dispatch next 6 workers (Features 7-12)
370
- Wait for all workers in Batch 2 to complete
371
- Update .checkpoints.json feature_spec_status for completed features
372
-
373
- ... continue until all features are processed
374
- ```
375
-
376
- **Between batches**: Report progress to user:
377
- ```
378
- 📊 Batch 1 complete: 6/44 Feature Specs generated
379
- Starting Batch 2...
380
- ```
381
-
382
- - **Dependency handling**: Features with dependencies should note them, but all workers can execute simultaneously (each Feature Spec references its dependencies)
383
-
384
- - **Output file naming convention**:
385
- - Format: `{feature-id}-{feature-name-slug}-feature-spec.md`
386
- - Example: `F-CRM-01-customer-list-feature-spec.md`
387
- - Slug: lowercase, hyphens for spaces, no special characters
388
-
389
- ### 3.4 Error Handling
390
-
391
- When a worker reports failure:
392
-
393
- 1. **Update status**: Set the failed feature's `feature_spec_status` to `failed` in `.checkpoints.json`
394
-
395
- 2. **Log error**: Record the error message in `DISPATCH-PROGRESS.json` via:
391
+ ### Phase 3b: Design Feature Specification
392
+
393
+ **Purpose**: Transform function decomposition into complete feature specifications.
394
+
395
+ **Prerequisite**: All Phase 3a outputs exist (`.feature-analysis.md` for each Feature)
396
+
397
+ **Skill**: `speccrew-fd-feature-design/SKILL.md`
398
+
399
+ #### Single Feature (Direct Invocation)
400
+
401
+ - Skill path: `speccrew-fd-feature-design/SKILL.md`
402
+ - Parameters:
403
+ - `feature_analysis_path`: Path to `.feature-analysis.md` from Phase 3a
404
+ - `prd_path`: Path to Sub-PRD
405
+ - `feature_id`: Feature ID
406
+ - `feature_name`: Feature name
407
+ - `feature_type`: `Page+API` or `API-only`
408
+ - `frontend_platforms`: Platform list
409
+
410
+ #### Multiple Features (Worker Dispatch)
411
+
412
+ 1. **Update DISPATCH-PROGRESS.json**:
413
+ ```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
415
+ ```
416
+
417
+ 2. **Dispatch Workers** (batch of 6):
418
+ - Each worker receives:
419
+ - `skill_path`: `speccrew-fd-feature-design/SKILL.md`
420
+ - `context`:
421
+ - `feature_analysis_path`: Path to `.feature-analysis.md`
422
+ - `prd_path`: Path to Sub-PRD
423
+ - `feature_id`: Feature ID
424
+ - `feature_name`: Feature name
425
+ - `feature_type`: `Page+API` or `API-only`
426
+ - `frontend_platforms`: Platform list
427
+
428
+ 3. **Wait for batch completion**, update progress
429
+
430
+ **Output**: One `.feature-design-data.md` per Feature
431
+
432
+ ---
433
+
434
+ ### Phase 3c: Confirm — Batch Design Review (Multi-Feature Only)
435
+
436
+ **Condition**: Execute ONLY when 2+ Features exist
437
+
438
+ **Purpose**: Present batch design summary and obtain user confirmation before final generation.
439
+
440
+ 1. **Read all `.feature-design-data.md` files**
441
+
442
+ 2. **Build Batch Design Summary**:
443
+
444
+ | Feature ID | Feature Name | Functions | Frontend Components | APIs | Data Entities |
445
+ |------------|--------------|-----------|---------------------|------|---------------|
446
+ | F-CRM-01 | Customer List | 5 | 3 | 4 | 2 new, 1 mod |
447
+ | F-CRM-02 | Customer Detail | 4 | 2 | 3 | 1 new |
448
+ | ... | ... | ... | ... | ... | ... |
449
+
450
+ 3. **Present to User**:
451
+ ```
452
+ 📋 Batch Design Summary
453
+
454
+ Total Features: {N}
455
+ ├── Functions Designed: {total}
456
+ ├── Frontend Components: {total}
457
+ ├── Backend APIs: {total}
458
+ └── Data Entities: {new} new, {modified} modified
459
+
460
+ [Summary table above]
461
+
462
+ ⚠️ HARD STOP — Please review all designs before proceeding to document generation.
463
+ ```
464
+
465
+ 4. **HARD STOP**: Wait for user confirmation
466
+ - 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:
468
+ ```bash
469
+ 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
+ ```
471
+
472
+ ---
473
+
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
+ ### Phase 3 Error Handling
525
+
526
+ When any worker (analyze/design/generate) reports failure:
527
+
528
+ 1. **Identify Phase**: Record which phase failed (3a/3b/3d) and which skill
529
+
530
+ 2. **Update status**: Set the failed feature's status in `.checkpoints.json`:
396
531
  ```bash
397
- node speccrew-workspace/scripts/update-progress.js update-task \
398
- --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json \
399
- --task {feature_id} --status failed --error "{error_message}"
532
+ node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --task {feature_id} --status failed --error "[{phase}] {error_message}"
400
533
  ```
401
534
 
402
- 3. **Continue batch**: Do NOT stop the entire batch for a single failure. Complete remaining workers in the current batch.
535
+ 3. **Continue batch**: Do NOT stop entire batch for single failure. Complete remaining workers.
403
536
 
404
- 4. **Report to user**: After each batch completes, report failures:
537
+ 4. **Report to user** (per phase):
405
538
  ```
406
- 📊 Batch 1 complete: 5/6 succeeded, 1 failed
539
+ 📊 Phase 3a (Analyze) — Batch 1 complete: 5/6 succeeded, 1 failed
407
540
  ├── ✅ F-SYS-01, F-SYS-02, F-SYS-03, F-SYS-04, F-MEMBER-01
408
541
  └── ❌ F-MEMBER-02: [error description]
409
542
 
410
543
  Retry failed features? (yes/skip/abort)
411
544
  ```
412
545
 
413
- 5. **Retry strategy**:
414
- - If user says "yes" → Re-dispatch failed features in the next batch
415
- - If user says "skip" → Mark as `skipped`, continue with remaining features
416
- - If user says "abort" → Stop dispatch, present partial results
546
+ 5. **Retry strategy**:
547
+ - If user says "yes" → Re-dispatch failed features in next batch (same phase)
548
+ - If user says "skip" → Mark as `skipped`, continue to next phase (if applicable)
549
+ - If user says "abort" → STOP workflow, report partial results
550
+
551
+ 6. **Batch failure threshold**: If >50% workers in a batch fail → STOP entire workflow, report to user
417
552
 
418
553
  ## Phase 4: API Contract Generation
419
554
 
@@ -21,6 +21,12 @@ tools: Read, Write, Glob, Grep
21
21
 
22
22
  3. **MANDATORY: Template-first workflow** — Step 4a (copy template) MUST execute before Step 4b (fill sections). Skipping Step 4a and writing content directly is FORBIDDEN.
23
23
 
24
+ 4. **ABORT CONDITIONS** — If any of the following occur, STOP immediately and report to user:
25
+ - Feature Spec document (`feature_spec_path`) does not exist or is empty → STOP
26
+ - API Contract template file does not exist → STOP
27
+ - `node ... update-progress.js` script execution fails → **HARD STOP**: Do NOT manually create or edit JSON progress files. Report the script error and wait for user resolution.
28
+ - User rejects Joint Confirmation → STOP, ask user for specific revision requirements
29
+
24
30
  ## Step 1: Read Input
25
31
 
26
32
  ### Input Parameters
@@ -152,6 +158,8 @@ After confirmation, you can start frontend and backend Designer Agents separatel
152
158
 
153
159
  After user confirms Joint Confirmation:
154
160
 
161
+ > **SCRIPT ENFORCEMENT RULE**: All `.checkpoints.json` and `WORKFLOW-PROGRESS.json` updates MUST be performed via `node speccrew-workspace/scripts/update-progress.js` commands. Manually creating or editing these JSON files is FORBIDDEN. If the script fails, STOP and report the error — do NOT attempt manual JSON construction.
162
+
155
163
  ### 6a: Update Checkpoints File
156
164
 
157
165
  Update the `.checkpoints.json` file to record confirmation status.
@@ -272,6 +280,8 @@ Update `WORKFLOW-PROGRESS.json` to reflect current feature/module status.
272
280
  - Record all output file paths
273
281
  - Log: "✅ Stage 02_feature_design confirmed. Ready for System Design phase."
274
282
 
283
+ > **Note**: On Windows PowerShell, do not use backslash (`\`) for line continuation. Write the entire command on a single line.
284
+
275
285
  **关于全局状态管理的说明**:
276
286
  > Feature 粒度的 API Contract 完成后,全局阶段状态(`02_feature_design.status` 和 `current_stage`)**不由本 Skill 更新**。
277
287
  > 全局状态由 **Feature Designer Agent** 统一管理,当检测到所有 Feature 都完成时,统一更新为 `confirmed` 并推进到下一阶段。
@@ -0,0 +1,224 @@
1
+ ---
2
+ name: speccrew-fd-feature-analyze
3
+ description: Feature Analysis SOP. Reads PRD documents and system knowledge to produce function decomposition with system relationship markers. Outputs .feature-analysis.md as interface contract for downstream design skills. Use when Feature Designer needs to analyze and decompose PRD requirements before design phase.
4
+ tools: Read, Write, Glob, Grep
5
+ ---
6
+
7
+ # Methodology Foundation
8
+
9
+ This skill applies ISA-95 Stages 1-3 as an internal thinking framework for analysis:
10
+
11
+ | ISA-95 Stage | Analysis Purpose |
12
+ |--------------|------------------|
13
+ | Stage 1: Domain Description | Understand business context, scope boundaries, glossary |
14
+ | Stage 2: Information Flows | Identify data sources, destinations, and cross-module exchanges |
15
+ | Stage 3: Categories of Information | Classify data entities and establish information hierarchy |
16
+
17
+ > ⚠️ **No separate modeling documents.** The methodology guides thinking quality, not document quantity.
18
+
19
+ # Trigger Scenarios
20
+
21
+ - PRD has been confirmed, user requests to start feature analysis
22
+ - Feature Designer Agent needs to decompose PRD into functions before design
23
+ - User asks "Analyze this feature" or "Break down this requirement"
24
+
25
+ # Workflow
26
+
27
+ ## Absolute Constraints
28
+
29
+ > **Violation = task failure**
30
+
31
+ 1. **FORBIDDEN: Script execution failure** — If `update-progress.js` fails, HARD STOP and report error
32
+ 2. **FORBIDDEN: Hand-written `.checkpoints.json`** — ALWAYS use `update-progress.js` script
33
+ 3. **FORBIDDEN: Skip Checkpoint A** — User confirmation required before proceeding to design phase (unless `skip_checkpoint=true`)
34
+
35
+ ## Step 1: Read PRD Input
36
+
37
+ ### 1.1 Input Parameters
38
+
39
+ | Parameter | Required | Description |
40
+ |-----------|----------|-------------|
41
+ | `prd_path` | Yes | Path to the Sub-PRD document |
42
+ | `feature_id` | No | Feature identifier (e.g., `F-CRM-01`) |
43
+ | `feature_name` | No | Feature name in English (e.g., `customer-list`) |
44
+ | `feature_type` | No | `Page+API` or `API-only` |
45
+ | `iteration_id` | No | Current iteration identifier |
46
+ | `frontend_platforms` | No | List of frontend platforms (auto-discover if not provided) |
47
+ | `skip_checkpoint` | No | Boolean, default `false`. Skip Checkpoint A if `true` |
48
+
49
+ ### 1.2 Read PRD
50
+
51
+ Read the PRD document at `{prd_path}` (typically `speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/[module-name]-prd.md`)
52
+
53
+ ### 1.3 Focus on Specific Feature (when feature_id provided)
54
+
55
+ If `feature_id` is provided:
56
+ - Locate the specific Feature in PRD Section 3.4 "Feature Breakdown"
57
+ - Extract only the user stories and requirements related to this Feature
58
+ - Ignore other Features in the same PRD
59
+
60
+ ### 1.4 Backward Compatibility (when feature_id not provided)
61
+
62
+ If `feature_id` is NOT provided, process entire PRD using legacy mode.
63
+
64
+ ## Step 2: Load System Knowledge
65
+
66
+ ### 2.1 Read System Overview
67
+
68
+ Read: `speccrew-workspace/knowledges/bizs/system-overview.md`
69
+
70
+ ### 2.2 Load Related Module Overviews
71
+
72
+ Based on PRD content, identify related modules and read:
73
+ ```
74
+ speccrew-workspace/knowledges/bizs/{module-name}/{module-name}-overview.md
75
+ ```
76
+
77
+ ### 2.2b Discover Frontend Platforms
78
+
79
+ Read `speccrew-workspace/knowledges/techs/techs-manifest.json` to identify frontend platforms:
80
+
81
+ | Platform Type | Examples |
82
+ |---------------|----------|
83
+ | `web-*` | web-vue, web-react |
84
+ | `mobile-*` | mobile-uniapp, mobile-flutter |
85
+
86
+ - If `frontend_platforms` parameter provided, use that list
87
+ - Otherwise, read techs-manifest.json directly
88
+
89
+ ### 2.3 Query Knowledge Graph (Optional)
90
+
91
+ If cross-module relationships need analysis, use `speccrew-knowledge-graph-query` skill.
92
+
93
+ ## Step 3: Function Breakdown
94
+
95
+ Break down PRD functional requirements into implementable system functions.
96
+
97
+ ### 3.1 Feature-Based Decomposition (when feature_id provided)
98
+
99
+ When processing a single Feature:
100
+
101
+ 1. **Extract Feature Scope**: From PRD Section 3.4, locate the specific Feature by `feature_id`
102
+ 2. **Identify Related User Stories**: Extract only user stories mapped to this Feature
103
+ 3. **Decompose into Functions**: Break down into 3-8 focused Functions
104
+ 4. **Check feature_type**: Mark `API-only` for backend-only design
105
+
106
+ ### 3.2 Full PRD Decomposition (backward compatibility)
107
+
108
+ When `feature_id` is NOT provided (legacy mode):
109
+ - Decompose entire PRD into all required Functions
110
+ - May result in 10-20 Functions for complex modules
111
+
112
+ ### 3.3 Function Analysis
113
+
114
+ For each function, identify:
115
+
116
+ | Aspect | Analysis Content |
117
+ |--------|------------------|
118
+ | **Frontend Changes** | New pages, components, or modifications to existing UI |
119
+ | **Backend Changes** | New interfaces or modifications to existing logic |
120
+ | **Data Changes** | New data structures or modifications to existing data |
121
+ | **System Relationship** | How this relates to existing system capabilities |
122
+
123
+ ### Mark Relationship to Existing System
124
+
125
+ | Marker | Meaning | Example |
126
+ |--------|---------|---------|
127
+ | `[EXISTING]` | Reuse current system capability | `[EXISTING] User authentication system` |
128
+ | `[MODIFIED]` | Enhance/change existing feature | `[MODIFIED] Add validation to user profile form` |
129
+ | `[NEW]` | Create brand new functionality | `[NEW] Order management module` |
130
+
131
+ ### Checkpoint A: Present Function Breakdown for Confirmation
132
+
133
+ **Conditional Execution:** If `skip_checkpoint=true`, skip user confirmation and proceed to Step 4.
134
+
135
+ If `skip_checkpoint=false` (default):
136
+ 1. Present function breakdown with [EXISTING]/[MODIFIED]/[NEW] markers to user
137
+ 2. Ask: "Does this function breakdown align with your understanding of the requirements?"
138
+ 3. **HARD STOP** — Wait for user confirmation before proceeding
139
+
140
+ ### Checkpoint A Progress Update
141
+
142
+ After user confirms (or if skipped):
143
+
144
+ ```bash
145
+ node speccrew-workspace/scripts/update-progress.js write-checkpoint \
146
+ --file speccrew-workspace/iterations/{iteration_id}/02.feature-design/.checkpoints.json \
147
+ --checkpoint function_decomposition \
148
+ --passed true
149
+ ```
150
+
151
+ Log: "✅ Checkpoint A (function_decomposition) passed and recorded"
152
+
153
+ ## Step 4: Write Output Contract
154
+
155
+ Write analysis results to `.feature-analysis.md`:
156
+
157
+ ### Output Path
158
+
159
+ | Mode | Output Path |
160
+ |------|-------------|
161
+ | With feature_id | `{prd_parent}/02.feature-design/{feature-id}-{feature-name}.feature-analysis.md` |
162
+ | Legacy mode | `{prd_parent}/02.feature-design/.feature-analysis.md` |
163
+
164
+ ### Output Structure
165
+
166
+ ```markdown
167
+ # Feature Analysis: {feature-name}
168
+
169
+ ## Feature Information
170
+ - Feature ID: {feature_id}
171
+ - Feature Name: {feature_name}
172
+ - Feature Type: {feature_type}
173
+ - Source PRD: {prd_path}
174
+
175
+ ## System Context Summary
176
+ [System knowledge and module overviews summary]
177
+
178
+ ## Frontend Platforms
179
+ [List from techs-manifest.json]
180
+
181
+ ## Function Breakdown (Total: {N} functions)
182
+
183
+ | # | Function Name | Type | Related User Stories | System Relationship |
184
+ |---|--------------|------|---------------------|---------------------|
185
+ | 1 | {name} | {frontend/backend/both} | {story refs} | [EXISTING]/[MODIFIED]/[NEW] |
186
+
187
+ ## Function Details
188
+ ### F1: {function-name}
189
+ - **Frontend Changes**: {description or N/A}
190
+ - **Backend Changes**: {description}
191
+ - **Data Changes**: {description}
192
+ - **System Relationship**: [EXISTING]/[MODIFIED]/[NEW] — {explanation}
193
+
194
+ ## Decomposition Status
195
+ - Checkpoint A: {passed/pending}
196
+ - Confirmed at: {timestamp or null}
197
+ ```
198
+
199
+ ---
200
+
201
+ # Key Rules
202
+
203
+ | Rule | Description |
204
+ |------|-------------|
205
+ | **Analysis Only** | Do NOT design UI wireframes, API specs, or data models |
206
+ | **Clear Markers** | Always use [EXISTING]/[MODIFIED]/[NEW] to indicate system relationship |
207
+ | **Checkpoint A Required** | User confirmation required before design phase (unless skipped) |
208
+ | **Use Script for JSON** | Always use `update-progress.js` for checkpoint files |
209
+ | **Output Contract** | `.feature-analysis.md` serves as interface for downstream design skills |
210
+
211
+ # Checklist
212
+
213
+ - [ ] PRD has been read, all P0 requirements covered
214
+ - [ ] **[Single Feature Mode]** Feature ID and name parameters received
215
+ - [ ] **[Single Feature Mode]** Only related Feature content extracted from PRD
216
+ - [ ] **[Legacy Mode]** All sub PRDs have been read (if master-sub structure)
217
+ - [ ] System overview loaded for context
218
+ - [ ] Related module overviews loaded
219
+ - [ ] **[Cross-module]** Knowledge graph queried for relationship analysis
220
+ - [ ] Function breakdown completed with [EXISTING]/[MODIFIED]/[NEW] markers
221
+ - [ ] **[Single Feature Mode]** 3-8 focused Functions defined
222
+ - [ ] Checkpoint A passed: function breakdown confirmed with user (or skipped)
223
+ - [ ] `.checkpoints.json` updated via script
224
+ - [ ] `.feature-analysis.md` written to correct path