@champpaba/claude-agent-kit 1.1.0 → 1.1.1

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 (82) hide show
  1. package/.claude/CHANGELOG-v1.1.1.md +259 -0
  2. package/.claude/CLAUDE.md +555 -0
  3. package/.claude/agents/01-integration.md +797 -0
  4. package/.claude/agents/02-uxui-frontend.md +955 -0
  5. package/.claude/agents/03-test-debug.md +759 -0
  6. package/.claude/agents/04-frontend.md +1099 -0
  7. package/.claude/agents/05-backend.md +1217 -0
  8. package/.claude/agents/06-database.md +969 -0
  9. package/.claude/commands/agentsetup.md +1464 -0
  10. package/.claude/commands/cdev.md +327 -0
  11. package/.claude/commands/csetup.md +447 -0
  12. package/.claude/commands/cstatus.md +60 -0
  13. package/.claude/commands/cview.md +364 -0
  14. package/.claude/commands/designsetup.md +838 -0
  15. package/.claude/commands/extract.md +1005 -0
  16. package/.claude/commands/pageplan.md +327 -0
  17. package/.claude/commands/psetup.md +101 -0
  18. package/.claude/contexts/design/accessibility.md +611 -0
  19. package/.claude/contexts/design/box-thinking.md +566 -0
  20. package/.claude/contexts/design/color-theory.md +519 -0
  21. package/.claude/contexts/design/index.md +290 -0
  22. package/.claude/contexts/design/layout.md +400 -0
  23. package/.claude/contexts/design/responsive.md +551 -0
  24. package/.claude/contexts/design/shadows.md +522 -0
  25. package/.claude/contexts/design/spacing.md +445 -0
  26. package/.claude/contexts/design/typography.md +465 -0
  27. package/.claude/contexts/domain/README.md +164 -0
  28. package/.claude/contexts/patterns/agent-coordination.md +388 -0
  29. package/.claude/contexts/patterns/agent-discovery.md +182 -0
  30. package/.claude/contexts/patterns/change-workflow.md +538 -0
  31. package/.claude/contexts/patterns/code-standards.md +515 -0
  32. package/.claude/contexts/patterns/development-principles.md +513 -0
  33. package/.claude/contexts/patterns/error-handling.md +478 -0
  34. package/.claude/contexts/patterns/error-recovery.md +365 -0
  35. package/.claude/contexts/patterns/frontend-component-strategy.md +365 -0
  36. package/.claude/contexts/patterns/git-workflow.md +207 -0
  37. package/.claude/contexts/patterns/logging.md +424 -0
  38. package/.claude/contexts/patterns/task-breakdown.md +452 -0
  39. package/.claude/contexts/patterns/task-classification.md +523 -0
  40. package/.claude/contexts/patterns/tdd-classification.md +516 -0
  41. package/.claude/contexts/patterns/testing.md +413 -0
  42. package/.claude/contexts/patterns/ui-component-consistency.md +304 -0
  43. package/.claude/contexts/patterns/validation-framework.md +776 -0
  44. package/.claude/lib/README.md +39 -0
  45. package/.claude/lib/agent-executor.md +258 -0
  46. package/.claude/lib/agent-router.md +572 -0
  47. package/.claude/lib/flags-updater.md +469 -0
  48. package/.claude/lib/tdd-classifier.md +345 -0
  49. package/.claude/lib/validation-gates.md +484 -0
  50. package/.claude/settings.local.json +42 -0
  51. package/.claude/templates/STYLE_GUIDE.template.md +879 -0
  52. package/.claude/templates/context-template.md +45 -0
  53. package/.claude/templates/flags-template.json +42 -0
  54. package/.claude/templates/page-plan-example.md +562 -0
  55. package/.claude/templates/phase-templates.json +124 -0
  56. package/.claude/templates/phases-sections/accessibility-test.md +17 -0
  57. package/.claude/templates/phases-sections/api-design.md +37 -0
  58. package/.claude/templates/phases-sections/backend-tests.md +16 -0
  59. package/.claude/templates/phases-sections/backend.md +37 -0
  60. package/.claude/templates/phases-sections/business-logic-validation.md +16 -0
  61. package/.claude/templates/phases-sections/component-tests.md +17 -0
  62. package/.claude/templates/phases-sections/contract-backend.md +16 -0
  63. package/.claude/templates/phases-sections/contract-frontend.md +16 -0
  64. package/.claude/templates/phases-sections/database.md +35 -0
  65. package/.claude/templates/phases-sections/documentation.md +17 -0
  66. package/.claude/templates/phases-sections/e2e-tests.md +16 -0
  67. package/.claude/templates/phases-sections/fix-implementation.md +17 -0
  68. package/.claude/templates/phases-sections/frontend-integration.md +18 -0
  69. package/.claude/templates/phases-sections/frontend-mockup.md +123 -0
  70. package/.claude/templates/phases-sections/manual-flow-test.md +15 -0
  71. package/.claude/templates/phases-sections/manual-ux-test.md +16 -0
  72. package/.claude/templates/phases-sections/refactor-implementation.md +17 -0
  73. package/.claude/templates/phases-sections/refactor.md +16 -0
  74. package/.claude/templates/phases-sections/regression-tests.md +15 -0
  75. package/.claude/templates/phases-sections/report.md +16 -0
  76. package/.claude/templates/phases-sections/responsive-test.md +16 -0
  77. package/.claude/templates/phases-sections/script-implementation.md +43 -0
  78. package/.claude/templates/phases-sections/test-coverage.md +16 -0
  79. package/.claude/templates/phases-sections/user-approval.md +14 -0
  80. package/lib/init.js +1 -1
  81. package/lib/update.js +1 -1
  82. package/package.json +2 -2
