@dzhechkov/p-replicator 1.0.0 → 1.1.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.
Files changed (19) hide show
  1. package/README.md +25 -3
  2. package/package.json +7 -4
  3. package/src/commands/doctor.js +2 -2
  4. package/src/commands/list.js +1 -1
  5. package/templates/.claude/rules/replicate-pipeline.md +13 -1
  6. package/templates/.claude/rules/skill-interface-protocol.md +148 -0
  7. package/templates/.claude/skills/cc-toolkit-generator-enhanced/SKILL.md +116 -63
  8. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/01-detect-parse.md +329 -0
  9. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/02-analyze-map.md +449 -0
  10. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/03-generate-p0.md +630 -0
  11. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/04-generate-p1.md +537 -0
  12. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/05-generate-p2p3.md +512 -0
  13. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/06-package-deliver.md +710 -0
  14. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/07-harvest-feedback.md +286 -0
  15. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/08-skill-composition.md +378 -0
  16. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/09-cross-project-learning.md +461 -0
  17. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/README.md +83 -0
  18. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/maturity-integration.md +198 -0
  19. package/templates/.claude/skills/pipeline-forge/references/self-extracted-patterns.md +260 -0
@@ -0,0 +1,630 @@
1
+ # Module: Generate P0
2
+
3
+ Phase 3 of the CC-Toolkit-Generator Enhanced pipeline.
4
+ Generates all mandatory P0 toolkit items -- the core instruments that every
5
+ project receives regardless of pipeline type, score, or user selection.
6
+ Also generates conditional P0 items driven by project characteristics.
7
+
8
+ ---
9
+
10
+ ## Input
11
+
12
+ | Parameter | Type | Source |
13
+ |-----------|------|--------|
14
+ | `ipm` | IPM object | Output of Module 01 (Detect & Parse) |
15
+ | `instrument_map` | InstrumentMap object | Output of Module 02 (Analyze & Map) |
16
+
17
+ From the IPM this module uses:
18
+ - `pipeline_type` -- determines CLAUDE.md strategy and template selection
19
+ - `detected_docs` -- content sources for generated files
20
+ - `project_characteristics` -- conditional P0 triggers
21
+
22
+ From the Instrument Map this module uses:
23
+ - `p0_mandatory` -- confirmation of required items (hardcoded below)
24
+ - `p0_conditional` -- items gated by characteristic flags
25
+
26
+ ---
27
+
28
+ ## Process
29
+
30
+ ### P0 Mandatory Items (always generated)
31
+
32
+ The following 16 items are generated for every project, regardless of pipeline
33
+ type or user mode.
34
+
35
+ ---
36
+
37
+ #### Item 1: CLAUDE.md
38
+
39
+ **Template:** `view() references/claude-md-strategy.md`
40
+
41
+ The project's root context file. Generation strategy differs by pipeline:
42
+
43
+ **SPARC pipeline top sections:**
44
+ ```markdown
45
+ # Project: [Name from PRD.md]
46
+
47
+ ## Overview
48
+ [From PRD.md Executive Summary]
49
+
50
+ ## Problem & Solution
51
+ [From Solution_Strategy.md -- 2-3 sentences]
52
+
53
+ ## Architecture
54
+ [From Architecture.md -- monorepo structure, tech stack]
55
+
56
+ ## Tech Stack
57
+ [From Architecture.md decisions table]
58
+
59
+ ## Key Algorithms
60
+ [From Pseudocode.md -- top 3-5 function signatures]
61
+
62
+ ## Security Rules
63
+ [From Specification.md security requirements]
64
+ [IF has_external_apis: client-side encryption mandatory]
65
+ ```
66
+
67
+ **idea2prd pipeline top sections:**
68
+ ```markdown
69
+ # Project: [Name from .ai-context/README.md]
70
+
71
+ ## Overview
72
+ [From .ai-context/README.md]
73
+
74
+ ## Architecture
75
+ [From .ai-context/architecture-summary.md]
76
+
77
+ ## Key Decisions
78
+ [From .ai-context/key-decisions.md -- top 5 ADRs]
79
+
80
+ ## Domain Model
81
+ [From .ai-context/bounded-contexts.md]
82
+
83
+ ## Glossary
84
+ [From .ai-context/domain-glossary.md -- key terms]
85
+
86
+ ## Tech Stack
87
+ [From ADRs + architecture-summary]
88
+
89
+ ## Coding Standards
90
+ [From .ai-context/coding-standards.md]
91
+
92
+ ## Quality Gates
93
+ [From .ai-context/fitness-rules.md]
94
+ ```
95
+
96
+ **Common sections (both pipelines) -- always appended after pipeline-specific top:**
97
+ ```markdown
98
+ ## Parallel Execution Strategy
99
+ ## Swarm Agents
100
+ ## Git Workflow
101
+ ## Available Agents
102
+ ## Available Skills
103
+ ## Quick Commands
104
+ ## Development Insights (knowledge base)
105
+ ## Feature Development Lifecycle
106
+ ## Enterprise Feature Lifecycle (IF DDD detected)
107
+ ## Feature Roadmap
108
+ ## Implementation Plans
109
+ ## Automation Commands
110
+ ## Resources
111
+ ```
112
+
113
+ **Source priority rules:**
114
+
115
+ | CLAUDE.md Section | Priority 1 | Priority 2 | Priority 3 |
116
+ |-------------------|------------|------------|------------|
117
+ | Overview | .ai-context/README | PRD Executive Summary | Final_Summary |
118
+ | Architecture | .ai-context/architecture | Architecture.md | -- |
119
+ | Tech Stack | Architecture.md | ADRs | -- |
120
+ | Key Decisions | .ai-context/key-decisions | ADRs | Solution_Strategy |
121
+ | Security | Specification.md | Fitness Functions | Architecture.md |
122
+
123
+ **Context budget:** Target 4,000 tokens, maximum 6,000 tokens.
124
+ If content exceeds max, prioritize: Overview > Architecture > Security >
125
+ Lifecycle sections > Generated lists.
126
+
127
+ **Output path:** `CLAUDE.md` (project root)
128
+
129
+ ---
130
+
131
+ #### Item 2: security.md rule
132
+
133
+ **Source:** Specification.md NFRs (SPARC) or ADRs + Fitness Functions (idea2prd)
134
+
135
+ Generate `.claude/rules/security.md` containing:
136
+ - Security requirements extracted from source docs
137
+ - Input validation rules
138
+ - Authentication/authorization requirements
139
+ - Encryption requirements (especially if `has_external_apis`)
140
+ - Dependency security scanning rules
141
+
142
+ **Output path:** `.claude/rules/security.md`
143
+
144
+ ---
145
+
146
+ #### Item 3: coding-style.md rule
147
+
148
+ **Source:** Architecture.md tech stack (SPARC) or DDD Tactical + ADRs (idea2prd)
149
+
150
+ Generate `.claude/rules/coding-style.md` containing:
151
+ - Language and framework conventions from the tech stack
152
+ - Naming conventions (files, variables, functions, classes)
153
+ - Import ordering rules
154
+ - Code organization patterns
155
+ - IF idea2prd: DDD tactical patterns (aggregate rules, entity identity, VO immutability)
156
+
157
+ **Output path:** `.claude/rules/coding-style.md`
158
+
159
+ ---
160
+
161
+ #### Item 4: /start command
162
+
163
+ **Template:** `view() references/templates/start-command.md`
164
+
165
+ Generate `.claude/commands/start.md` -- the full project bootstrap command.
166
+
167
+ Key generation steps:
168
+ 1. Read the start-command template for structure
169
+ 2. Fill `{{DOCS_TO_READ}}` with actual doc paths from `ipm.detected_docs`
170
+ 3. Fill `{{FOR_EACH_PACKAGE}}` with one Task block per `ipm.project_characteristics.monorepo_packages`
171
+ 4. Set `{{IF_DATABASE}}` / `{{IF_NO_DATABASE}}` based on `ipm.project_characteristics.has_database`
172
+ 5. Set `{{MIGRATION_COMMAND}}` based on `ipm.project_characteristics.orm_name`:
173
+ - prisma: `npx prisma migrate dev --name init`
174
+ - typeorm: `npx typeorm migration:run`
175
+ - drizzle: `npx drizzle-kit push`
176
+ - knex: `npx knex migrate:latest`
177
+ - raw: `psql -f init.sql`
178
+ 6. Set `{{SEED_COMMAND}}` similarly
179
+ 7. Fill `{{DOCKER_SERVICES}}` from `ipm.project_characteristics.docker_services`
180
+ 8. Fill `{{HEALTH_CHECK_COMMAND}}` from Architecture.md API endpoints
181
+
182
+ **Critical rule:** /start MUST reference actual docs in `docs/`, never hallucinate
183
+ code from memory. Every Phase 2 Task includes explicit doc references.
184
+
185
+ **Output path:** `.claude/commands/start.md`
186
+
187
+ ---
188
+
189
+ #### Item 5: /myinsights command
190
+
191
+ **Template:** `view() references/templates/insights-system.md` (Section 1)
192
+
193
+ Generate `.claude/commands/myinsights.md` -- the insight capture and management
194
+ command with:
195
+ - Duplicate detection (Step 0) via index grep
196
+ - Information collection (Step 1) with structured fields
197
+ - Individual detail file creation (Step 2) as `myinsights/INS-NNN-slug.md`
198
+ - Index update (Step 3) in `myinsights/1nsights.md`
199
+ - Auto-numbering (Step 4) from highest existing INS-NNN
200
+ - Subcommands: archive, status
201
+ - Hit counter for tracking insight reuse value
202
+
203
+ **Output path:** `.claude/commands/myinsights.md`
204
+
205
+ ---
206
+
207
+ #### Item 6: /feature command
208
+
209
+ **Template:** `view() references/templates/feature-lifecycle.md` (Section 2)
210
+
211
+ Generate `.claude/commands/feature.md` -- the 4-phase feature lifecycle command:
212
+
213
+ ```
214
+ Phase 0: PRE-FLIGHT CHECK
215
+ Verify all required skills exist in .claude/skills/
216
+ ABORT if sparc-prd-mini, requirements-validator, or brutal-honesty-review missing
217
+ WARN if explore, goap-research, or problem-solver-enhanced missing
218
+
219
+ Phase 1: PLAN (sparc-prd-mini)
220
+ Create docs/features/<feature-name>/sparc/
221
+ Run sparc-prd-mini Gate -> assess clarity
222
+ Generate 9 SPARC documents
223
+ Commit: docs(feature): SPARC planning for <feature-name>
224
+
225
+ Phase 2: VALIDATE (requirements-validator, swarm)
226
+ 5 parallel validation agents
227
+ Iterative loop (max 3 iterations)
228
+ Minimum score: 70/100, no BLOCKED items
229
+ Save validation-report.md
230
+ Commit: docs(feature): validation complete for <feature-name>
231
+
232
+ Phase 3: IMPLEMENT (swarm + parallel tasks)
233
+ Read validated SPARC docs as source of truth
234
+ Use @planner, @architect, implementation agents
235
+ Modular design for reuse
236
+ Commit per logical unit: feat(<feature-name>): <what>
237
+
238
+ Phase 4: REVIEW (brutal-honesty-review, swarm)
239
+ 5 parallel review agents (code-quality, architecture, security, performance, testing)
240
+ Fix all critical/major issues
241
+ Save review-report.md
242
+ Commit: docs(feature): review complete for <feature-name>
243
+ ```
244
+
245
+ **Output path:** `.claude/commands/feature.md`
246
+
247
+ ---
248
+
249
+ #### Item 7: git-workflow.md rule
250
+
251
+ Generate `.claude/rules/git-workflow.md` with semantic commit conventions:
252
+
253
+ ```markdown
254
+ # Git Workflow
255
+
256
+ ## Commit Format
257
+ type(scope): description
258
+
259
+ ## Types
260
+ - feat: New feature
261
+ - fix: Bug fix
262
+ - refactor: Code restructuring (no behavior change)
263
+ - test: Adding/updating tests
264
+ - docs: Documentation changes
265
+ - chore: Build, CI, config changes
266
+
267
+ ## Rules
268
+ - Commit after each logical change
269
+ - Never combine unrelated changes in one commit
270
+ - Use scope from monorepo package names where applicable
271
+ - Write imperative mood descriptions ("add", not "added")
272
+ ```
273
+
274
+ **Output path:** `.claude/rules/git-workflow.md`
275
+
276
+ ---
277
+
278
+ #### Item 8: insights-capture.md rule
279
+
280
+ **Template:** `view() references/templates/insights-system.md` (Section 2)
281
+
282
+ Generate `.claude/rules/insights-capture.md` with:
283
+ - Error-First Lookup protocol (grep index BEFORE debugging)
284
+ - When to suggest capturing an insight (5 trigger conditions)
285
+ - How to suggest (prompt format)
286
+ - When NOT to suggest (4 exclusion conditions)
287
+ - Lifecycle awareness (Active / Workaround / Obsolete status handling)
288
+
289
+ **Output path:** `.claude/rules/insights-capture.md`
290
+
291
+ ---
292
+
293
+ #### Item 9: feature-lifecycle.md rule
294
+
295
+ **Template:** `view() references/templates/feature-lifecycle.md` (Section 3)
296
+
297
+ Generate `.claude/rules/feature-lifecycle.md` with:
298
+ - Protocol definition (4-phase lifecycle)
299
+ - Planning rules (SPARC docs mandatory, Gate assessment, MANUAL/AUTO mode)
300
+ - Validation rules (swarm, min score 70, max 3 iterations)
301
+ - Implementation rules (read docs not hallucinate, modular, parallel Tasks)
302
+ - Review rules (brutal-honesty, fix criticals, benchmark)
303
+ - Feature directory structure template
304
+ - Skip rules table (when to skip phases)
305
+
306
+ **Output path:** `.claude/rules/feature-lifecycle.md`
307
+
308
+ ---
309
+
310
+ #### Item 10: settings.json hooks
311
+
312
+ **Template:** `view() references/templates/insights-system.md` (Section 3 -- Stop hook)
313
+
314
+ Generate `.claude/settings.json` with hook configuration:
315
+
316
+ ```json
317
+ {
318
+ "hooks": {
319
+ "Stop": [
320
+ {
321
+ "matcher": "",
322
+ "command": "<insights auto-commit hook -- see template>"
323
+ },
324
+ {
325
+ "matcher": "",
326
+ "command": "<feature-roadmap auto-commit hook>"
327
+ },
328
+ {
329
+ "matcher": "",
330
+ "command": "<plans auto-commit hook>"
331
+ }
332
+ ],
333
+ "SessionStart": [
334
+ {
335
+ "matcher": "",
336
+ "command": "python3 .claude/hooks/feature-context.py"
337
+ }
338
+ ]
339
+ }
340
+ }
341
+ ```
342
+
343
+ The Stop hooks auto-commit changes to:
344
+ 1. `myinsights/` -- knowledge base entries (insights-system.md template)
345
+ 2. `.claude/feature-roadmap.json` -- feature status updates
346
+ 3. `docs/plans/` -- implementation plans
347
+
348
+ The SessionStart hook injects current feature context and sprint progress.
349
+
350
+ **Output path:** `.claude/settings.json`
351
+
352
+ ---
353
+
354
+ #### Items 11-16: Six Lifecycle Skills (copy + path rewrite)
355
+
356
+ **Template:** `view() references/templates/feature-lifecycle.md` (Section 1 -- Skill Copying Protocol)
357
+
358
+ Copy these 6 skills from the user's skill set into `.claude/skills/`:
359
+
360
+ | # | Skill | Source Path | Target Path |
361
+ |---|-------|-------------|-------------|
362
+ | 11 | sparc-prd-mini | `/mnt/skills/user/sparc-prd-mini/` | `.claude/skills/sparc-prd-mini/` |
363
+ | 12 | explore | `/mnt/skills/user/explore/` | `.claude/skills/explore/` |
364
+ | 13 | goap-research | `/mnt/skills/user/goap-research/` | `.claude/skills/goap-research/` |
365
+ | 14 | problem-solver-enhanced | `/mnt/skills/user/problem-solver-enhanced/` | `.claude/skills/problem-solver-enhanced/` |
366
+ | 15 | requirements-validator | `/mnt/skills/user/requirements-validator/` | `.claude/skills/requirements-validator/` |
367
+ | 16 | brutal-honesty-review | `/mnt/skills/user/brutal-honesty-review/` | `.claude/skills/brutal-honesty-review/` |
368
+
369
+ **Copy protocol:**
370
+ 1. Copy the **entire directory** for each skill (SKILL.md + references/ + scripts/ + templates/)
371
+ 2. In the replicate pipeline context, source paths map from `/mnt/skills/user/[name]/` to `.claude/skills/[name]/` (skills are already local)
372
+
373
+ **Path rewrite required for sparc-prd-mini/SKILL.md:**
374
+
375
+ After copying, rewrite ALL `view()` paths in `sparc-prd-mini/SKILL.md`:
376
+
377
+ External skill paths (3 rewrites):
378
+ ```
379
+ /mnt/skills/user/explore/SKILL.md -> .claude/skills/explore/SKILL.md
380
+ /mnt/skills/user/goap-research/SKILL.md -> .claude/skills/goap-research/SKILL.md
381
+ /mnt/skills/user/problem-solver-enhanced/SKILL.md -> .claude/skills/problem-solver-enhanced/SKILL.md
382
+ ```
383
+
384
+ Internal template/reference paths (3 rewrites):
385
+ ```
386
+ templates/prd.md -> .claude/skills/sparc-prd-mini/templates/prd.md
387
+ references/sparc-methodology.md -> .claude/skills/sparc-prd-mini/references/sparc-methodology.md
388
+ templates/CLAUDE.md -> .claude/skills/sparc-prd-mini/templates/CLAUDE.md
389
+ ```
390
+
391
+ Also update informational references in sparc-prd-mini/SKILL.md (non-executable
392
+ but avoids confusion):
393
+ ```
394
+ Lines 31-33: External Dependencies table -- update paths to .claude/skills/
395
+ Lines 951-953: Dependency Version Note -- update paths to .claude/skills/
396
+ ```
397
+
398
+ **Note on `goap-research` name mapping:** The skill name `goap-research` in the
399
+ lifecycle context maps to `goap-research-ed25519` in this repository. Ensure the
400
+ correct directory name is used when copying.
401
+
402
+ **Output paths:** `.claude/skills/sparc-prd-mini/`, `.claude/skills/explore/`,
403
+ `.claude/skills/goap-research/`, `.claude/skills/problem-solver-enhanced/`,
404
+ `.claude/skills/requirements-validator/`, `.claude/skills/brutal-honesty-review/`
405
+
406
+ ---
407
+
408
+ ### P0 Conditional Items (generated if flags match)
409
+
410
+ #### Conditional A: secrets-management.md + security-patterns/
411
+
412
+ **Condition:** `ipm.project_characteristics.has_external_apis == true`
413
+
414
+ Generate `.claude/rules/secrets-management.md`:
415
+ - API key storage rules (never in code, use env vars)
416
+ - Client-side encryption requirements
417
+ - Secret rotation policies
418
+ - .env file management rules
419
+
420
+ Generate `.claude/skills/security-patterns/`:
421
+ - SKILL.md with encryption patterns
422
+ - API key validation patterns
423
+ - Secure storage templates
424
+
425
+ **Output paths:** `.claude/rules/secrets-management.md`, `.claude/skills/security-patterns/`
426
+
427
+ ---
428
+
429
+ #### Conditional B: domain-model.md rule
430
+
431
+ **Condition:** DDD Strategic docs detected (`ipm.detected_docs.idea2prd.ddd_strategic` non-empty)
432
+
433
+ Generate `.claude/rules/domain-model.md`:
434
+ - Bounded Context boundaries and responsibilities
435
+ - Ubiquitous Language enforcement
436
+ - Aggregate invariants
437
+ - Context mapping relationships (upstream/downstream)
438
+
439
+ **Source:** `docs/ddd/strategic/bounded-contexts.md`, `docs/ddd/strategic/context-map.md`,
440
+ `.ai-context/bounded-contexts.md`
441
+
442
+ **Output path:** `.claude/rules/domain-model.md`
443
+
444
+ ---
445
+
446
+ #### Conditional C: /start database extensions
447
+
448
+ **Condition:** `ipm.project_characteristics.has_database == true`
449
+
450
+ Extend the /start command (Item 4) with:
451
+ - Database migration step in Phase 3
452
+ - Database seed step in Phase 3
453
+ - `--skip-seed` flag
454
+ - ORM-specific commands based on `ipm.project_characteristics.orm_name`
455
+
456
+ This is not a separate file but a conditional section within `/start`.
457
+
458
+ ---
459
+
460
+ ### Additional P0 Outputs
461
+
462
+ #### docs/features/ directory
463
+
464
+ Create the empty directory `docs/features/` to establish the feature
465
+ documentation structure. This directory is where `/feature` command outputs
466
+ will be stored.
467
+
468
+ **Output path:** `docs/features/` (directory)
469
+
470
+ ---
471
+
472
+ #### DEVELOPMENT_GUIDE.md
473
+
474
+ Generate the development guide with:
475
+ - Full lifecycle instructions (setup -> develop -> test -> deploy)
476
+ - Command reference table
477
+ - Agent reference table
478
+ - Skill reference table
479
+ - Troubleshooting section
480
+ - Project-specific setup instructions
481
+
482
+ **Context budget:** Target 1,000 tokens, maximum 2,000 tokens.
483
+
484
+ **Output path:** `DEVELOPMENT_GUIDE.md` (project root)
485
+
486
+ ---
487
+
488
+ ### Step-by-step Generation Order
489
+
490
+ Generate items in this order to resolve dependencies:
491
+
492
+ ```
493
+ 1. Items 11-16: Copy lifecycle skills FIRST (other items reference them)
494
+ 2. Item 1: CLAUDE.md (references agents/skills/commands lists)
495
+ 3. Items 2-3: security.md, coding-style.md (rules, no deps)
496
+ 4. Item 7: git-workflow.md (rule, no deps)
497
+ 5. Item 8: insights-capture.md (rule, no deps)
498
+ 6. Item 9: feature-lifecycle.md (rule, references skills from step 1)
499
+ 7. Item 4: /start command (references docs, rules, skills)
500
+ 8. Item 5: /myinsights command (references insights-capture rule)
501
+ 9. Item 6: /feature command (references lifecycle skills, rules)
502
+ 10. Item 10: settings.json (references all hooks)
503
+ 11. Conditional A-C: based on project characteristics
504
+ 12. docs/features/ directory
505
+ 13. DEVELOPMENT_GUIDE.md (references everything above)
506
+ ```
507
+
508
+ ### MANUAL Mode Checkpoint
509
+
510
+ In MANUAL mode, present P0 generation results:
511
+
512
+ ```
513
+ ================================================================
514
+ CHECKPOINT 3: P0 Review
515
+ ================================================================
516
+
517
+ P0 Mandatory Generated:
518
+ [x] CLAUDE.md 4.1 KB
519
+ [x] .claude/rules/security.md 1.8 KB
520
+ [x] .claude/rules/coding-style.md 2.1 KB
521
+ [x] .claude/commands/start.md 3.2 KB
522
+ [x] .claude/commands/myinsights.md 2.8 KB
523
+ [x] .claude/commands/feature.md 3.5 KB
524
+ [x] .claude/rules/git-workflow.md 0.8 KB
525
+ [x] .claude/rules/insights-capture.md 1.9 KB
526
+ [x] .claude/rules/feature-lifecycle.md 2.4 KB
527
+ [x] .claude/settings.json 1.2 KB
528
+ [x] 6 lifecycle skills copied (sparc-prd-mini, explore,
529
+ goap-research, problem-solver-enhanced,
530
+ requirements-validator, brutal-honesty-review)
531
+
532
+ P0 Conditional Generated:
533
+ [x] .claude/rules/secrets-management.md (has_external_apis)
534
+ [x] .claude/skills/security-patterns/ (has_external_apis)
535
+ [x] .claude/rules/domain-model.md (DDD Strategic detected)
536
+
537
+ Additional:
538
+ [x] docs/features/ directory created
539
+ [x] DEVELOPMENT_GUIDE.md 1.1 KB
540
+
541
+ Total P0: 16 mandatory + 3 conditional = 19 items
542
+ Combined size: ~26 KB
543
+
544
+ Commands: "ok" to proceed to P1 | "modify [file]" | "show [file]"
545
+ ================================================================
546
+ ```
547
+
548
+ ---
549
+
550
+ ## Output
551
+
552
+ | Field | Type | Description |
553
+ |-------|------|-------------|
554
+ | `generated_files` | list of objects | Every file created, with absolute path, size, and category |
555
+
556
+ Each entry in `generated_files`:
557
+ ```
558
+ {
559
+ path: string, # e.g. ".claude/rules/security.md"
560
+ category: string, # "rule" | "command" | "skill" | "config" | "doc" | "directory"
561
+ size_bytes: int,
562
+ is_conditional: bool,
563
+ condition: string | null # e.g. "has_external_apis"
564
+ }
565
+ ```
566
+
567
+ The generated files list is consumed by:
568
+ - **Module 04 (Generate P1)** -- to avoid overwriting P0 files
569
+ - **Module 06 (Package & Deliver)** -- for the master validation checklist
570
+ - **CLAUDE.md** -- to populate Available Agents/Skills/Commands sections
571
+
572
+ ---
573
+
574
+ ## Quality Gate
575
+
576
+ | Check | Condition | Action on Failure |
577
+ |-------|-----------|-------------------|
578
+ | All 16 P0 mandatory items exist | Every item from the mandatory list has a file on disk | Re-generate missing items. Do not proceed to P1 with incomplete P0. |
579
+ | 6 lifecycle skills copied | All 6 skill directories exist under `.claude/skills/` with SKILL.md present | Re-copy missing skills. If source unavailable, log critical warning. |
580
+ | Path rewrite verified | `sparc-prd-mini/SKILL.md` contains `.claude/skills/` paths, not `/mnt/skills/user/` | Re-run path rewrite on sparc-prd-mini. |
581
+ | CLAUDE.md within budget | CLAUDE.md is under 6,000 tokens | Trim lower-priority sections (Generated lists, Resources). |
582
+ | Conditional items match flags | Conditional P0 items generated only when matching flag is true | Remove incorrectly generated conditional items. |
583
+ | settings.json valid JSON | `.claude/settings.json` parses as valid JSON | Fix JSON syntax. |
584
+ | docs/features/ exists | Directory created | Create the directory. |
585
+ | No P0 item references missing doc | Every P0 item that reads from `ipm.detected_docs` has valid source | Generate with degraded content, add warning comment. |
586
+
587
+ ---
588
+
589
+ ## Dependencies
590
+
591
+ This module reads the following reference/template files during execution:
592
+
593
+ | Reference | Purpose | Used By Item |
594
+ |-----------|---------|--------------|
595
+ | `view() references/claude-md-strategy.md` | CLAUDE.md generation strategy (pipeline-specific sections, common sections, source priority, budget) | Item 1: CLAUDE.md |
596
+ | `view() references/templates/start-command.md` | /start command template with placeholder fill instructions | Item 4: /start |
597
+ | `view() references/templates/feature-lifecycle.md` | Skill copying protocol (Sec 1), /feature command template (Sec 2), feature-lifecycle rule template (Sec 3), CLAUDE.md integration (Sec 4) | Items 6, 9, 11-16 |
598
+ | `view() references/templates/insights-system.md` | /myinsights command template (Sec 1), insights-capture rule template (Sec 2), Stop hook template (Sec 3), CLAUDE.md integration (Sec 4) | Items 5, 8, 10 |
599
+
600
+ These files are part of the cc-toolkit-generator-enhanced skill at:
601
+ `.claude/skills/cc-toolkit-generator-enhanced/references/`
602
+
603
+ ---
604
+
605
+ ## Reusability
606
+
607
+ The P0 generation pattern can be templated for **any toolkit with mandatory core
608
+ items**:
609
+
610
+ 1. **Define the mandatory item list** -- items that are always generated
611
+ 2. **Define conditional items** -- items gated by project characteristic flags
612
+ 3. **Define generation order** -- resolve dependencies between items
613
+ 4. **Define templates** -- reference files with placeholder fill instructions
614
+ 5. **Define quality gate** -- checks that all mandatory items exist and are valid
615
+
616
+ This pattern is independent of the specific items being generated. To create a
617
+ different toolkit (e.g., a testing toolkit, a documentation toolkit, a CI/CD
618
+ toolkit):
619
+ - Replace the 16 mandatory items with domain-specific core items
620
+ - Replace conditional flags with domain-specific detection flags
621
+ - Keep the generation order framework (copy dependencies first, then config,
622
+ then commands, then meta-files)
623
+ - Keep the quality gate structure (existence checks + content validation)
624
+
625
+ The skill copying protocol (Items 11-16) is also independently reusable for any
626
+ scenario where skills need to be redistributed with path rewrites. The protocol
627
+ handles:
628
+ - Full directory copy (SKILL.md + references/ + templates/ + scripts/)
629
+ - view() path rewriting for cross-skill references
630
+ - Informational reference updates for developer clarity