@dzhechkov/p-replicator 1.0.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 (92) hide show
  1. package/README.md +314 -0
  2. package/bin/cli.js +4 -0
  3. package/package.json +62 -0
  4. package/src/cli.js +160 -0
  5. package/src/commands/doctor.js +151 -0
  6. package/src/commands/init.js +155 -0
  7. package/src/commands/list.js +133 -0
  8. package/src/commands/remove.js +111 -0
  9. package/src/commands/update.js +102 -0
  10. package/src/utils.js +280 -0
  11. package/templates/.claude/agents/doc-validator.md +92 -0
  12. package/templates/.claude/agents/harvest-coordinator.md +91 -0
  13. package/templates/.claude/agents/product-discoverer.md +57 -0
  14. package/templates/.claude/agents/replicate-coordinator.md +98 -0
  15. package/templates/.claude/commands/harvest.md +106 -0
  16. package/templates/.claude/commands/replicate.md +389 -0
  17. package/templates/.claude/rules/replicate-pipeline.md +92 -0
  18. package/templates/.claude/skills/brutal-honesty-review/README.md +218 -0
  19. package/templates/.claude/skills/brutal-honesty-review/SKILL.md +225 -0
  20. package/templates/.claude/skills/brutal-honesty-review/resources/assessment-rubrics.md +295 -0
  21. package/templates/.claude/skills/brutal-honesty-review/resources/review-template.md +102 -0
  22. package/templates/.claude/skills/brutal-honesty-review/scripts/assess-code.sh +179 -0
  23. package/templates/.claude/skills/brutal-honesty-review/scripts/assess-tests.sh +223 -0
  24. package/templates/.claude/skills/cc-toolkit-generator-enhanced/SKILL.md +374 -0
  25. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/claude-md-strategy.md +178 -0
  26. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/enhanced-recommendations.md +416 -0
  27. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/extended-mapping.md +370 -0
  28. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/automation-commands.md +733 -0
  29. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/ddd-agents.md +416 -0
  30. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/ddd-hooks-commands.md +524 -0
  31. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/ddd-skills.md +350 -0
  32. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/enhanced-claude-md.md +235 -0
  33. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-lifecycle-ent.md +400 -0
  34. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-lifecycle.md +325 -0
  35. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-suggestions.md +423 -0
  36. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/insights-system.md +349 -0
  37. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/mcp.md +274 -0
  38. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/start-command.md +283 -0
  39. package/templates/.claude/skills/explore/SKILL.md +215 -0
  40. package/templates/.claude/skills/explore/references/questioning-techniques.md +151 -0
  41. package/templates/.claude/skills/explore/references/task-brief-templates.md +355 -0
  42. package/templates/.claude/skills/goap-research-ed25519/SKILL.md +415 -0
  43. package/templates/.claude/skills/goap-research-ed25519/references/ed25519-verification.md +658 -0
  44. package/templates/.claude/skills/goap-research-ed25519/references/research-actions.md +544 -0
  45. package/templates/.claude/skills/goap-research-ed25519/references/source-evaluation.md +560 -0
  46. package/templates/.claude/skills/goap-research-ed25519/scripts/ed25519_verifier.py +662 -0
  47. package/templates/.claude/skills/goap-research-ed25519/scripts/goap_planner.py +720 -0
  48. package/templates/.claude/skills/knowledge-extractor/SKILL.md +412 -0
  49. package/templates/.claude/skills/knowledge-extractor/examples/rate-limiting-extraction.md +259 -0
  50. package/templates/.claude/skills/knowledge-extractor/modules/01-agent-review.md +192 -0
  51. package/templates/.claude/skills/knowledge-extractor/modules/02-classify.md +122 -0
  52. package/templates/.claude/skills/knowledge-extractor/modules/03-decontextualize.md +156 -0
  53. package/templates/.claude/skills/knowledge-extractor/modules/04-integrate.md +178 -0
  54. package/templates/.claude/skills/knowledge-extractor/references/artifact-categories.md +342 -0
  55. package/templates/.claude/skills/knowledge-extractor/references/decontextualization-guide.md +247 -0
  56. package/templates/.claude/skills/knowledge-extractor/references/maturity-model.md +153 -0
  57. package/templates/.claude/skills/knowledge-extractor/templates/artifact-card.md +60 -0
  58. package/templates/.claude/skills/knowledge-extractor/templates/harvest-report.md +70 -0
  59. package/templates/.claude/skills/knowledge-extractor/templates/toolkit-harvest.md +38 -0
  60. package/templates/.claude/skills/pipeline-forge/SKILL.md +523 -0
  61. package/templates/.claude/skills/pipeline-forge/examples/replicate-analysis.md +291 -0
  62. package/templates/.claude/skills/pipeline-forge/references/patterns-catalog.md +408 -0
  63. package/templates/.claude/skills/pipeline-forge/references/quality-gates.md +268 -0
  64. package/templates/.claude/skills/pipeline-forge/references/skill-anatomy.md +292 -0
  65. package/templates/.claude/skills/pipeline-forge/templates/agent-template.md +60 -0
  66. package/templates/.claude/skills/pipeline-forge/templates/command-template.md +80 -0
  67. package/templates/.claude/skills/pipeline-forge/templates/pipeline-template.md +137 -0
  68. package/templates/.claude/skills/pipeline-forge/templates/skill-template.md +132 -0
  69. package/templates/.claude/skills/problem-solver-enhanced/SKILL.md +562 -0
  70. package/templates/.claude/skills/requirements-validator/SKILL.md +121 -0
  71. package/templates/.claude/skills/requirements-validator/assets/templates/bdd-feature-template.feature +69 -0
  72. package/templates/.claude/skills/requirements-validator/references/bdd-patterns.md +184 -0
  73. package/templates/.claude/skills/requirements-validator/references/invest-criteria.md +121 -0
  74. package/templates/.claude/skills/requirements-validator/references/scoring-system.md +134 -0
  75. package/templates/.claude/skills/requirements-validator/references/smart-criteria.md +130 -0
  76. package/templates/.claude/skills/reverse-engineering-unicorn/SKILL.md +194 -0
  77. package/templates/.claude/skills/reverse-engineering-unicorn/examples/noom-cjm-example.md +100 -0
  78. package/templates/.claude/skills/reverse-engineering-unicorn/examples/noom-module1-example.md +88 -0
  79. package/templates/.claude/skills/reverse-engineering-unicorn/modules/01-intelligence.md +328 -0
  80. package/templates/.claude/skills/reverse-engineering-unicorn/modules/02-product-customers.md +221 -0
  81. package/templates/.claude/skills/reverse-engineering-unicorn/modules/025-cjm-prototype.md +206 -0
  82. package/templates/.claude/skills/reverse-engineering-unicorn/modules/03-market-competition.md +402 -0
  83. package/templates/.claude/skills/reverse-engineering-unicorn/modules/04-business-finance.md +287 -0
  84. package/templates/.claude/skills/reverse-engineering-unicorn/modules/05-growth-engine.md +290 -0
  85. package/templates/.claude/skills/reverse-engineering-unicorn/modules/06-playbook-synthesis.md +286 -0
  86. package/templates/.claude/skills/reverse-engineering-unicorn/references/blue-ocean-canvas.md +39 -0
  87. package/templates/.claude/skills/reverse-engineering-unicorn/references/industry-benchmarks.md +67 -0
  88. package/templates/.claude/skills/reverse-engineering-unicorn/references/jtbd-canvas.md +48 -0
  89. package/templates/.claude/skills/sparc-prd-mini/SKILL.md +955 -0
  90. package/templates/.claude/skills/sparc-prd-mini/references/sparc-methodology.md +360 -0
  91. package/templates/.claude/skills/sparc-prd-mini/templates/CLAUDE.md +91 -0
  92. package/templates/.claude/skills/sparc-prd-mini/templates/prd.md +336 -0
