@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,178 @@
1
+ # CLAUDE.md Generation Strategy
2
+
3
+ This file defines how to generate CLAUDE.md for each pipeline. Both strategies share
4
+ a common base of sections; only the top sections differ by pipeline.
5
+
6
+ ## Pipeline Detection
7
+
8
+ - Has `docs/ddd/` or `.ai-context/` → **idea2prd-manual pipeline**
9
+ - Otherwise → **SPARC pipeline**
10
+
11
+ ## SPARC Pipeline — Top Sections
12
+
13
+ ```markdown
14
+ # Project: [Name]
15
+
16
+ ## Overview
17
+ [From PRD.md Executive Summary]
18
+
19
+ ## Problem & Solution
20
+ [From Solution_Strategy.md — 2-3 sentences]
21
+
22
+ ## Architecture
23
+ [From Architecture.md — monorepo structure, tech stack]
24
+
25
+ ## Tech Stack
26
+ [From Architecture.md decisions table]
27
+
28
+ ## Key Algorithms
29
+ [From Pseudocode.md — top 3-5 function signatures]
30
+
31
+ ## Security Rules
32
+ ⚠️ [From Specification.md security requirements]
33
+ [IF has_external_apis: client-side encryption mandatory]
34
+ ```
35
+
36
+ ## idea2prd Pipeline — Top Sections
37
+
38
+ ```markdown
39
+ # Project: [Name]
40
+
41
+ ## Overview
42
+ [From .ai-context/README.md]
43
+
44
+ ## Architecture
45
+ [From .ai-context/architecture-summary.md]
46
+
47
+ ## Key Decisions
48
+ [From .ai-context/key-decisions.md — top 5 ADRs]
49
+
50
+ ## Domain Model
51
+ [From .ai-context/bounded-contexts.md]
52
+
53
+ ## Glossary
54
+ [From .ai-context/domain-glossary.md — key terms]
55
+
56
+ ## Tech Stack
57
+ [From ADRs + architecture-summary]
58
+
59
+ ## Coding Standards
60
+ [From .ai-context/coding-standards.md]
61
+
62
+ ## Quality Gates
63
+ [From .ai-context/fitness-rules.md]
64
+ ```
65
+
66
+ ## Common Sections (both pipelines)
67
+
68
+ Include ALL of the following sections after the pipeline-specific top sections.
69
+ These are identical regardless of pipeline.
70
+
71
+ ```markdown
72
+ ## Parallel Execution Strategy
73
+ - Use `Task` tool for independent subtasks
74
+ - Run tests, linting, type-checking in parallel
75
+ - For complex features: spawn specialized agents
76
+
77
+ ## Swarm Agents
78
+ | Scenario | Agents | Parallelism |
79
+ |----------|--------|-------------|
80
+ | Large feature | planner + 2-3 implementation agents | Yes |
81
+ | Refactoring | code-reviewer + refactor agents | Yes |
82
+ | Bug fix | 1 agent | No |
83
+
84
+ ## Git Workflow
85
+ - Commit after each logical change
86
+ - Format: `type(scope): description`
87
+ - Types: feat, fix, refactor, test, docs, chore
88
+
89
+ ## Available Agents
90
+ [Generated list with trigger descriptions]
91
+
92
+ ## Available Skills
93
+ [Generated list]
94
+
95
+ ## Quick Commands
96
+ [Generated list — /start first]
97
+
98
+ ## 🔍 Development Insights (живая база знаний)
99
+ Index: [myinsights/1nsights.md](myinsights/1nsights.md) — check here FIRST before debugging.
100
+ ⚠️ On error → grep the error string in the index → read only the matched detail file.
101
+ Capture new findings: `/myinsights [title]`
102
+
103
+ ## 🔄 Feature Development Lifecycle
104
+ New features use the 4-phase lifecycle: `/feature [name]`
105
+ 1. **PLAN** — sparc-prd-mini (with Gate + external skills) → `docs/features/<n>/sparc/`
106
+ 2. **VALIDATE** — requirements-validator swarm → score ≥70
107
+ 3. **IMPLEMENT** — parallel agents from validated docs
108
+ 4. **REVIEW** — brutal-honesty-review swarm → fix all criticals
109
+
110
+ Available lifecycle skills in `.claude/skills/`:
111
+ - `sparc-prd-mini` (orchestrator, delegates to explore, goap-research, problem-solver-enhanced)
112
+ - `explore` (Socratic questioning → Product Brief)
113
+ - `goap-research` (GOAP A* + OODA → Research Findings)
114
+ - `problem-solver-enhanced` (9 modules + TRIZ → Solution Strategy)
115
+ - `requirements-validator`
116
+ - `brutal-honesty-review`
117
+ ```
118
+
119
+ ### Enterprise Lifecycle Section (IF DDD detected — add after Feature Lifecycle)
120
+
121
+ ```markdown
122
+ ## 🏢 Enterprise Feature Development Lifecycle
123
+ Complex domain features use the enterprise lifecycle: `/feature-ent [name]`
124
+ 1. **PLAN** — idea2prd-manual (DDD + ADR + C4 + Gherkin) → `docs/features/<n>/`
125
+ 2. **VALIDATE** — requirements-validator swarm (7 agents) → score ≥70
126
+ 3. **IMPLEMENT** — parallel agents per Bounded Context from validated docs
127
+ 4. **REVIEW** — brutal-honesty-review swarm (6 agents) → ADR + fitness verified
128
+
129
+ Use `/feature` for simple features, `/feature-ent` for complex domain features.
130
+
131
+ Available enterprise lifecycle skills in `.claude/skills/`:
132
+ - `idea2prd-manual` (orchestrator, delegates to explore, goap-research-ed25519, problem-solver-enhanced)
133
+ - `goap-research-ed25519` (crypto-verified research with Ed25519 signatures)
134
+ ```
135
+
136
+ ### Remaining Common Sections (always include)
137
+
138
+ ```markdown
139
+ ## 📋 Feature Roadmap
140
+ Roadmap: [.claude/feature-roadmap.json](.claude/feature-roadmap.json) — single source of truth for feature status.
141
+ Sprint progress and next steps are injected automatically at session start.
142
+ Quick check: `/next` | Full overview: ask "what should I work on?"
143
+ Mark done: `/next [feature-id]` | Update all: `/next update`
144
+
145
+ ## 📝 Implementation Plans
146
+ Plans: [docs/plans/](docs/plans/) — lightweight implementation plans.
147
+ Create: `/plan <feature-name>` | List: `/plan list` | Mark done: `/plan done <slug>`
148
+ For full feature lifecycle (10 docs, 4 phases): `/feature <n>`
149
+
150
+ ## 🚀 Automation Commands
151
+ - `/go [feature]` — auto-select pipeline (/plan, /feature, /feature-ent) and implement
152
+ - `/run` or `/run mvp` — bootstrap + implement all MVP features in a loop
153
+ - `/run all` — bootstrap + implement ALL features
154
+ - `/docs` — generate bilingual documentation (RU/EN) in /README/
155
+ - `/docs update` — update existing documentation
156
+
157
+ ## Resources
158
+ [Links to docs/ directory files]
159
+ ```
160
+
161
+ ## Source Priority Rules
162
+
163
+ | CLAUDE.md Section | Priority 1 | Priority 2 | Priority 3 |
164
+ |-------------------|------------|------------|------------|
165
+ | Overview | .ai-context/README | PRD Executive Summary | Final_Summary |
166
+ | Architecture | .ai-context/architecture | Architecture.md | — |
167
+ | Tech Stack | Architecture.md | ADRs | — |
168
+ | Key Decisions | .ai-context/key-decisions | ADRs | Solution_Strategy |
169
+ | Security | Specification.md | Fitness Functions | Architecture.md |
170
+ | Agents list | Generated from .claude/agents/ | — | — |
171
+ | Skills list | Generated from .claude/skills/ | — | — |
172
+ | Commands list | Generated from .claude/commands/ | — | — |
173
+
174
+ ## Context Budget for CLAUDE.md
175
+
176
+ - **Target:** 4,000 tokens
177
+ - **Maximum:** 6,000 tokens
178
+ - **Rule:** If content exceeds max, prioritize: Overview > Architecture > Security > Lifecycle sections > Generated lists
@@ -0,0 +1,416 @@
1
+ # Enhanced Recommendations Engine
2
+
3
+ Smart recommendation rules for idea2prd-manual documents.
4
+
5
+ ## Detection Phase
6
+
7
+ ### Pipeline Detection
8
+
9
+ ```python
10
+ def detect_pipeline(uploads_path: str) -> str:
11
+ """Detect source documentation pipeline."""
12
+
13
+ has_ddd = exists(f"{uploads_path}/docs/ddd/")
14
+ has_ai_context = exists(f"{uploads_path}/.ai-context/")
15
+ has_gherkin = glob(f"{uploads_path}/docs/tests/*.feature")
16
+ has_adr = len(glob(f"{uploads_path}/docs/adr/*.md")) > 5
17
+ has_sparc = exists(f"{uploads_path}/Architecture.md")
18
+
19
+ if has_ddd and has_ai_context:
20
+ return "IDEA2PRD_FULL" # Complete idea2prd-manual output
21
+ elif has_ddd or has_adr:
22
+ return "IDEA2PRD_PARTIAL" # Partial idea2prd output
23
+ elif has_sparc:
24
+ return "SPARC" # SPARC-only documentation
25
+ else:
26
+ return "MINIMAL" # Basic PRD only
27
+ ```
28
+
29
+ ## Scoring Rules
30
+
31
+ ### Base Scores by Pipeline
32
+
33
+ | Pipeline | Base Score | Additional Features |
34
+ |----------|------------|---------------------|
35
+ | IDEA2PRD_FULL | +20 | All DDD agents, all skills |
36
+ | IDEA2PRD_PARTIAL | +15 | Core DDD agents |
37
+ | SPARC | +10 | Standard agents |
38
+ | MINIMAL | +5 | Basic agents only |
39
+
40
+ ---
41
+
42
+ ## DDD-Specific Recommendations
43
+
44
+ ### domain-expert.md Agent
45
+
46
+ ```python
47
+ score = 5 # base
48
+
49
+ if exists("docs/ddd/strategic/bounded-contexts.md"):
50
+ score += 10
51
+
52
+ if exists(".ai-context/domain-glossary.md"):
53
+ score += 5
54
+ terms = count_terms(".ai-context/domain-glossary.md")
55
+ if terms > 20:
56
+ score += 3
57
+
58
+ if exists(".ai-context/bounded-contexts.md"):
59
+ score += 5
60
+
61
+ # RECOMMEND if score >= 15
62
+ ```
63
+
64
+ ### ddd-validator.md Agent
65
+
66
+ ```python
67
+ score = 5 # base
68
+
69
+ aggregates = glob("docs/ddd/tactical/aggregates/*.md")
70
+ if len(aggregates) > 3:
71
+ score += 8
72
+ if len(aggregates) > 7:
73
+ score += 5
74
+
75
+ if exists("docs/fitness/fitness-functions.md"):
76
+ score += 5
77
+ functions = count_functions("docs/fitness/fitness-functions.md")
78
+ if functions > 5:
79
+ score += 3
80
+
81
+ # RECOMMEND if score >= 15
82
+ ```
83
+
84
+ ### aggregate-patterns/ Skill
85
+
86
+ ```python
87
+ score = 5 # base
88
+
89
+ aggregates = glob("docs/ddd/tactical/aggregates/*.md")
90
+ if len(aggregates) > 0:
91
+ score += 8
92
+
93
+ entities = glob("docs/ddd/tactical/entities/*.md")
94
+ if len(entities) > 0:
95
+ score += 3
96
+
97
+ value_objects = glob("docs/ddd/tactical/value-objects/*.md")
98
+ if len(value_objects) > 0:
99
+ score += 3
100
+
101
+ # RECOMMEND if score >= 12
102
+ ```
103
+
104
+ ### event-handlers/ Skill
105
+
106
+ ```python
107
+ score = 5 # base
108
+
109
+ events = glob("docs/ddd/tactical/events/*.md")
110
+ if len(events) > 0:
111
+ score += 10
112
+ if len(events) > 5:
113
+ score += 5
114
+
115
+ # RECOMMEND if score >= 12
116
+ ```
117
+
118
+ ---
119
+
120
+ ## ADR-Specific Recommendations
121
+
122
+ ### architect.md Agent (Enhanced)
123
+
124
+ ```python
125
+ score = 10 # base (always somewhat useful)
126
+
127
+ adrs = glob("docs/adr/*.md")
128
+ if len(adrs) > 5:
129
+ score += 5
130
+ if len(adrs) > 10:
131
+ score += 5
132
+ if len(adrs) > 15:
133
+ score += 3
134
+
135
+ if exists("docs/c4/context.mermaid"):
136
+ score += 3
137
+ if exists("docs/c4/container.mermaid"):
138
+ score += 3
139
+
140
+ # RECOMMEND if score >= 15
141
+ ```
142
+
143
+ ### Security Rules Boost
144
+
145
+ ```python
146
+ security_boost = 0
147
+
148
+ for adr in glob("docs/adr/*.md"):
149
+ content = read(adr)
150
+ if "security" in content.lower():
151
+ security_boost += 2
152
+ if "authentication" in content.lower():
153
+ security_boost += 1
154
+ if "encryption" in content.lower():
155
+ security_boost += 1
156
+
157
+ # Apply boost to security.md rule score
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Gherkin-Specific Recommendations
163
+
164
+ ### testing-patterns/ Skill (Enhanced)
165
+
166
+ ```python
167
+ score = 5 # base
168
+
169
+ features = glob("docs/tests/*.feature")
170
+ if len(features) > 0:
171
+ score += 10
172
+
173
+ total_scenarios = 0
174
+ for feature in features:
175
+ total_scenarios += count_scenarios(feature)
176
+
177
+ if total_scenarios > 10:
178
+ score += 5
179
+ if total_scenarios > 20:
180
+ score += 3
181
+
182
+ # RECOMMEND if score >= 12
183
+ ```
184
+
185
+ ### tdd-guide.md Agent (Enhanced)
186
+
187
+ ```python
188
+ score = 5 # base
189
+
190
+ if glob("docs/tests/*.feature"):
191
+ score += 5
192
+
193
+ if glob("docs/pseudocode/*.pseudo"):
194
+ score += 5
195
+
196
+ if exists("docs/fitness/fitness-functions.md"):
197
+ content = read("docs/fitness/fitness-functions.md")
198
+ if "coverage" in content.lower():
199
+ score += 3
200
+
201
+ # RECOMMEND if score >= 12
202
+ ```
203
+
204
+ ### /test Command
205
+
206
+ ```python
207
+ score = 10 # base (always useful)
208
+
209
+ features = glob("docs/tests/*.feature")
210
+ if len(features) > 0:
211
+ score += 10 # Highly recommended with Gherkin
212
+
213
+ # RECOMMEND if score >= 15
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Pseudocode-Specific Recommendations
219
+
220
+ ### planner.md Agent (Enhanced)
221
+
222
+ ```python
223
+ score = 10 # base
224
+
225
+ pseudo_files = glob("docs/pseudocode/*.pseudo")
226
+ if len(pseudo_files) > 0:
227
+ score += 8
228
+ if len(pseudo_files) > 5:
229
+ score += 5
230
+
231
+ total_lines = 0
232
+ for pseudo in pseudo_files:
233
+ total_lines += count_lines(pseudo)
234
+
235
+ if total_lines > 200:
236
+ score += 3
237
+
238
+ # RECOMMEND if score >= 15
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Fitness-Specific Recommendations
244
+
245
+ ### Validation Hooks
246
+
247
+ ```python
248
+ score = 5 # base
249
+
250
+ if exists("docs/fitness/fitness-functions.md"):
251
+ score += 8
252
+
253
+ content = read("docs/fitness/fitness-functions.md")
254
+ functions = parse_fitness_functions(content)
255
+
256
+ for func in functions:
257
+ if func.automated:
258
+ score += 2
259
+
260
+ # RECOMMEND if score >= 12
261
+ ```
262
+
263
+ ### /validate-ddd Command
264
+
265
+ ```python
266
+ score = 5 # base
267
+
268
+ if exists("docs/fitness/fitness-functions.md"):
269
+ score += 5
270
+
271
+ if exists("docs/ddd/tactical/"):
272
+ score += 5
273
+
274
+ aggregates = glob("docs/ddd/tactical/aggregates/*.md")
275
+ if len(aggregates) > 3:
276
+ score += 5
277
+
278
+ # RECOMMEND if score >= 12
279
+ ```
280
+
281
+ ---
282
+
283
+ ## .ai-context Integration Scoring
284
+
285
+ ### project-context/ Skill
286
+
287
+ ```python
288
+ score = 5 # base
289
+
290
+ ai_context_files = [
291
+ ".ai-context/README.md",
292
+ ".ai-context/architecture-summary.md",
293
+ ".ai-context/key-decisions.md",
294
+ ".ai-context/domain-glossary.md",
295
+ ".ai-context/bounded-contexts.md",
296
+ ".ai-context/coding-standards.md",
297
+ ".ai-context/fitness-rules.md",
298
+ ".ai-context/pseudocode-index.md"
299
+ ]
300
+
301
+ found = sum(1 for f in ai_context_files if exists(f))
302
+ score += found * 2 # +2 per file found
303
+
304
+ # RECOMMEND if score >= 12 (need at least 4 files)
305
+ ```
306
+
307
+ ### CLAUDE.md Enhancement
308
+
309
+ ```python
310
+ # If .ai-context exists, enhance CLAUDE.md integration
311
+ if exists(".ai-context/"):
312
+ use_enhanced_template = True
313
+ ai_context_priority = "HIGH"
314
+ else:
315
+ use_enhanced_template = False
316
+ ai_context_priority = "LOW"
317
+ ```
318
+
319
+ ---
320
+
321
+ ## Priority Tier Assignment (Enhanced)
322
+
323
+ ### Tier Rules
324
+
325
+ ```python
326
+ def assign_tier(score: int, document_source: str) -> str:
327
+ """Assign priority tier based on score and source."""
328
+
329
+ # DDD documents get tier boost
330
+ ddd_boost = 2 if document_source in ["DDD_STRATEGIC", "DDD_TACTICAL"] else 0
331
+
332
+ # Gherkin documents get tier boost
333
+ gherkin_boost = 2 if document_source == "GHERKIN" else 0
334
+
335
+ # .ai-context integration boost
336
+ ai_context_boost = 3 if document_source == "AI_CONTEXT" else 0
337
+
338
+ adjusted_score = score + ddd_boost + gherkin_boost + ai_context_boost
339
+
340
+ if adjusted_score >= 18:
341
+ return "P1" # Highly recommended, default ON
342
+ elif adjusted_score >= 12:
343
+ return "P1" # Recommended, default ON
344
+ elif adjusted_score >= 8:
345
+ return "P2" # Optional, default OFF
346
+ else:
347
+ return "P3" # External/advanced, default OFF
348
+ ```
349
+
350
+ ### Default Selections by Pipeline
351
+
352
+ | Pipeline | P1 (Default ON) | P2 (Optional) | P3 (Advanced) |
353
+ |----------|-----------------|---------------|---------------|
354
+ | IDEA2PRD_FULL | 12-15 instruments | 5-8 instruments | 2-4 instruments |
355
+ | IDEA2PRD_PARTIAL | 8-10 instruments | 4-6 instruments | 2-3 instruments |
356
+ | SPARC | 6-8 instruments | 3-4 instruments | 1-2 instruments |
357
+ | MINIMAL | 3-4 instruments | 2-3 instruments | 0-1 instruments |
358
+
359
+ ---
360
+
361
+ ## Output Format
362
+
363
+ ### HYBRID Mode Checkpoint 1
364
+
365
+ ```
366
+ ═══════════════════════════════════════════════════════════════
367
+ ⏸️ HYBRID CHECKPOINT 1: Smart Selection
368
+ ═══════════════════════════════════════════════════════════════
369
+
370
+ 📊 Pipeline Detected: IDEA2PRD_FULL
371
+ Documents: 45 files across 8 categories
372
+
373
+ ✅ P0 Generated (mandatory):
374
+ • CLAUDE.md (enhanced with .ai-context) 4.2 KB
375
+ • security.md (from 3 security ADRs) 1.8 KB
376
+ • coding-style.md (from coding-standards) 2.1 KB
377
+ • domain-model.md (from DDD Strategic) 1.5 KB [NEW]
378
+
379
+ 📦 P1 Recommended (score ≥12):
380
+
381
+ | # | Instrument | Type | Score | Source |
382
+ |---|------------|------|-------|--------|
383
+ | 1 | domain-expert.md | Agent | 23 | DDD Strategic + Glossary |
384
+ | 2 | planner.md | Agent | 21 | Pseudocode (8 files) |
385
+ | 3 | code-reviewer.md | Agent | 19 | Fitness + ADRs |
386
+ | 4 | ddd-validator.md | Agent | 18 | Aggregates (6) + Fitness |
387
+ | 5 | tdd-guide.md | Agent | 17 | Gherkin + Pseudocode |
388
+ | 6 | project-context/ | Skill | 21 | .ai-context (8 files) |
389
+ | 7 | coding-standards/ | Skill | 18 | coding-standards + ADRs |
390
+ | 8 | testing-patterns/ | Skill | 16 | Gherkin (12 scenarios) |
391
+ | 9 | aggregate-patterns/ | Skill | 15 | DDD Tactical |
392
+ | 10 | /plan | Command | 18 | Pseudocode |
393
+ | 11 | /test | Command | 20 | Gherkin features |
394
+ | 12 | testing.md | Rule | 15 | Fitness + Gherkin |
395
+
396
+ 📦 P2 Optional (score 8-11):
397
+
398
+ | 13 | architect.md | Agent | 11 | C4 + ADRs |
399
+ | 14 | event-handlers/ | Skill | 10 | Domain Events (4) |
400
+ | 15 | /validate-ddd | Command | 11 | Fitness + DDD |
401
+ | 16 | settings.json | Hooks | 9 | Fitness automation |
402
+
403
+ 📦 P3 External:
404
+
405
+ | 17 | .mcp.json | Config | - | GitHub, PostgreSQL |
406
+
407
+ ⚡ Quick Actions:
408
+ • "ок" — generate all P1 (12 instruments)
409
+ • "минимум" — P0 only
410
+ • "максимум" — all P1 + P2 + P3 (17 instruments)
411
+ • "+ddd" — add all DDD-specific (domain-expert, ddd-validator, aggregate-patterns)
412
+ • "+gherkin" — add all Gherkin-specific (testing-patterns, /test, tdd-guide)
413
+ • "+N" / "-N" — toggle specific
414
+
415
+ ═══════════════════════════════════════════════════════════════
416
+ ```