@@ -0,0 +1,838 @@
1
+ # /designsetup - Synthesize Style Guide from Extracted Data
2
+
3
+ You are a senior design systems architect with experience at FANG-level companies.
4
+
5
+ Your task is to analyze extracted design data, synthesize with project context, and generate a comprehensive STYLE_GUIDE.md with AI-recommended style directions.
6
+
7
+ ---
8
+
9
+ ## 📖 Usage
10
+
11
+ ```bash
12
+ /designsetup [@context-files...]
13
+
14
+ Arguments:
15
+ @context-files Optional. Context files (prd.md, project.md, brief.md, etc.)
16
+
17
+ Examples:
18
+ /designsetup @prd.md @project.md
19
+ /designsetup @docs/brief.md @docs/requirements.md
20
+ /designsetup # No context (interactive fallback)
21
+ ```
22
+
23
+ ---
24
+
25
+ ## 🎯 Mission
26
+
27
+ Generate production-ready style guide at: `design-system/STYLE_GUIDE.md`
28
+
29
+ **Process:**
30
+ 1. Load all extracted data from `design-system/extracted/`
31
+ 2. Analyze project context (from @files or user input)
32
+ 3. Generate 2-3 style direction options with AI reasoning
33
+ 4. User selects preferred option
34
+ 5. Generate comprehensive STYLE_GUIDE.md (17 sections, 1500-2000 lines)
35
+
36
+ **Key Principles:**
37
+ 1. **Multi-Source Synthesis**: Combine best patterns from all extracted sites
38
+ 2. **Context-Aware**: Match style to target audience + brand personality
39
+ 3. **Transparent Reasoning**: Show why each option fits
40
+ 4. **User Choice**: Present options with pros/cons, let user decide
41
+
42
+ ---
43
+
44
+ ## STEP 0: Discovery & Validation
45
+
46
+ ```javascript
47
+ // 1. Find extracted sites
48
+ const extractedFiles = glob('design-system/extracted/*/data.yaml');
49
+
50
+ if (extractedFiles.length === 0) {
51
+ return error(`
52
+ ❌ No extracted data found
53
+
54
+ Please extract at least 1 site first:
55
+ /extract https://airbnb.com
56
+ /extract https://blackbird.com
57
+ /extract https://linear.app
58
+
59
+ Then run: /designsetup @prd.md @project.md
60
+ `);
61
+ }
62
+
63
+ // 2. Load all extracted data
64
+ const extractedData = {};
65
+ for (const file of extractedFiles) {
66
+ const siteName = path.dirname(file).split('/').pop();
67
+ extractedData[siteName] = YAML.parse(Read(file));
68
+ }
69
+
70
+ // 3. Load context files
71
+ const contextArgs = args.filter(arg => arg.startsWith('@'));
72
+ const contexts = {};
73
+
74
+ if (contextArgs.length > 0) {
75
+ for (const arg of contextArgs) {
76
+ const filePath = arg.substring(1); // Remove @
77
+
78
+ if (!exists(filePath)) {
79
+ warn(`Context file not found: ${filePath} (skipping)`);
80
+ continue;
81
+ }
82
+
83
+ const fileName = path.basename(filePath);
84
+ contexts[fileName] = Read(filePath);
85
+ }
86
+ }
87
+ ```
88
+
89
+ **Report:**
90
+ ```
91
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
92
+ 🎨 Design Setup Started
93
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94
+
95
+ 📊 Extracted Sites: ${Object.keys(extractedData).length}
96
+ ${Object.entries(extractedData).map(([site, data]) =>
97
+ ` - ${site} (${data.meta.coverage.percentage}% coverage, ${data.meta.extracted_at.split('T')[0]})`
98
+ ).join('\n')}
99
+
100
+ 📁 Context Files: ${Object.keys(contexts).length || 'None (will use interactive mode)'}
101
+ ${Object.keys(contexts).length > 0 ? Object.keys(contexts).map(c => ` - ${c}`).join('\n') : ''}
102
+
103
+ 🔄 Analyzing context...
104
+ ```
105
+
106
+ ---
107
+
108
+ ## STEP 1: Context Analysis
109
+
110
+ ```javascript
111
+ let contextAnalysis;
112
+
113
+ if (Object.keys(contexts).length > 0) {
114
+ // AI analyzes context files
115
+ const analysisPrompt = `
116
+ You are analyzing project context to recommend design directions.
117
+
118
+ Context Files:
119
+ ${Object.entries(contexts).map(([name, content]) => `
120
+ ## ${name}
121
+ ${content.substring(0, 2000)} // First 2000 chars
122
+ `).join('\n')}
123
+
124
+ Task: Identify project characteristics and return JSON.
125
+
126
+ Return JSON:
127
+ {
128
+ "has_context": true,
129
+ "target_audience": {
130
+ "age_range": "18-25" | "26-40" | "40+" | "mixed",
131
+ "demographics": "string",
132
+ "tech_savvy": "low" | "medium" | "high",
133
+ "description": "string"
134
+ },
135
+ "brand_personality": ["bold" | "professional" | "playful" | "minimal" | "technical", ...],
136
+ "product_type": "SaaS" | "E-commerce" | "Marketing" | "Internal Tool" | "Other",
137
+ "market_position": "string (differentiation strategy)",
138
+ "design_preferences": {
139
+ "mentioned": boolean,
140
+ "details": "string (if any design preferences mentioned)"
141
+ },
142
+ "business_goals": ["string", ...]
143
+ }
144
+
145
+ If context is insufficient or unclear, set "has_context": false.
146
+ `;
147
+
148
+ contextAnalysis = await LLM({
149
+ prompt: analysisPrompt,
150
+ response_format: 'json'
151
+ });
152
+
153
+ } else {
154
+ contextAnalysis = { has_context: false };
155
+ }
156
+
157
+ // If no context, ask user
158
+ if (!contextAnalysis.has_context) {
159
+ const userInput = await AskUserQuestion({
160
+ questions: [
161
+ {
162
+ question: "What type of product are you building?",
163
+ header: "Product Type",
164
+ multiSelect: false,
165
+ options: [
166
+ { label: "SaaS Dashboard", description: "Business software, data tools, analytics" },
167
+ { label: "E-commerce", description: "Online store, marketplace, shopping" },
168
+ { label: "Marketing Site", description: "Landing pages, content, blog" },
169
+ { label: "Internal Tool", description: "Admin panels, workflows, dashboards" }
170
+ ]
171
+ },
172
+ {
173
+ question: "Who is your target audience?",
174
+ header: "Audience",
175
+ multiSelect: false,
176
+ options: [
177
+ { label: "Gen Z (18-25)", description: "Young, tech-savvy, bold preferences" },
178
+ { label: "Millennials (26-40)", description: "Professional, value-driven, modern" },
179
+ { label: "Enterprise (40+)", description: "Conservative, trust-focused, established" },
180
+ { label: "Developers", description: "Technical, efficiency-focused, minimal" }
181
+ ]
182
+ },
183
+ {
184
+ question: "What brand personality do you want?",
185
+ header: "Brand",
186
+ multiSelect: true,
187
+ options: [
188
+ { label: "Bold", description: "Stand out, memorable, confident, different" },
189
+ { label: "Professional", description: "Trustworthy, credible, serious, polished" },
190
+ { label: "Playful", description: "Fun, friendly, approachable, warm" },
191
+ { label: "Minimal", description: "Clean, simple, understated, elegant" }
192
+ ]
193
+ }
194
+ ]
195
+ });
196
+
197
+ contextAnalysis = {
198
+ has_context: true,
199
+ from_user_input: true,
200
+ product_type: userInput.answers["Product Type"],
201
+ target_audience: {
202
+ demographics: userInput.answers["Audience"],
203
+ tech_savvy: userInput.answers["Audience"].includes("Gen Z") || userInput.answers["Audience"].includes("Developers") ? "high" : "medium"
204
+ },
205
+ brand_personality: userInput.answers["Brand"].split(',').map(s => s.trim().toLowerCase())
206
+ };
207
+ }
208
+ ```
209
+
210
+ **Report:**
211
+ ```
212
+ ✅ Context Analysis Complete!
213
+
214
+ 🎯 Project Profile:
215
+ - Product: ${contextAnalysis.product_type}
216
+ - Audience: ${contextAnalysis.target_audience.demographics}
217
+ - Brand: ${contextAnalysis.brand_personality.join(', ')}
218
+ ${contextAnalysis.market_position ? `- Position: ${contextAnalysis.market_position}` : ''}
219
+
220
+ 🔄 Generating style direction options...
221
+ ```
222
+
223
+ ---
224
+
225
+ ## STEP 2: Style Direction Analysis (AI Pondering)
226
+
227
+ ```javascript
228
+ const ponderingPrompt = `
229
+ You are a design systems architect creating style direction recommendations.
230
+
231
+ Extracted Sites Summary:
232
+ ${Object.entries(extractedData).map(([site, data]) => `
233
+ ## ${site}
234
+ - Style: ${data.sections.overview.style || 'Unknown'}
235
+ - Colors: ${data.sections.color_palette.primary.slice(0, 3).map(c => c.hex).join(', ')}
236
+ - Shadows: ${data.sections.shadows_elevation.values.slice(0, 2).join(', ')}
237
+ - Border Radius: ${data.sections.border_radius.values.slice(0, 3).join(', ')}
238
+ - Typography: ${data.sections.typography.fonts.slice(0, 2).join(', ')}
239
+ - Button Animation: ${Object.values(data.animations).find(a => a.type === 'button')?.description || 'N/A'}
240
+ - Card Animation: ${Object.values(data.animations).find(a => a.type === 'card')?.description || 'N/A'}
241
+ `).join('\n')}
242
+
243
+ Project Context:
244
+ - Product: ${contextAnalysis.product_type}
245
+ - Target Audience: ${contextAnalysis.target_audience.demographics} (tech-savvy: ${contextAnalysis.target_audience.tech_savvy})
246
+ - Brand Personality: ${contextAnalysis.brand_personality.join(', ')}
247
+ - Market Position: ${contextAnalysis.market_position || 'Not specified'}
248
+
249
+ Task: Generate 2-3 style direction options ranked by fit.
250
+
251
+ Instructions:
252
+ 1. Wrap thinking in <pondering> tags
253
+ 2. Consider:
254
+ - Which extracted patterns fit target audience best?
255
+ - Which style matches brand personality?
256
+ - What differentiates from competitors?
257
+ - What are implementation trade-offs?
258
+ 3. Recommend 2-3 distinct style directions
259
+ 4. Rank by fit score (0-100)
260
+
261
+ Return JSON:
262
+ {
263
+ "pondering": "...",
264
+ "recommended_count": 2 or 3,
265
+ "options": [
266
+ {
267
+ "name": "Neo-Brutalism" | "Warm Minimalist" | "Modern Professional" | "Playful Rounded" | "Technical Clean" | other,
268
+ "fit_score": 0-100,
269
+ "rationale": "Why this fits (2-3 sentences)",
270
+ "sources": {
271
+ "colors": "site-name | custom",
272
+ "shadows": "site-name",
273
+ "typography": "site-name | custom",
274
+ "spacing": "site-name",
275
+ "button_hover": "site-name",
276
+ "card_hover": "site-name",
277
+ "input_focus": "site-name",
278
+ "border_radius": "site-name",
279
+ "overall_vibe": "site-name"
280
+ },
281
+ "customizations": [
282
+ "Adapt Airbnb warmth to bold colors",
283
+ "Use Blackbird hard shadows instead of soft"
284
+ ],
285
+ "advantages": [
286
+ "string (3-5 advantages)"
287
+ ],
288
+ "disadvantages": [
289
+ "string (2-4 disadvantages)"
290
+ ]
291
+ }
292
+ ]
293
+ }
294
+
295
+ Important:
296
+ - Option 1 = highest fit score (primary recommendation)
297
+ - Option 2 = good alternative (different approach)
298
+ - Option 3 (if needed) = safe fallback
299
+ - Each option should be DISTINCT (different visual feel)
300
+ - Source mapping must reference actual extracted sites
301
+ `;
302
+
303
+ const styleOptions = await LLM({
304
+ prompt: ponderingPrompt,
305
+ response_format: 'json',
306
+ max_tokens: 4000
307
+ });
308
+ ```
309
+
310
+ **Report:**
311
+ ```
312
+ ✅ Style Directions Generated!
313
+
314
+ 🎨 ${styleOptions.recommended_count} options created
315
+ - Primary: ${styleOptions.options[0].name} (${styleOptions.options[0].fit_score}% fit)
316
+ - Alternative: ${styleOptions.options[1].name} (${styleOptions.options[1].fit_score}% fit)
317
+ ${styleOptions.options[2] ? `- Fallback: ${styleOptions.options[2].name} (${styleOptions.options[2].fit_score}% fit)` : ''}
318
+
319
+ 🔄 Generating option previews...
320
+ ```
321
+
322
+ ---
323
+
324
+ ## STEP 3: Generate Preview YAMLs
325
+
326
+ For each option, create a preview YAML:
327
+
328
+ ```javascript
329
+ for (const [index, option] of styleOptions.options.entries()) {
330
+ const optionLetter = String.fromCharCode(65 + index); // A, B, C
331
+
332
+ const previewPrompt = `
333
+ You are generating a preview style guide in YAML format.
334
+
335
+ Style Direction: ${option.name}
336
+ Fit Score: ${option.fit_score}%
337
+ Rationale: ${option.rationale}
338
+
339
+ Source Mapping:
340
+ ${JSON.stringify(option.sources, null, 2)}
341
+
342
+ Customizations:
343
+ ${option.customizations.join('\n')}
344
+
345
+ Extracted Data (for reference):
346
+ ${JSON.stringify(extractedData, null, 2).substring(0, 5000)} // First 5000 chars
347
+
348
+ Task: Create abbreviated YAML preview with key values only.
349
+
350
+ Format:
351
+ \`\`\`yaml
352
+ meta:
353
+ style_name: "${option.name}"
354
+ fit_score: ${option.fit_score}
355
+ sources: [list of source sites]
356
+
357
+ colors:
358
+ primary:
359
+ hex: "#..." # From ${option.sources.colors}
360
+ rationale: "Why this color fits"
361
+ secondary:
362
+ hex: "#..."
363
+ # ... 5-10 key colors
364
+
365
+ typography:
366
+ font_family: "..." # From ${option.sources.typography}
367
+ h1: { size: "...", weight: "..." }
368
+ # ... key type styles
369
+
370
+ shadows:
371
+ brutal: "..." # From ${option.sources.shadows}
372
+ # ... 3-5 key shadows
373
+
374
+ spacing:
375
+ grid: "..." # From ${option.sources.spacing}
376
+
377
+ components:
378
+ button:
379
+ hover_animation: "..." # From ${option.sources.button_hover}
380
+ description: "..."
381
+ card:
382
+ hover_animation: "..." # From ${option.sources.card_hover}
383
+ # ... key components
384
+
385
+ border_radius:
386
+ values: [...] # From ${option.sources.border_radius}
387
+ \`\`\`
388
+
389
+ Return only the YAML content.
390
+ `;
391
+
392
+ const previewYAML = await LLM({ prompt: previewPrompt });
393
+
394
+ Write(
395
+ `design-system/synthesis/options/option-${optionLetter.toLowerCase()}-${option.name.toLowerCase().replace(/\s+/g, '-')}.yaml`,
396
+ previewYAML
397
+ );
398
+ }
399
+ ```
400
+
401
+ ---
402
+
403
+ ## STEP 4: Present Options to User
404
+
405
+ ```javascript
406
+ output(`
407
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
408
+ 🎨 Design Direction Analysis Complete
409
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
410
+
411
+ Based on:
412
+ ✓ ${Object.keys(extractedData).length} extracted sites (${Object.keys(extractedData).join(', ')})
413
+ ✓ Target: ${contextAnalysis.target_audience.demographics}
414
+ ✓ Brand: ${contextAnalysis.brand_personality.join(', ')}
415
+ ✓ Product: ${contextAnalysis.product_type}
416
+
417
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
418
+ `);
419
+
420
+ for (const [index, option] of styleOptions.options.entries()) {
421
+ const optionLetter = String.fromCharCode(65 + index);
422
+ const isRecommended = index === 0;
423
+
424
+ output(`
425
+ Option ${optionLetter}: ${option.name} ${isRecommended ? '⭐ (Recommended)' : ''}
426
+ Fit Score: ${option.fit_score}%
427
+
428
+ Rationale:
429
+ ${option.rationale}
430
+
431
+ Component Sources:
432
+ - Colors: ${option.sources.colors}
433
+ - Shadows: ${option.sources.shadows}
434
+ - Typography: ${option.sources.typography}
435
+ - Button hover: ${option.sources.button_hover}
436
+ - Card hover: ${option.sources.card_hover}
437
+ - Input focus: ${option.sources.input_focus}
438
+ - Border radius: ${option.sources.border_radius}
439
+ - Overall vibe: ${option.sources.overall_vibe}
440
+
441
+ Customizations Applied:
442
+ ${option.customizations.map(c => ` • ${c}`).join('\n')}
443
+
444
+ Advantages:
445
+ ${option.advantages.map(a => ` ✅ ${a}`).join('\n')}
446
+
447
+ Disadvantages:
448
+ ${option.disadvantages.map(d => ` ⚠️ ${d}`).join('\n')}
449
+
450
+ Preview: design-system/synthesis/options/option-${optionLetter.toLowerCase()}-${option.name.toLowerCase().replace(/\s+/g, '-')}.yaml
451
+
452
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
453
+ `);
454
+ }
455
+
456
+ // Ask user to select
457
+ const userChoice = await AskUserQuestion({
458
+ questions: [{
459
+ question: "Select design direction:",
460
+ header: "Style",
461
+ multiSelect: false,
462
+ options: styleOptions.options.map((opt, i) => ({
463
+ label: `${String.fromCharCode(65 + i)}: ${opt.name}`,
464
+ description: `${opt.fit_score}% fit - ${opt.rationale.substring(0, 100)}...`
465
+ }))
466
+ }]
467
+ });
468
+
469
+ const selectedIndex = userChoice.answers["Style"].charCodeAt(0) - 65;
470
+ const selectedOption = styleOptions.options[selectedIndex];
471
+ ```
472
+
473
+ **Report:**
474
+ ```
475
+ ✅ Style Selected: ${selectedOption.name}
476
+
477
+ 🔄 Generating comprehensive STYLE_GUIDE.md...
478
+ ```
479
+
480
+ ---
481
+
482
+ ## STEP 5: Generate Final STYLE_GUIDE.md
483
+
484
+ ```javascript
485
+ const styleGuidePrompt = `
486
+ You are generating the final, comprehensive STYLE_GUIDE.md file.
487
+
488
+ Selected Style: ${selectedOption.name}
489
+ Fit Score: ${selectedOption.fit_score}%
490
+ Rationale: ${selectedOption.rationale}
491
+
492
+ Source Mapping:
493
+ ${JSON.stringify(selectedOption.sources, null, 2)}
494
+
495
+ Customizations:
496
+ ${selectedOption.customizations.join('\n')}
497
+
498
+ Full Extracted Data:
499
+ ${JSON.stringify(extractedData, null, 2)}
500
+
501
+ Preview YAML:
502
+ ${Read(`design-system/synthesis/options/option-${String.fromCharCode(65 + selectedIndex).toLowerCase()}-${selectedOption.name.toLowerCase().replace(/\s+/g, '-')}.yaml`)}
503
+
504
+ Project Context:
505
+ - Product: ${contextAnalysis.product_type}
506
+ - Audience: ${contextAnalysis.target_audience.demographics}
507
+ - Brand: ${contextAnalysis.brand_personality.join(', ')}
508
+
509
+ Task: Generate complete STYLE_GUIDE.md (1500-2000 lines) with ALL 17 sections.
510
+
511
+ CRITICAL: Follow the EXACT format of existing STYLE_GUIDE.md:
512
+
513
+ # [Project Name] Design System - Style Guide (${selectedOption.name})
514
+
515
+ > **Source:** Based on ${Object.keys(extractedData).join(', ')}, customized for [Project]
516
+ > **Date:** ${new Date().toISOString().split('T')[0]}
517
+ > **Design Style:** ${selectedOption.name}
518
+ > **Tech Stack:** Universal (Framework-agnostic)
519
+ > **Primary Color:** [from preview YAML]
520
+
521
+ ---
522
+
523
+ ## Quick Reference
524
+
525
+ ### Most Used Patterns
526
+
527
+ | Pattern | Code |
528
+ |---------|------|
529
+ [Table with most-used component patterns with exact Tailwind classes]
530
+
531
+ ### Design Tokens Summary
532
+
533
+ \`\`\`json
534
+ {
535
+ "colors": { ... },
536
+ "spacing": { ... },
537
+ "typography": { ... },
538
+ "borderRadius": { ... },
539
+ "shadows": { ... }
540
+ }
541
+ \`\`\`
542
+
543
+ ---
544
+
545
+ ## Table of Contents
546
+
547
+ 1. [Overview](#1-overview)
548
+ 2. [Design Philosophy](#2-design-philosophy)
549
+ 3. [Color Palette](#3-color-palette)
550
+ ... (all 17)
551
+
552
+ ---
553
+
554
+ ## 1. Overview
555
+
556
+ **Summary:**
557
+ This design system is based on **${selectedOption.name}** aesthetics...
558
+
559
+ **Key Characteristics:**
560
+ - [List from extracted data + customizations]
561
+
562
+ **Tech Stack:**
563
+ - Framework: Universal
564
+ - Styling: Tailwind CSS recommended
565
+ - Font: [from typography source]
566
+
567
+ **Goals:**
568
+ - [Derived from rationale + advantages]
569
+
570
+ ---
571
+
572
+ ## 2. Design Philosophy
573
+
574
+ **Core Principles:**
575
+
576
+ 1. **[Principle 1 from rationale]**
577
+ - [Description]
578
+
579
+ 2. **[Principle 2]**
580
+ - [Description]
581
+
582
+ ... (derive from ${selectedOption.name} characteristics + rationale)
583
+
584
+ **Visual Identity:**
585
+ ${selectedOption.rationale}
586
+
587
+ **Key Differentiators:**
588
+ ${selectedOption.advantages.slice(0, 3).map(a => `- ${a}`).join('\n')}
589
+
590
+ **User Experience Goals:**
591
+ - First Impression: [based on style name]
592
+ - During Use: [based on style name]
593
+ - Long-term: [based on style name]
594
+
595
+ ---
596
+
597
+ ## 3. Color Palette
598
+
599
+ [Extract from preview YAML + source data]
600
+
601
+ ### Primary Colors
602
+
603
+ **Primary ([Color Name])**
604
+ - **Color**: [hex] (rgb(...))
605
+ - **Usage**: [from source data]
606
+ - **Psychology**: [analysis]
607
+ - **Source**: ${selectedOption.sources.colors}
608
+ - **CSS Variable**: \`var(--color-primary)\`
609
+ - **Tailwind**: \`bg-primary\`, \`text-primary\`, \`border-primary\`
610
+
611
+ ... continue all colors from preview YAML ...
612
+
613
+ ---
614
+
615
+ ## 4. Typography
616
+
617
+ [Extract from source data]
618
+
619
+ **Font Family:**
620
+ \`\`\`css
621
+ font-family: [from ${selectedOption.sources.typography}]
622
+ \`\`\`
623
+
624
+ **Font Weights:**
625
+ [Table from source data]
626
+
627
+ **Text Styles:**
628
+
629
+ ### Headings
630
+
631
+ **H1 - [Usage]**
632
+ \`\`\`html
633
+ <h1 className="[exact Tailwind classes from source]">
634
+ Example Text
635
+ </h1>
636
+ \`\`\`
637
+ - **Size**: [from source]
638
+ - **Weight**: [from source]
639
+ - **Source**: ${selectedOption.sources.typography}
640
+
641
+ ... continue all typography ...
642
+
643
+ ---
644
+
645
+ ## 5. Spacing System
646
+
647
+ [Extract from ${selectedOption.sources.spacing}]
648
+
649
+ **Grid Base:** [from source data]
650
+
651
+ **Scale:** [array from source]
652
+
653
+ ---
654
+
655
+ ## 6. Component Styles
656
+
657
+ ### 6.2 Button Component
658
+
659
+ **Primary Button**
660
+ \`\`\`tsx
661
+ <button className="[exact classes from ${selectedOption.sources.button_hover}]">
662
+ Click me
663
+ </button>
664
+ \`\`\`
665
+
666
+ **Animation:**
667
+ - **Type**: [from extracted animations]
668
+ - **Description**: [from animations data]
669
+ - **Source**: ${selectedOption.sources.button_hover}
670
+ - **Duration**: [from source]
671
+
672
+ ... continue all components from all sources ...
673
+
674
+ ---
675
+
676
+ ## 7. Shadows & Elevation
677
+
678
+ [Extract from ${selectedOption.sources.shadows}]
679
+
680
+ ... continue all 17 sections ...
681
+
682
+ ---
683
+
684
+ ## 17. Additional Sections
685
+
686
+ ### 17.1 Implementation Best Practices
687
+
688
+ **Design Token Usage:**
689
+ - ✅ Use [font] for everything
690
+ - ✅ Use [spacing] grid
691
+ - ✅ Use [shadow style]
692
+ - ❌ Never [anti-pattern from disadvantages]
693
+
694
+ ### 17.2 Accessibility Guidelines
695
+
696
+ [Standard accessibility section]
697
+
698
+ ### 17.3 Critical Rules
699
+
700
+ **DO:**
701
+ ${selectedOption.advantages.map(a => `- ✅ ${a}`).join('\n')}
702
+
703
+ **DON'T:**
704
+ ${selectedOption.disadvantages.map(d => `- ❌ ${d}`).join('\n')}
705
+
706
+ ---
707
+
708
+ *Customized for [Project] from ${selectedOption.name} design principles*
709
+ *Date: ${new Date().toISOString().split('T')[0]}*
710
+ *Sources: ${Object.keys(extractedData).join(', ')}*
711
+ `;
712
+
713
+ const styleGuideMD = await LLM({
714
+ prompt: styleGuidePrompt,
715
+ max_tokens: 16000
716
+ });
717
+
718
+ Write('design-system/STYLE_GUIDE.md', styleGuideMD);
719
+ ```
720
+
721
+ ---
722
+
723
+ ## STEP 6: Final Report
724
+
725
+ ```
726
+ ✅ Design Setup Complete!
727
+
728
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
729
+
730
+ 📁 Generated: design-system/STYLE_GUIDE.md
731
+
732
+ 📊 Summary:
733
+ - Style: ${selectedOption.name}
734
+ - Fit Score: ${selectedOption.fit_score}%
735
+ - Sources: ${Object.keys(extractedData).join(', ')}
736
+ - Sections: 17/17 complete ✓
737
+ - Lines: ~${styleGuideMD.split('\n').length}
738
+
739
+ 🎨 Key Features:
740
+ ${selectedOption.advantages.slice(0, 4).map(a => ` ✓ ${a}`).join('\n')}
741
+
742
+ 📦 Files Created:
743
+ ✓ design-system/STYLE_GUIDE.md (final guide)
744
+ ✓ design-system/synthesis/options/ (${styleOptions.options.length} YAMLs)
745
+
746
+ ⚠️ Trade-offs:
747
+ ${selectedOption.disadvantages.slice(0, 2).map(d => ` • ${d}`).join('\n')}
748
+
749
+ 🎯 Component Sources:
750
+ - Colors: ${selectedOption.sources.colors}
751
+ - Shadows: ${selectedOption.sources.shadows}
752
+ - Typography: ${selectedOption.sources.typography}
753
+ - Animations: ${selectedOption.sources.button_hover}, ${selectedOption.sources.card_hover}
754
+
755
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
756
+
757
+ 🚀 Next Steps:
758
+
759
+ 1. Review STYLE_GUIDE.md:
760
+ cat design-system/STYLE_GUIDE.md | head -100
761
+
762
+ 2. Setup project (if needed):
763
+ /psetup
764
+
765
+ 3. Start development:
766
+ /csetup feature-login
767
+ /cdev feature-login
768
+
769
+ 4. Agents will automatically use STYLE_GUIDE.md ✓
770
+ ```
771
+
772
+ ---
773
+
774
+ ## Error Handling
775
+
776
+ ```javascript
777
+ // No extracted data
778
+ if (extractedFiles.length === 0) {
779
+ return error(`
780
+ ❌ No extracted data found
781
+
782
+ Please extract at least 1 site:
783
+ /extract https://airbnb.com
784
+
785
+ Then run: /designsetup @prd.md
786
+ `);
787
+ }
788
+
789
+ // AI analysis fails
790
+ try {
791
+ const styleOptions = await LLM({ ... });
792
+ } catch (error) {
793
+ return error(`
794
+ ❌ AI analysis failed: ${error.message}
795
+
796
+ This may be due to:
797
+ - Extracted data too large (try fewer sites)
798
+ - API rate limit (wait and retry)
799
+ - Invalid context files
800
+
801
+ Retry or use --debug for details
802
+ `);
803
+ }
804
+
805
+ // User cancels
806
+ if (!userChoice) {
807
+ output(`
808
+ ⚠️ Design setup cancelled
809
+
810
+ Your data is preserved:
811
+ - Extracted: design-system/extracted/
812
+ - Options: design-system/synthesis/options/
813
+
814
+ Run /designsetup again when ready.
815
+ `);
816
+ return;
817
+ }
818
+
819
+ // Write fails
820
+ try {
821
+ Write('design-system/STYLE_GUIDE.md', styleGuideMD);
822
+ } catch (error) {
823
+ // Save backup
824
+ Write('/tmp/style-guide-backup.md', styleGuideMD);
825
+
826
+ return error(`
827
+ ❌ Failed to write STYLE_GUIDE.md
828
+
829
+ Check permissions: design-system/
830
+
831
+ Backup saved: /tmp/style-guide-backup.md
832
+ `);
833
+ }
834
+ ```
835
+
836
+ ---
837
+
838
+ **Now execute the synthesis.**