@@ -0,0 +1,106 @@
1
+ ---
2
+ description: >
3
+ Knowledge extraction from the current project into reusable toolkit artifacts.
4
+ Scans codebase, classifies findings, decontextualizes, and integrates into toolkit.
5
+ $ARGUMENTS: mode (quick/full/marker) + optional scope ("only patterns", "only rules", etc.)
6
+ ---
7
+
8
+ # /harvest $ARGUMENTS
9
+
10
+ ## Role
11
+
12
+ Knowledge harvester. You extract reusable artifacts from the current project —
13
+ patterns, commands, hooks, rules, templates, snippets, skills — and integrate
14
+ them into the toolkit as generalized, documented, versioned entries.
15
+
16
+ ## Skill Reference
17
+
18
+ Read the skill: `.claude/skills/knowledge-extractor/SKILL.md`
19
+
20
+ **IMPORTANT:** Read the skill BEFORE executing. It contains:
21
+ - 4-phase pipeline with checkpoints
22
+ - Swarm agent definitions for Phase 1
23
+ - 7 artifact categories with criteria
24
+ - Decontextualization guide
25
+ - Quality gate for Phase 3
26
+ - Templates for all outputs
27
+
28
+ ## Quick Reference
29
+
30
+ ### Modes
31
+
32
+ | Mode | Trigger | What Happens |
33
+ |------|---------|-------------|
34
+ | `marker` | `/harvest marker [description]` | Append to TOOLKIT_HARVEST.md |
35
+ | `quick` | `/harvest quick` or `/harvest` | Auto scan + classify + report (no checkpoints) |
36
+ | `full` | `/harvest full` | 4-phase pipeline with checkpoints |
37
+
38
+ ### Execution
39
+
40
+ 1. Determine mode from $ARGUMENTS (default: quick)
41
+ 2. Read skill: `.claude/skills/knowledge-extractor/SKILL.md`
42
+ 3. If mode == marker: create/append TOOLKIT_HARVEST.md, done
43
+ 4. If mode == quick: run all 4 phases without checkpoints
44
+ 5. If mode == full: run with checkpoints after each phase
45
+
46
+ ### Phase Summary
47
+
48
+ ```
49
+ Phase 1: AGENT REVIEW — scan codebase with 5 parallel agents
50
+ Phase 2: CLASSIFY — categorize into 7 artifact types, filter exclusions
51
+ Phase 3: DECONTEXTUALIZE — generalize, document, version
52
+ Phase 4: INTEGRATE — write to toolkit, update index, harvest report
53
+ ```
54
+
55
+ ### Module References
56
+
57
+ | Phase | Module |
58
+ |-------|--------|
59
+ | Phase 1 | `.claude/skills/knowledge-extractor/modules/01-agent-review.md` |
60
+ | Phase 2 | `.claude/skills/knowledge-extractor/modules/02-classify.md` |
61
+ | Phase 3 | `.claude/skills/knowledge-extractor/modules/03-decontextualize.md` |
62
+ | Phase 4 | `.claude/skills/knowledge-extractor/modules/04-integrate.md` |
63
+
64
+ ### Reference Files
65
+
66
+ | Topic | File |
67
+ |-------|------|
68
+ | Artifact categories | `.claude/skills/knowledge-extractor/references/artifact-categories.md` |
69
+ | Maturity model | `.claude/skills/knowledge-extractor/references/maturity-model.md` |
70
+ | Decontextualization | `.claude/skills/knowledge-extractor/references/decontextualization-guide.md` |
71
+
72
+ ### Templates
73
+
74
+ | Template | File |
75
+ |----------|------|
76
+ | TOOLKIT_HARVEST.md | `.claude/skills/knowledge-extractor/templates/toolkit-harvest.md` |
77
+ | Artifact card | `.claude/skills/knowledge-extractor/templates/artifact-card.md` |
78
+ | Harvest report | `.claude/skills/knowledge-extractor/templates/harvest-report.md` |
79
+
80
+ ## Checkpoint Commands (full mode)
81
+
82
+ | Command | Action |
83
+ |---------|--------|
84
+ | `ок` | Next phase |
85
+ | `добавь [finding]` | Add manual finding |
86
+ | `убери #N` | Remove finding |
87
+ | `переклассифицируй #N` | Change category |
88
+ | `доработай #N` | Improve artifact |
89
+ | `покажи #N` | Preview artifact |
90
+
91
+ ## Critical Rules
92
+
93
+ ### ALWAYS
94
+ - Read skill SKILL.md before executing
95
+ - Use swarm agents (Task tool) for Phase 1 — parallel extraction
96
+ - Apply exclusion filter in Phase 2 (no domain code, no unvalidated patterns)
97
+ - Decontextualize in Phase 3 (no project-specific references)
98
+ - Assign maturity level to every artifact
99
+ - Record provenance (source project, date)
100
+
101
+ ### NEVER
102
+ - Don't copy code verbatim — always decontextualize
103
+ - Don't extract domain-specific business logic
104
+ - Don't extract library workarounds without expiry dates
105
+ - Don't skip Phase 3 — undecontextualized artifacts are tech debt
106
+ - Don't set maturity higher than 🔴 Alpha for first extraction
@@ -0,0 +1,389 @@
1
+ ---
2
+ description: >
3
+ Replicate pipeline — полный цикл подготовки проекта к Vibe Coding.
4
+ Генерирует SPARC документацию, валидирует, создаёт project-specific toolkit.
5
+ $ARGUMENTS: описание продукта/идеи или название компании для reverse engineering.
6
+ ---
7
+
8
+ # /replicate $ARGUMENTS
9
+
10
+ ## Role
11
+
12
+ Координатор подготовки к Vibe Coding. Генерируешь всё для старта проекта
13
+ в Claude Code — прямо в текущем репозитории, без zip-архивов.
14
+
15
+ ## Target Architecture (Constraints)
16
+
17
+ Все проекты создаются под эту целевую архитектуру:
18
+
19
+ | Аспект | Решение |
20
+ |--------|---------|
21
+ | **Архитектура** | Distributed Monolith в Monorepo |
22
+ | **Контейнеризация** | Docker + Docker Compose |
23
+ | **Инфраструктура** | VPS (AdminVPS/HOSTKEY) |
24
+ | **Деплой** | Docker Compose на VPS (direct deploy) |
25
+ | **AI Integration** | MCP серверы |
26
+
27
+ ## Skills (loaded from .claude/skills/)
28
+
29
+ All skills are available locally. Read their SKILL.md when needed:
30
+
31
+ | Skill | Path | Phase |
32
+ |-------|------|-------|
33
+ | reverse-engineering-unicorn | `.claude/skills/reverse-engineering-unicorn/SKILL.md` | Phase 0 |
34
+ | sparc-prd-mini | `.claude/skills/sparc-prd-mini/SKILL.md` | Phase 1 |
35
+ | explore | `.claude/skills/explore/SKILL.md` | Phase 1 (dependency) |
36
+ | goap-research-ed25519 | `.claude/skills/goap-research-ed25519/SKILL.md` | Phase 1 (dependency) |
37
+ | problem-solver-enhanced | `.claude/skills/problem-solver-enhanced/SKILL.md` | Phase 1 (dependency) |
38
+ | requirements-validator | `.claude/skills/requirements-validator/SKILL.md` | Phase 2 |
39
+ | cc-toolkit-generator-enhanced | `.claude/skills/cc-toolkit-generator-enhanced/SKILL.md` | Phase 3 |
40
+ | brutal-honesty-review | `.claude/skills/brutal-honesty-review/SKILL.md` | Phase 4 (/feature) |
41
+
42
+ **IMPORTANT (Claude Code adaptation):**
43
+ - Skills reference `view("/mnt/skills/user/...")` paths from claude.ai
44
+ - In Claude Code, replace ALL such references with `.claude/skills/[name]/SKILL.md`
45
+ - When sparc-prd-mini calls `view("/mnt/skills/user/explore/SKILL.md")`, read `.claude/skills/explore/SKILL.md` instead
46
+ - When sparc-prd-mini calls `view("/mnt/skills/user/goap-research/SKILL.md")`, read `.claude/skills/goap-research-ed25519/SKILL.md` instead
47
+
48
+ ## Pipeline
49
+
50
+ ```
51
+ INPUT → [PRODUCT DISCOVERY] → PLANNING → VALIDATION → TOOLKIT → FINALIZE
52
+ (optional) sparc-prd requirements cc-toolkit commit
53
+ -mini -validator -generator & report
54
+ ```
55
+
56
+ **Note:** sparc-prd-mini v2 already includes Explore, Research, and Solve phases
57
+ internally via skill references. The coordinator does NOT duplicate these phases.
58
+
59
+ ## Execution
60
+
61
+ ### Start
62
+
63
+ 1. Briefly explain the phases (4 main + 1 optional)
64
+ 2. Mention the target architecture (distributed monolith + Docker на VPS)
65
+ 3. Determine project type → is Product Discovery needed?
66
+ 4. Begin with the relevant phase
67
+
68
+ ### Phase 0: PRODUCT DISCOVERY (optional)
69
+
70
+ **Gate — when to activate:**
71
+ - New product / startup / SaaS → **activate**
72
+ - Competitors to analyze → **activate**
73
+ - Internal tool / experiment → **skip**
74
+
75
+ Read the skill: `.claude/skills/reverse-engineering-unicorn/SKILL.md`
76
+
77
+ **Mode:** QUICK (sufficient for informing PRD)
78
+
79
+ **Selected modules:**
80
+
81
+ | Module | When needed | Output for PRD |
82
+ |--------|------------|----------------|
83
+ | M2: Product & Customers | Always | JTBD, Value Prop, segments |
84
+ | M3: Market & Competition | Always | TAM/SAM, competitors, Blue Ocean |
85
+ | M4: Business & Finance | If monetization | Unit economics |
86
+ | M5: Growth Engine | If B2C/PLG | Channels, integrations |
87
+
88
+ **Output:** Product Discovery Brief → passed as pre-filled context to Phase 1
89
+
90
+ **Checkpoint:**
91
+ ```
92
+ ═══════════════════════════════════════════════════════════════
93
+ ✅ PHASE 0: PRODUCT DISCOVERY
94
+ [Summary from brief]
95
+ ⏸️ "ок" — next | "превью discovery" — show brief
96
+ ═══════════════════════════════════════════════════════════════
97
+ ```
98
+
99
+ ### Phase 1: PLANNING
100
+
101
+ Read the skill: `.claude/skills/sparc-prd-mini/SKILL.md`
102
+
103
+ **sparc-prd-mini v2 runs 8 internal phases:**
104
+ - Phase 0: Explore → explore skill (read from `.claude/skills/explore/SKILL.md`)
105
+ - Phase 1: Research → goap-research-ed25519 skill (read from `.claude/skills/goap-research-ed25519/SKILL.md`)
106
+ - Phase 2: Solve → problem-solver-enhanced skill (read from `.claude/skills/problem-solver-enhanced/SKILL.md`)
107
+ - Phases 3-7: Specification, Pseudocode, Architecture, Refinement, Completion
108
+
109
+ **Pass context to the skill:**
110
+
111
+ ```yaml
112
+ Architecture Constraints:
113
+ pattern: "Distributed Monolith (Monorepo)"
114
+ containers: "Docker + Docker Compose"
115
+ infrastructure: "VPS (AdminVPS/HOSTKEY)"
116
+ deploy: "Docker Compose direct deploy (SSH / CI pipeline)"
117
+ ai_integration: "MCP servers"
118
+
119
+ Product Context: # From Phase 0 (if applicable)
120
+ target_segments: [from JTBD]
121
+ key_competitors: [from competitive matrix]
122
+ differentiation: [from Blue Ocean]
123
+ monetization: [from Unit Economics]
124
+
125
+ Security Pattern: # If external integrations
126
+ api_keys_input: "UI Settings > Integrations"
127
+ storage: "Encrypted IndexedDB (AES-GCM 256-bit)"
128
+ key_derivation: "PBKDF2 from user password"
129
+ server_side: "No key storage on backend"
130
+ ```
131
+
132
+ **Mode:** MANUAL (checkpoint at each phase inside sparc-prd-mini)
133
+
134
+ **Output location:** `docs/` directory (NOT `/output/` — write directly into the project)
135
+
136
+ Write all 11 documents to `docs/`:
137
+ - `docs/PRD.md`
138
+ - `docs/Solution_Strategy.md`
139
+ - `docs/Specification.md`
140
+ - `docs/Pseudocode.md`
141
+ - `docs/Architecture.md`
142
+ - `docs/Refinement.md`
143
+ - `docs/Completion.md`
144
+ - `docs/Research_Findings.md`
145
+ - `docs/Final_Summary.md`
146
+ - `docs/C4_Diagrams.md` (if applicable)
147
+ - `docs/ADR.md` (if applicable)
148
+
149
+ Git commit: `docs: SPARC documentation for [project-name]`
150
+
151
+ **Checkpoint:**
152
+ ```
153
+ ═══════════════════════════════════════════════════════════════
154
+ ✅ PHASE 1: PLANNING (SPARC DOCUMENTATION)
155
+ Created [N] documents in docs/
156
+ ⏸️ "ок" — next to validation | "превью [filename]" — show file
157
+ ═══════════════════════════════════════════════════════════════
158
+ ```
159
+
160
+ ### Phase 2: VALIDATION
161
+
162
+ Read the skill: `.claude/skills/requirements-validator/SKILL.md`
163
+
164
+ **Goal:** Verify all documentation for completeness, testability, and implementation readiness.
165
+
166
+ **Strategy: Swarm of Validation Agents**
167
+
168
+ | Agent | Scope | Criteria |
169
+ |-------|-------|----------|
170
+ | `validator-stories` | PRD → User Stories | INVEST criteria, score ≥70 |
171
+ | `validator-acceptance` | Stories → AC | SMART criteria, testability |
172
+ | `validator-architecture` | Architecture.md | Target constraints, completeness |
173
+ | `validator-pseudocode` | Pseudocode.md | Story coverage, implementability |
174
+ | `validator-coherence` | Cross-document | Consistency, no contradictions |
175
+
176
+ **Process (iterative, max 3 iterations):**
177
+
178
+ ```
179
+ 1. ANALYZE — parallel validator agents (use Task tool)
180
+ 2. AGGREGATE — Gap Register + Blocked/Warning items
181
+ 3. FIX — resolve gaps in documentation
182
+ 4. RE-VALIDATE — re-check fixes
183
+ ↻ Until: no BLOCKED (≥50), average ≥70, no contradictions
184
+ ```
185
+
186
+ **BDD Scenarios Generation:**
187
+ - Happy path (1-2), Error handling (2-3), Edge cases (1-2), Security
188
+ - Save as `docs/test-scenarios.md`
189
+
190
+ **Save validation report:** `docs/validation-report.md`
191
+
192
+ Git commit: `docs: validation report and BDD scenarios`
193
+
194
+ **Exit Criteria:**
195
+
196
+ | Verdict | Conditions | Action |
197
+ |---------|-----------|--------|
198
+ | 🟢 READY | All scores ≥50, average ≥70, no contradictions | → Phase 3 |
199
+ | 🟡 CAVEATS | Warnings exist, no blocked, limitations described | → Phase 3 with notes |
200
+ | 🔴 NEEDS WORK | Blocked items exist | → Return to Phase 1 |
201
+
202
+ **Checkpoint:**
203
+ ```
204
+ ═══════════════════════════════════════════════════════════════
205
+ ✅ PHASE 2: VALIDATION COMPLETE
206
+ Verdict: [🟢/🟡/🔴]
207
+ Average Score: XX/100
208
+ Iterations: N/3
209
+ ⏸️ "ок" — generate toolkit | "превью validation" — show report
210
+ ═══════════════════════════════════════════════════════════════
211
+ ```
212
+
213
+ ### Phase 3: TOOLKIT GENERATION
214
+
215
+ Read the skill: `.claude/skills/cc-toolkit-generator-enhanced/SKILL.md`
216
+
217
+ **Goal:** Generate project-specific Claude Code instruments IN-PLACE.
218
+
219
+ **IMPORTANT (Claude Code adaptation):**
220
+ - Scan `docs/` directory for SPARC documents (NOT `/mnt/user-data/uploads/`)
221
+ - Generate files IN-PLACE into the project (NOT into output directory)
222
+ - Lifecycle skills already exist in `.claude/skills/` — do NOT copy
223
+ - Generic commands (`/feature`, `/myinsights`) already exist — do NOT overwrite
224
+ - Generic rules (`feature-lifecycle`, `insights-capture`, `git-workflow`) already exist — do NOT overwrite
225
+ - `settings.json` already exists with hooks — do NOT overwrite
226
+
227
+ **Generate these project-specific files:**
228
+
229
+ **1. Enhance CLAUDE.md** (root) with project-specific content:
230
+ - Project overview from PRD.md
231
+ - Architecture from Architecture.md
232
+ - Tech stack decisions
233
+ - Parallel execution strategy
234
+ - Swarm agents section
235
+ - Available agents/skills/commands list
236
+ - Development insights section
237
+ - Feature lifecycle section
238
+
239
+ **2. Commands (`.claude/commands/`):**
240
+ - `start.md` — project bootstrap (uses /start template from cc-toolkit skill)
241
+ - `plan.md` — implementation planning
242
+ - `test.md` — test generation/execution
243
+ - `deploy.md` — deployment workflow
244
+
245
+ **3. Agents (`.claude/agents/`):**
246
+ - `planner.md` — feature planning with algorithm templates from Pseudocode.md
247
+ - `code-reviewer.md` — quality review with edge cases from Refinement.md
248
+ - `architect.md` — system design from Architecture.md + Solution_Strategy.md
249
+ - Additional agents based on project characteristics
250
+
251
+ **4. Project-specific Rules (`.claude/rules/`):**
252
+ - `security.md` — from Specification.md NFRs
253
+ - `coding-style.md` — from Architecture.md tech stack
254
+ - `secrets-management.md` — IF external APIs detected
255
+ - `testing.md` — from Refinement.md test strategy
256
+
257
+ **5. Project-specific Skills (`.claude/skills/`):**
258
+ - `project-context/` — domain knowledge from Research_Findings.md
259
+ - `coding-standards/` — tech-specific patterns from Architecture.md
260
+ - `security-patterns/` — IF external APIs (encrypted storage pattern)
261
+
262
+ **6. Additional files:**
263
+ - `.mcp.json` — IF external integrations
264
+ - `DEVELOPMENT_GUIDE.md` — step-by-step development lifecycle
265
+ - `README.md` — enhanced with project info
266
+
267
+ Git commit: `feat: Claude Code toolkit for [project-name]`
268
+
269
+ **Checkpoint:**
270
+ ```
271
+ ═══════════════════════════════════════════════════════════════
272
+ ✅ PHASE 3: TOOLKIT GENERATED
273
+ - CLAUDE.md enhanced with project context
274
+ - [N] agents + [N] commands + [N] rules generated
275
+ - DEVELOPMENT_GUIDE.md created
276
+ ⏸️ "ок" — finalize | "превью toolkit" — show structure
277
+ ═══════════════════════════════════════════════════════════════
278
+ ```
279
+
280
+ ### Phase 4: FINALIZE
281
+
282
+ **Goal:** Generate scaffold files, commit everything, show summary.
283
+
284
+ **Generate scaffold files:**
285
+
286
+ 1. `docker-compose.yml` — from Architecture.md services
287
+ 2. `Dockerfile` — from Architecture.md tech stack
288
+ 3. `.gitignore` — if not exists
289
+ 4. `docs/features/` — create empty directory for future features
290
+
291
+ **Git operations:**
292
+ ```bash
293
+ git add .
294
+ git commit -m "chore: initial project setup from SPARC documentation"
295
+ ```
296
+
297
+ **Show final summary:**
298
+ ```
299
+ ═══════════════════════════════════════════════════════════════
300
+ ✅ REPLICATE COMPLETE: [project-name]
301
+
302
+ 📁 Project structure:
303
+ ├── CLAUDE.md # Project context
304
+ ├── DEVELOPMENT_GUIDE.md # Dev lifecycle guide
305
+ ├── README.md # Quick start
306
+ ├── docs/ # [N] SPARC documents
307
+ │ ├── validation-report.md # Validation results
308
+ │ ├── test-scenarios.md # BDD scenarios
309
+ │ └── features/ # For future features
310
+ ├── .claude/
311
+ │ ├── commands/ # /start, /feature, /plan, /test, /deploy, /myinsights
312
+ │ ├── agents/ # planner, code-reviewer, architect
313
+ │ ├── skills/ # 8 shared + project-specific skills
314
+ │ ├── rules/ # git-workflow, security, coding-style, ...
315
+ │ └── settings.json # Hooks (insights auto-commit)
316
+ ├── docker-compose.yml # Scaffold
317
+ └── Dockerfile # Scaffold
318
+
319
+ 🚀 Next steps:
320
+ 1. Run /start to bootstrap the project
321
+ 2. First feature: [recommended from PRD MVP]
322
+
323
+ 💡 Available commands:
324
+ - /start — bootstrap project from docs
325
+ - /feature [name] — full feature lifecycle
326
+ - /plan [feature] — plan implementation
327
+ - /test [scope] — run/generate tests
328
+ - /deploy [env] — deploy to environment
329
+ - /myinsights — capture development insights
330
+ ═══════════════════════════════════════════════════════════════
331
+ ```
332
+
333
+ ## Development Practices (embedded in toolkit)
334
+
335
+ ### 1. Swarm of Agents & Parallel Execution
336
+
337
+ Include in CLAUDE.md:
338
+ ```markdown
339
+ ## Parallel Execution Strategy
340
+ - Use `Task` tool for independent subtasks
341
+ - Run tests, linting, type-checking in parallel
342
+ - For complex features: spawn specialized agents
343
+ ```
344
+
345
+ ### 2. Client-Side Secrets Management (if external APIs)
346
+
347
+ **Mandatory pattern for apps with external integrations:**
348
+
349
+ ```
350
+ PRINCIPLE: User enters keys via UI → stored encrypted in browser → NEVER sent to backend
351
+ ```
352
+
353
+ **Security Implementation:**
354
+ - Encryption at Rest: AES-GCM 256-bit (Web Crypto API)
355
+ - Key derivation: PBKDF2 from user password (100k+ iterations)
356
+ - Storage: IndexedDB for encrypted data, master key only in memory
357
+ - Auto-lock after inactivity timeout
358
+ - Never: transmit to backend, log, store in plaintext
359
+
360
+ ## Checkpoint Commands
361
+
362
+ | Command | Action |
363
+ |---------|--------|
364
+ | `ок` | Next phase |
365
+ | `превью [filename]` | View generated file |
366
+ | `превью discovery` | Show Product Discovery Brief |
367
+ | `превью validation` | Show Validation Report |
368
+ | `превью toolkit` | Show toolkit structure |
369
+
370
+ ## Critical Rules
371
+
372
+ ### ALWAYS
373
+ - Read skill SKILL.md before executing its logic
374
+ - Checkpoint after each phase
375
+ - Pass Architecture Constraints to sparc-prd-mini
376
+ - Write docs to `docs/` directory (not `/output/`)
377
+ - Generate toolkit IN-PLACE (not into separate directory)
378
+ - Use existing generic commands/rules (don't regenerate /feature, /myinsights, etc.)
379
+
380
+ ### NEVER
381
+ - Don't duplicate explore/research phases — sparc-prd-mini does this internally
382
+ - Never skip validation — toolkit is built on validated docs
383
+ - Never use base cc-toolkit-generator — only enhanced version
384
+ - Don't overwrite template files (generic commands, rules, settings.json)
385
+
386
+ ### CONDITIONAL
387
+ - If external APIs → include security-patterns/ skill + secrets-management.md rule
388
+ - If new product → start with Phase 0 (Product Discovery)
389
+ - If B2B/Enterprise → strengthen security patterns in validation
@@ -0,0 +1,92 @@
1
+ # Replicate Pipeline Rules
2
+
3
+ ## Phase Sequence
4
+
5
+ The `/replicate` command executes phases in strict order:
6
+
7
+ ```
8
+ Phase 0 (optional) → Phase 1 → Phase 2 → Phase 3 → Phase 4
9
+ Product Discovery Planning Validation Toolkit Finalize
10
+ ```
11
+
12
+ Never skip Phase 2 (Validation). Toolkit (Phase 3) MUST be built on validated documentation.
13
+
14
+ ## Skill Loading Protocol
15
+
16
+ When executing skills during the pipeline:
17
+
18
+ 1. Read the skill's `SKILL.md` file from `.claude/skills/[name]/SKILL.md`
19
+ 2. When a skill references `/mnt/skills/user/[name]/` — read from `.claude/skills/[name]/` instead
20
+ 3. When a skill references `/mnt/user-data/uploads/` — read from `docs/` instead
21
+ 4. When a skill outputs to `/output/` — write to `docs/` or project root instead
22
+ 5. `goap-research` skill name maps to `goap-research-ed25519` in this repo
23
+
24
+ ## Output Paths
25
+
26
+ All generated files go directly into the project. Never create a separate output directory.
27
+
28
+ | Category | Path |
29
+ |----------|------|
30
+ | SPARC documentation | `docs/` |
31
+ | Validation report | `docs/validation-report.md` |
32
+ | BDD scenarios | `docs/test-scenarios.md` |
33
+ | Feature docs (future) | `docs/features/` |
34
+ | Commands | `.claude/commands/` |
35
+ | Agents | `.claude/agents/` |
36
+ | Rules | `.claude/rules/` |
37
+ | Skills (project-specific) | `.claude/skills/` |
38
+ | Hooks | `.claude/settings.json` |
39
+ | Project context | `CLAUDE.md` (root) |
40
+ | Dev guide | `DEVELOPMENT_GUIDE.md` |
41
+ | Scaffolds | `docker-compose.yml`, `Dockerfile`, `.gitignore` |
42
+
43
+ ## Architecture Constraints
44
+
45
+ Always pass these constraints to sparc-prd-mini (Phase 1):
46
+
47
+ - Pattern: Distributed Monolith (Monorepo)
48
+ - Containers: Docker + Docker Compose
49
+ - Infrastructure: VPS (AdminVPS/HOSTKEY)
50
+ - Deploy: Docker Compose direct deploy
51
+ - AI Integration: MCP servers
52
+
53
+ ## Git Discipline During Pipeline
54
+
55
+ Commit after each major phase completion:
56
+ - After Phase 1: `docs: SPARC documentation for [project-name]`
57
+ - After Phase 2: `docs: validation report and BDD scenarios`
58
+ - After Phase 3: `feat: Claude Code toolkit for [project-name]`
59
+ - After Phase 4: `chore: initial project setup from SPARC documentation`
60
+
61
+ ## What Gets Generated vs Pre-existing
62
+
63
+ ### Pre-existing (template files — do NOT overwrite)
64
+ - `.claude/skills/*` — all 10 skills
65
+ - `.claude/commands/replicate.md` — this pipeline
66
+ - `.claude/commands/harvest.md` — knowledge extraction pipeline
67
+ - `.claude/agents/replicate-coordinator.md`
68
+ - `.claude/agents/product-discoverer.md`
69
+ - `.claude/agents/doc-validator.md`
70
+ - `.claude/agents/harvest-coordinator.md`
71
+ - `.claude/rules/replicate-pipeline.md` — this file
72
+
73
+ ### Generated by /replicate (create new)
74
+ - `.claude/commands/start.md`, `feature.md`, `plan.md`, `myinsights.md`, `deploy.md`
75
+ - `.claude/agents/planner.md`, `code-reviewer.md`, `architect.md`
76
+ - `.claude/rules/git-workflow.md`, `insights-capture.md`, `feature-lifecycle.md`, `security.md`, `coding-style.md`
77
+ - `.claude/settings.json` — hooks
78
+ - `docs/*` — all documentation
79
+ - `CLAUDE.md`, `README.md`, `DEVELOPMENT_GUIDE.md`
80
+ - `docker-compose.yml`, `Dockerfile`, `.gitignore`
81
+
82
+ ## Checkpoint Format
83
+
84
+ ```
85
+ ═══════════════════════════════════════════════════════════════
86
+ ✅ PHASE [N]: [Name]
87
+ [Summary]
88
+ ⏸️ "ок" — next | [options]
89
+ ═══════════════════════════════════════════════════════════════
90
+ ```
91
+
92
+ Always wait for user confirmation before proceeding to the next phase.