liteagents 2.5.2 → 2.6.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 (80) hide show
  1. package/CHANGELOG.md +76 -15
  2. package/README.md +58 -30
  3. package/docs/INSTALLATION_DEMO.md +1 -1
  4. package/docs/INSTALLATION_LOCATIONS.md +5 -5
  5. package/docs/INSTALLER_GUIDE.md +5 -5
  6. package/docs/KNOWLEDGE_BASE.md +5 -5
  7. package/docs/MIGRATION.md +1 -1
  8. package/docs/PASS_QUICK_START.md +1 -1
  9. package/docs/PRIVACY.md +1 -1
  10. package/docs/PUBLISHING.md +7 -7
  11. package/docs/RELEASE_NOTES_1.2.0.md +2 -2
  12. package/docs/SILENT_MODE_GUIDE.md +1 -1
  13. package/installer/cli.js +1 -1
  14. package/installer/installation-engine.js +82 -21
  15. package/installer/package-manager.js +34 -3
  16. package/package.json +7 -6
  17. package/packages/ampcode/AGENT.md +1 -0
  18. package/packages/ampcode/commands/friction/friction.js +19 -4
  19. package/packages/ampcode/commands/live-canvas/DESIGN_PRINCIPLES.md +2140 -0
  20. package/packages/ampcode/commands/live-canvas/README.md +273 -0
  21. package/packages/ampcode/commands/live-canvas/templates/.claude/settings.local.json +8 -0
  22. package/packages/ampcode/commands/live-canvas/templates/demo/post-variants.html +205 -0
  23. package/packages/ampcode/commands/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +1299 -0
  24. package/packages/ampcode/commands/live-canvas/templates/feedback-react/format-utils.ts +283 -0
  25. package/packages/ampcode/commands/live-canvas/templates/feedback-react/index.ts +62 -0
  26. package/packages/ampcode/commands/live-canvas/templates/feedback-react/selector-utils.ts +423 -0
  27. package/packages/ampcode/commands/live-canvas/templates/feedback-react/types.ts +118 -0
  28. package/packages/ampcode/commands/live-canvas/templates/overlay-vanilla.js +477 -0
  29. package/packages/ampcode/commands/live-canvas.md +1104 -0
  30. package/packages/claude/CLAUDE.md +1 -0
  31. package/packages/claude/commands/friction/friction.js +19 -4
  32. package/packages/claude/plugins/live-canvas-marketplace/.claude-plugin/marketplace.json +14 -0
  33. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/.claude-plugin/plugin.json +18 -0
  34. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/README.md +89 -0
  35. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/package-lock.json +1142 -0
  36. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/package.json +17 -0
  37. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/schema.json +37 -0
  38. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/server.js +179 -0
  39. package/packages/claude/plugins/live-canvas-marketplace/setup.sh +61 -0
  40. package/packages/claude/skills/live-canvas/DESIGN_PRINCIPLES.md +2140 -0
  41. package/packages/claude/skills/live-canvas/INTEGRATION_NOTES.md +210 -0
  42. package/packages/claude/skills/live-canvas/README.md +273 -0
  43. package/packages/claude/skills/live-canvas/SKILL.md +1119 -0
  44. package/packages/claude/skills/live-canvas/templates/.claude/settings.local.json +8 -0
  45. package/packages/claude/skills/live-canvas/templates/demo/post-variants.html +205 -0
  46. package/packages/claude/skills/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +1299 -0
  47. package/packages/claude/skills/live-canvas/templates/feedback-react/format-utils.ts +283 -0
  48. package/packages/claude/skills/live-canvas/templates/feedback-react/index.ts +62 -0
  49. package/packages/claude/skills/live-canvas/templates/feedback-react/selector-utils.ts +423 -0
  50. package/packages/claude/skills/live-canvas/templates/feedback-react/types.ts +118 -0
  51. package/packages/claude/skills/live-canvas/templates/overlay-vanilla.js +477 -0
  52. package/packages/claude/variants.json +2 -1
  53. package/packages/droid/AGENTS.md +1 -0
  54. package/packages/droid/commands/friction/friction.js +19 -4
  55. package/packages/droid/commands/live-canvas/DESIGN_PRINCIPLES.md +2140 -0
  56. package/packages/droid/commands/live-canvas/README.md +273 -0
  57. package/packages/droid/commands/live-canvas/templates/.claude/settings.local.json +8 -0
  58. package/packages/droid/commands/live-canvas/templates/demo/post-variants.html +205 -0
  59. package/packages/droid/commands/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +1299 -0
  60. package/packages/droid/commands/live-canvas/templates/feedback-react/format-utils.ts +283 -0
  61. package/packages/droid/commands/live-canvas/templates/feedback-react/index.ts +62 -0
  62. package/packages/droid/commands/live-canvas/templates/feedback-react/selector-utils.ts +423 -0
  63. package/packages/droid/commands/live-canvas/templates/feedback-react/types.ts +118 -0
  64. package/packages/droid/commands/live-canvas/templates/overlay-vanilla.js +477 -0
  65. package/packages/droid/commands/live-canvas.md +1104 -0
  66. package/packages/opencode/AGENTS.md +1 -0
  67. package/packages/opencode/command/friction/friction.js +19 -4
  68. package/packages/opencode/command/live-canvas/DESIGN_PRINCIPLES.md +2140 -0
  69. package/packages/opencode/command/live-canvas/README.md +273 -0
  70. package/packages/opencode/command/live-canvas/templates/.claude/settings.local.json +8 -0
  71. package/packages/opencode/command/live-canvas/templates/demo/post-variants.html +205 -0
  72. package/packages/opencode/command/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +1299 -0
  73. package/packages/opencode/command/live-canvas/templates/feedback-react/format-utils.ts +283 -0
  74. package/packages/opencode/command/live-canvas/templates/feedback-react/index.ts +62 -0
  75. package/packages/opencode/command/live-canvas/templates/feedback-react/selector-utils.ts +423 -0
  76. package/packages/opencode/command/live-canvas/templates/feedback-react/types.ts +118 -0
  77. package/packages/opencode/command/live-canvas/templates/overlay-vanilla.js +477 -0
  78. package/packages/opencode/command/live-canvas.md +1104 -0
  79. package/packages/opencode/opencode.jsonc +4 -0
  80. package/packages/subagentic-manual.md +18 -15
@@ -0,0 +1,1104 @@
1
+ ---
2
+ name: live-canvas
3
+ description: Conduct design interviews, generate UI variations, and collect click-to-annotate feedback from the browser. Batch mode only on this host (live channel is Claude-Code-specific).
4
+ usage: /live-canvas
5
+ auto_trigger: false
6
+ ---
7
+
8
+ # Live Canvas Skill
9
+
10
+ This skill implements a complete design exploration workflow: interview, generate variations, collect feedback, refine, preview, and finalize.
11
+
12
+ ## CRITICAL: Cleanup Behavior
13
+
14
+ **All temporary files MUST be deleted when the process ends, whether by:**
15
+ - User confirms final design → cleanup, then generate plan
16
+ - User aborts/cancels → cleanup immediately, no plan generated
17
+
18
+ **Never leave `.claude-design/` or `__live_canvas` routes behind.** If the user says "cancel", "abort", "stop", or "nevermind" at any point, confirm and then delete all temporary artifacts.
19
+
20
+
21
+ ## Feedback Modes (host-tool aware)
22
+
23
+ Live Canvas supports two feedback transports. The skill auto-selects at runtime — the user never toggles modes manually.
24
+
25
+ - **Mode A — Batch (universal, works everywhere):** each Save writes to `.claude-design/feedback.jsonl`. User types "check" (or any message) to have the assistant read and act on the batch. Works in Claude Code, Droid, Amp, and Opencode identically.
26
+ - **Mode B — Live (Claude Code only):** the overlay POSTs each Save to a local MCP channel server; feedback arrives in the active session as a `<channel source="live-canvas" ...>` tag. Edits land without the user switching windows.
27
+
28
+ **Host-tool guidance — follow exactly:**
29
+
30
+ | Host | Modes available | What to do |
31
+ |---|---|---|
32
+ | Claude Code | A + B | Probe channel at Phase 0. If up → Live. If down → announce Batch and print the one-time setup block below. |
33
+ | Droid, Amp, Opencode | A only | Never probe the channel, never mention Live mode, never offer to install a plugin. Use Batch exclusively and collect feedback via paste-in-terminal (Phase 5). |
34
+
35
+ ### Channel activation — run this BEFORE starting the interview
36
+
37
+ Users invoke `/live-canvas` from an ordinary Claude Code session most of the time. They won't have started with the dev-channels flag unless they remembered. The skill's job is to figure out what state they're in and guide them without making them read docs.
38
+
39
+ **Step A — Probe the channel:**
40
+
41
+ ```bash
42
+ curl -s --max-time 1 http://localhost:8788/health
43
+ ```
44
+
45
+ **Step B — Decide which case you're in:**
46
+
47
+ | Probe result | Plugin dir exists at `~/.claude/plugins/cache/live-canvas-marketplace/`? | Case |
48
+ |---|---|---|
49
+ | `{"ok":true,...}` | (don't bother checking) | **Case 1 — Live ready** |
50
+ | fails | exists | **Case 2 — Plugin installed, session not in dev mode** |
51
+ | fails | missing | **Case 3 — First-time user** |
52
+
53
+ **Step C — Act on the case.**
54
+
55
+ ### Case 1 — Live ready
56
+
57
+ Announce briefly and proceed to the interview:
58
+
59
+ ```
60
+ ✨ Live mode — your feedback will stream into this session in real time.
61
+ ```
62
+
63
+ No decision needed. Skip to Phase 1.
64
+
65
+ ### Case 2 — Plugin installed but session not in dev mode
66
+
67
+ This is the common case for returning users who forgot the dev flag. Use `AskUserQuestion`:
68
+
69
+ > **Question: How do you want to run this session?**
70
+ > - "Batch for now" — continue without live mode. Feedback writes to JSONL; paste or say 'check' when ready.
71
+ > - "Restart for Live mode" — I'll abort here. Close this session, run the command below in your terminal, then `/live-canvas` again in the new one.
72
+
73
+ If they pick "Restart for Live mode", print:
74
+
75
+ ```
76
+ Close this Claude session, then run:
77
+
78
+ claude --dangerously-load-development-channels plugin:live-canvas-channel@live-canvas-marketplace
79
+
80
+ When it reopens, confirm the safety prompt, then run /live-canvas again — I'll be in Live mode.
81
+
82
+ Tip: save an alias so you don't retype this every time:
83
+ alias claude-live='claude --dangerously-load-development-channels plugin:live-canvas-channel@live-canvas-marketplace'
84
+ ```
85
+
86
+ Then exit the skill cleanly — do not start the interview. The user is going to close this session.
87
+
88
+ If they pick "Batch for now", announce Batch mode and proceed to Phase 1 normally.
89
+
90
+ ### Case 3 — First-time user
91
+
92
+ Channel plugin has never been set up. Use `AskUserQuestion`:
93
+
94
+ > **Question: Set up Live mode?**
95
+ > - "Yes, walk me through it" — I'll print the one-time setup commands.
96
+ > - "Just use Batch mode" — skip setup, start the skill normally.
97
+
98
+ If they pick setup, print the full sequence:
99
+
100
+ ```
101
+ One-time setup for Live mode:
102
+
103
+ 1. Install channel plugin dependencies (run in your terminal):
104
+ bash ~/.claude/plugins/live-canvas-marketplace/setup.sh
105
+
106
+ This runs `npm install` in the plugin dir.
107
+
108
+ 2. Inside Claude Code, register and install the plugin:
109
+ /plugin marketplace add ~/.claude/plugins/live-canvas-marketplace
110
+ /plugin install live-canvas-channel@live-canvas-marketplace
111
+
112
+ 3. Close this session and reopen with the dev-channels flag:
113
+ claude --dangerously-load-development-channels plugin:live-canvas-channel@live-canvas-marketplace
114
+
115
+ 4. Accept the safety prompt, then run /live-canvas again.
116
+
117
+ Tip: alias for future sessions:
118
+ alias claude-live='claude --dangerously-load-development-channels plugin:live-canvas-channel@live-canvas-marketplace'
119
+ ```
120
+
121
+ Exit the skill — don't start the interview. The user has a multi-step setup to do.
122
+
123
+ If they pick Batch, announce Batch mode and proceed to Phase 1 normally.
124
+
125
+ ### Why not auto-run the setup commands?
126
+
127
+ **Do not try to run any of these commands yourself.** Three reasons:
128
+ 1. Steps 2 and 3 require Claude Code slash commands and a session restart — you can't do either from inside a running session.
129
+ 2. Accepting the research-preview safety prompt must be the user's explicit act.
130
+ 3. If something goes wrong mid-install, the user needs to see each step's output to diagnose.
131
+
132
+ The user always executes these manually. Your job is to make the sequence obvious and copyable.
133
+
134
+
135
+ ## Phase 0: Preflight Detection
136
+
137
+ Before starting the interview, automatically detect:
138
+
139
+ ### Package Manager
140
+ Check for lock files in the project root:
141
+ - `pnpm-lock.yaml` → use `pnpm`
142
+ - `yarn.lock` → use `yarn`
143
+ - `package-lock.json` → use `npm`
144
+ - `bun.lockb` → use `bun`
145
+
146
+ ### Framework Detection
147
+ Check for config files:
148
+ - `next.config.js` or `next.config.mjs` or `next.config.ts` → **Next.js**
149
+ - Check for `app/` directory → App Router
150
+ - Check for `pages/` directory → Pages Router
151
+ - `vite.config.js` or `vite.config.ts` → **Vite**
152
+ - `remix.config.js` → **Remix**
153
+ - `nuxt.config.js` or `nuxt.config.ts` → **Nuxt**
154
+ - `astro.config.mjs` → **Astro**
155
+
156
+ ### Styling System Detection
157
+ Check `package.json` dependencies and config files:
158
+ - `tailwind.config.js` or `tailwind.config.ts` → **Tailwind CSS**
159
+ - `@mui/material` in dependencies → **Material UI**
160
+ - `@chakra-ui/react` in dependencies → **Chakra UI**
161
+ - `antd` in dependencies → **Ant Design**
162
+ - `styled-components` in dependencies → **styled-components**
163
+ - `@emotion/react` in dependencies → **Emotion**
164
+ - `.css` or `.module.css` files → **CSS Modules**
165
+
166
+ ### Design Memory Check
167
+ Look for existing Design Memory file:
168
+ - `docs/design-memory.md`
169
+ - `DESIGN_MEMORY.md`
170
+ - `.claude-design/design-memory.md`
171
+
172
+ If found, read it and use to prefill defaults and skip redundant questions.
173
+
174
+ ### Visual Style Inference (CRITICAL)
175
+
176
+ **DO NOT use generic/predefined styles. Extract visual language from the project:**
177
+
178
+ **If Tailwind detected**, read `tailwind.config.js` or `tailwind.config.ts`:
179
+ ```javascript
180
+ // Extract and use:
181
+ theme.colors // Color palette
182
+ theme.spacing // Spacing scale
183
+ theme.borderRadius // Radius values
184
+ theme.fontFamily // Typography
185
+ theme.boxShadow // Elevation system
186
+ ```
187
+
188
+ **If CSS Variables exist**, read `globals.css`, `variables.css`, or `:root` definitions:
189
+ ```css
190
+ :root {
191
+ --color-* /* Color tokens */
192
+ --spacing-* /* Spacing tokens */
193
+ --font-* /* Typography tokens */
194
+ --radius-* /* Border radius tokens */
195
+ }
196
+ ```
197
+
198
+ **If UI library detected** (MUI, Chakra, Ant), read the theme configuration:
199
+ - MUI: `theme.ts` or `createTheme()` call
200
+ - Chakra: `theme/index.ts` or `extendTheme()` call
201
+ - Ant: `ConfigProvider` theme prop
202
+
203
+ **Always scan existing components** to understand patterns:
204
+ - Find 2-3 existing buttons → note their styling patterns
205
+ - Find 2-3 existing cards → note padding, borders, shadows
206
+ - Find existing forms → note input styles, label placement
207
+ - Find existing typography → note heading sizes, body text
208
+
209
+ **Store inferred styles in the Design Brief** for consistent use across all variants.
210
+
211
+
212
+ ## Phase 1: Interview
213
+
214
+ Use the **AskUserQuestion** tool for all interview steps. Adapt questions based on Design Memory if it exists.
215
+
216
+ ### Step 1.1: Scope & Target
217
+
218
+ Ask these questions (can combine into single AskUserQuestion with multiple questions):
219
+
220
+ **Question 1: Scope**
221
+ - Header: "Scope"
222
+ - Question: "Are we designing a single component or a full page?"
223
+ - Options:
224
+ - "Component" - A reusable UI element (button, card, form, modal, etc.)
225
+ - "Page" - A complete page or screen layout
226
+
227
+ **Question 2: New or Redesign**
228
+ - Header: "Type"
229
+ - Question: "Is this a new design or a redesign of something existing?"
230
+ - Options:
231
+ - "New" - Creating something from scratch
232
+ - "Redesign" - Improving an existing component/page
233
+
234
+ If "Redesign" selected, ask:
235
+ **Question 3: Existing Path**
236
+ - Header: "Location"
237
+ - Question: "What is the file path or route of the existing UI?"
238
+ - Options: (let user provide via "Other")
239
+
240
+ If target is unclear, propose a name based on repo patterns and confirm.
241
+
242
+ ### Step 1.2: Pain Points & Inspiration
243
+
244
+ **Question 1: Pain Points**
245
+ - Header: "Problems"
246
+ - Question: "What are the top pain points with the current design (or what should this new design avoid)?"
247
+ - Options:
248
+ - "Too cluttered/dense" - Information overload, hard to scan
249
+ - "Unclear hierarchy" - Primary actions aren't obvious
250
+ - "Poor mobile experience" - Doesn't work well on small screens
251
+ - "Outdated look" - Feels old or inconsistent with brand
252
+ - multiSelect: true
253
+
254
+ **Question 2: Visual Inspiration**
255
+ - Header: "Visual style"
256
+ - Question: "What products or brands should I reference for visual inspiration?"
257
+ - Options:
258
+ - "Stripe" - Clean, minimal, trustworthy
259
+ - "Linear" - Dense, keyboard-first, developer-focused
260
+ - "Notion" - Flexible, content-focused, playful
261
+ - "Apple" - Premium, spacious, refined
262
+ - multiSelect: true
263
+
264
+ **Question 3: Functional Inspiration**
265
+ - Header: "Interactions"
266
+ - Question: "What interaction patterns should I emulate?"
267
+ - Options:
268
+ - "Inline editing" - Edit in place without modals
269
+ - "Progressive disclosure" - Show more as needed
270
+ - "Optimistic updates" - Instant feedback, sync in background
271
+ - "Keyboard shortcuts" - Power user efficiency
272
+
273
+ ### Step 1.3: Brand & Style Direction
274
+
275
+ **Question 1: Brand Adjectives**
276
+ - Header: "Brand tone"
277
+ - Question: "What 3-5 adjectives describe the desired brand feel?"
278
+ - Options:
279
+ - "Minimal" - Clean, simple, uncluttered
280
+ - "Premium" - High-end, polished, refined
281
+ - "Playful" - Fun, friendly, approachable
282
+ - "Utilitarian" - Functional, efficient, no-nonsense
283
+ - multiSelect: true
284
+
285
+ **Question 2: Density**
286
+ - Header: "Density"
287
+ - Question: "What information density do you prefer?"
288
+ - Options:
289
+ - "Compact" - More information visible, tighter spacing
290
+ - "Comfortable" - Balanced spacing, easy scanning
291
+ - "Spacious" - Generous whitespace, focused attention
292
+
293
+ **Question 3: Dark Mode**
294
+ - Header: "Dark mode"
295
+ - Question: "Is dark mode required?"
296
+ - Options:
297
+ - "Yes" - Must support dark mode
298
+ - "No" - Light mode only
299
+ - "Nice to have" - Support if easy, not required
300
+
301
+ ### Step 1.4: Persona & Jobs-to-be-Done
302
+
303
+ **Question 1: Primary User**
304
+ - Header: "User"
305
+ - Question: "Who is the primary end user?"
306
+ - Options:
307
+ - "Developer" - Technical, keyboard-oriented
308
+ - "Designer" - Visual, detail-oriented
309
+ - "Business user" - Efficiency-focused, less technical
310
+ - "End consumer" - General public, varied technical ability
311
+
312
+ **Question 2: Context**
313
+ - Header: "Context"
314
+ - Question: "What's the primary usage context?"
315
+ - Options:
316
+ - "Desktop-first" - Primarily used on larger screens
317
+ - "Mobile-first" - Primarily used on phones
318
+ - "Both equally" - Must work well on all devices
319
+
320
+ **Question 3: Key Tasks**
321
+ - Header: "Key tasks"
322
+ - Question: "What are the top 3 tasks users must complete?"
323
+ - (Let user provide via "Other" - this is open-ended)
324
+
325
+ ### Step 1.5: Constraints
326
+
327
+ **Question 1: Must-Keep Elements**
328
+ - Header: "Keep"
329
+ - Question: "Are there elements that must be preserved?"
330
+ - Options:
331
+ - "Existing copy/labels" - Keep current text
332
+ - "Current fields/inputs" - Keep form structure
333
+ - "Navigation structure" - Keep current nav
334
+ - "None" - Free to change everything
335
+
336
+ **Question 2: Technical Constraints**
337
+ - Header: "Constraints"
338
+ - Question: "Any technical constraints?"
339
+ - Options:
340
+ - "No new dependencies" - Use existing libraries only
341
+ - "Use existing components" - Build on current design system
342
+ - "Must be accessible (WCAG)" - Strict accessibility requirements
343
+ - "None" - No special constraints
344
+ - multiSelect: true
345
+
346
+
347
+ ## Phase 2: Generate Design Brief
348
+
349
+ After the interview, create a structured Design Brief as JSON and save to `.claude-design/design-brief.json`:
350
+
351
+ ```json
352
+ {
353
+ "scope": "component|page",
354
+ "isRedesign": true|false,
355
+ "targetPath": "src/components/Example.tsx",
356
+ "targetName": "Example",
357
+ "painPoints": ["Too dense", "Primary action unclear"],
358
+ "inspiration": {
359
+ "visual": ["Stripe", "Linear"],
360
+ "functional": ["Inline validation"]
361
+ },
362
+ "brand": {
363
+ "adjectives": ["minimal", "trustworthy"],
364
+ "density": "comfortable",
365
+ "darkMode": true
366
+ },
367
+ "persona": {
368
+ "primary": "Developer",
369
+ "context": "desktop-first",
370
+ "keyTasks": ["Complete checkout", "Review order", "Apply discount"]
371
+ },
372
+ "constraints": {
373
+ "mustKeep": ["existing fields"],
374
+ "technical": ["no new dependencies", "WCAG accessible"]
375
+ },
376
+ "framework": "nextjs-app",
377
+ "packageManager": "pnpm",
378
+ "stylingSystem": "tailwind"
379
+ }
380
+ ```
381
+
382
+ Display a summary to the user before proceeding.
383
+
384
+
385
+ ## Phase 3: Generate Live Canvas
386
+
387
+ ### Directory Structure
388
+
389
+ Create all files under `.claude-design/`:
390
+
391
+ ```
392
+ .claude-design/
393
+ ├── lab/
394
+ │ ├── page.tsx # Main lab page (framework-specific)
395
+ │ ├── variants/
396
+ │ │ ├── VariantA.tsx
397
+ │ │ ├── VariantB.tsx
398
+ │ │ ├── VariantC.tsx
399
+ │ │ ├── VariantD.tsx
400
+ │ │ └── VariantE.tsx
401
+ │ ├── components/
402
+ │ │ └── LabShell.tsx # Lab layout wrapper
403
+ │ ├── feedback/ # Interactive feedback system
404
+ │ │ ├── types.ts # TypeScript interfaces
405
+ │ │ ├── selector-utils.ts # Element identification
406
+ │ │ ├── format-utils.ts # Feedback formatting
407
+ │ │ ├── FeedbackOverlay.tsx # Main overlay component
408
+ │ │ └── index.ts # Module exports
409
+ │ └── data/
410
+ │ └── fixtures.ts # Shared mock data
411
+ ├── design-brief.json
412
+ └── run-log.md
413
+ ```
414
+
415
+ ### Feedback System Setup (CRITICAL - NEVER SKIP)
416
+
417
+ **The overlay is the PRIMARY feature of Live Canvas.** Without it, users cannot provide interactive feedback. NEVER generate a lab without the overlay.
418
+
419
+ ### Choose the right overlay template
420
+
421
+ The skill ships two overlay templates under `~/.claude/skills/live-canvas/templates/`:
422
+
423
+ | Template | When to use |
424
+ |---|---|
425
+ | `feedback-react/FeedbackOverlay.tsx` | React / Next.js / Vite-React projects — integrates via JSX |
426
+ | `overlay-vanilla.js` | Everything else: vanilla JS, Vue, Svelte, Rails, Django, Phoenix, plain HTML, Go templates, etc. One script tag, zero dependencies. |
427
+
428
+ Detect the host framework in Phase 0 and copy the matching template into the route directory. The vanilla template is the safer default when in doubt — it works in every context the React one does, plus more.
429
+
430
+ ### Required files in the route directory
431
+
432
+ For **React-based** projects:
433
+ ```
434
+ app/live-canvas/ # or app/__live_canvas/
435
+ ├── page.tsx # Main lab page with variants + overlay import
436
+ └── FeedbackOverlay.tsx # Copy of feedback-react/FeedbackOverlay.tsx
437
+ ```
438
+
439
+ Import: `import { FeedbackOverlay } from './FeedbackOverlay'`
440
+
441
+ For **non-React** projects:
442
+ ```
443
+ <static-dir>/__live_canvas/
444
+ ├── index.html # Or framework-appropriate entry point
445
+ └── overlay-vanilla.js # Copy of templates/overlay-vanilla.js
446
+ ```
447
+
448
+ HTML: `<script src="overlay-vanilla.js"></script>` plus an init script that wires up mode + target (see "Wiring the overlay" below).
449
+
450
+ ### Wiring the overlay
451
+
452
+ Every page that renders the lab must initialize the overlay once. Behavior depends on whether Live mode was detected in Phase 0.
453
+
454
+ **Vanilla (`overlay-vanilla.js`):**
455
+
456
+ ```html
457
+ <script src="./overlay-vanilla.js"></script>
458
+ <script>
459
+ LiveCanvas.init({
460
+ target: '<ComponentOrPageName>',
461
+ // Only include channelUrl when Phase 0 detected a live channel.
462
+ // If Batch mode, OMIT channelUrl so the overlay skips the probe.
463
+ channelUrl: 'http://localhost:8788',
464
+ // Optional: where to POST batch payloads when channelUrl is missing.
465
+ // When omitted, a batch Submit downloads a JSON file instead.
466
+ batchEndpoint: '/__live_canvas/feedback',
467
+ });
468
+ </script>
469
+ ```
470
+
471
+ **React (`FeedbackOverlay.tsx`):**
472
+
473
+ Pass the same `targetName` prop plus the mode-appropriate endpoints via its props. Render `<FeedbackOverlay />` at the end of the lab page.
474
+
475
+ ### Why the templates live in the route directory
476
+
477
+ - `.claude-design/` paths can fail due to bundler configurations
478
+ - Relative imports from the same directory always work
479
+ - The route directory gets deleted during cleanup anyway
480
+
481
+ ### Route Integration
482
+
483
+ **Next.js App Router:**
484
+ Create `app/__live_canvas/page.tsx` that imports from `.claude-design/lab/`
485
+
486
+ **Next.js Pages Router:**
487
+ Create `pages/__live_canvas.tsx` that imports from `.claude-design/lab/`
488
+
489
+ **Vite React:**
490
+ - If React Router exists: add route to `/__live_canvas`
491
+ - If no router: create a conditional render in `App.tsx` based on `?live_canvas=true` query param
492
+
493
+ **Other frameworks:**
494
+ Create the most appropriate temporary route for the detected framework.
495
+
496
+ ### Variant Generation Guidelines
497
+
498
+ **IMPORTANT:** Read `DESIGN_PRINCIPLES.md` for UX, interaction, and motion best practices. But **DO NOT use predefined visual styles**—infer them from the project.
499
+
500
+ **Apply universal principles (from DESIGN_PRINCIPLES.md):**
501
+ - **UX**: Nielsen's heuristics, cognitive load reduction, progressive disclosure
502
+ - **Component behavior**: Button states, form anatomy, card structure
503
+ - **Interaction**: Feedback patterns, state handling, optimistic updates
504
+ - **Motion**: Timing (150-300ms), easing (ease-out entrances, ease-in exits)
505
+ - **Accessibility**: Focus states, ARIA patterns, touch targets (44px min)
506
+
507
+ **Infer visual styles from the project:**
508
+ - Colors → from Tailwind config, CSS variables, or existing components
509
+ - Typography → from existing headings, body text in the codebase
510
+ - Spacing → from the project's spacing scale or existing patterns
511
+ - Border radius → from existing cards, buttons, inputs
512
+ - Shadows → from existing elevated components
513
+
514
+
515
+ Each variant MUST explore a different design axis. Do not create minor variations—make them meaningfully distinct. **Use the project's existing visual language for all variants.**
516
+
517
+ **Variant A: Information Hierarchy Focus**
518
+ - Restructure content hierarchy (what's most important?)
519
+ - Apply Gestalt proximity—group related items closer
520
+ - One primary action per view
521
+ - Use existing typography scale to create clear levels
522
+
523
+ **Variant B: Layout Model Exploration**
524
+ - Try a different layout approach (card vs list vs table vs split-pane)
525
+ - Apply card anatomy or table behavior patterns from DESIGN_PRINCIPLES
526
+ - Consider responsive behavior at each breakpoint
527
+ - Use the project's existing grid/layout system
528
+
529
+ **Variant C: Density Variation**
530
+ - If brief says "comfortable", try a more compact version
531
+ - If brief says "compact", try a more spacious version
532
+ - Use the project's existing spacing tokens—just apply them differently
533
+ - Show the tradeoffs: more visible data vs easier scanning
534
+
535
+ **Variant D: Interaction Model**
536
+ - Different interaction pattern (modal vs inline vs panel vs drawer)
537
+ - Apply feedback patterns: immediate → progress → completion
538
+ - Implement all required states (loading, error, empty, disabled)
539
+ - Consider optimistic updates for non-destructive actions
540
+
541
+ **Variant E: Expressive Direction**
542
+ - Push the brand direction the user described in the interview
543
+ - Explore different uses of the project's existing design tokens
544
+ - More or less use of shadows, borders, background colors
545
+ - Apply motion where it adds meaning (hover, focus, transitions)
546
+
547
+ ### Lab Page Requirements
548
+
549
+ The Live Canvas page must include:
550
+
551
+ 1. **Header** with:
552
+ - Design Brief summary (target, scope, key requirements)
553
+ - Instructions for reviewing
554
+
555
+ 2. **Variant Grid** with:
556
+ - Clear labels (A, B, C, D, E)
557
+ - Brief rationale for each variant ("Why this exists")
558
+ - The actual rendered variant
559
+ - Notes highlighting key differences
560
+ - **IMPORTANT:** Each variant container must have `data-variant="X"` attribute (where X is A, B, C, D, E, or F). This is required for the feedback system to identify which variant comments belong to.
561
+
562
+ 3. **Responsive behavior**:
563
+ - Desktop: side-by-side grid (2-3 columns)
564
+ - Mobile: horizontal scroll or tabs
565
+
566
+ 4. **Shared Data**:
567
+ - All variants use the same fixture data from `data/fixtures.ts`
568
+ - Ensures fair comparison
569
+
570
+ 5. **Feedback Overlay** (CRITICAL - NEVER OMIT):
571
+
572
+ ⚠️ **THIS IS THE MOST IMPORTANT REQUIREMENT** ⚠️
573
+
574
+ The FeedbackOverlay enables users to click on elements and leave comments. Without it, the Live Canvas is just a static page with no way to collect structured feedback.
575
+
576
+ - Create `FeedbackOverlay.tsx` in the SAME directory as `page.tsx`
577
+ - Import with relative path: `import { FeedbackOverlay } from './FeedbackOverlay'`
578
+ - Render at the END of the page, after all variants
579
+ - Pass `targetName` prop with the component/page name
580
+
581
+ **Example integration:**
582
+
583
+ ```tsx
584
+ import { FeedbackOverlay } from './FeedbackOverlay'; // Relative import - always works
585
+
586
+ export default function DesignLabPage() {
587
+ return (
588
+ <div className="min-h-screen bg-background">
589
+ <header>...</header>
590
+
591
+ <main>
592
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
593
+ <div data-variant="A">
594
+ <VariantA />
595
+ </div>
596
+ <div data-variant="B">
597
+ <VariantB />
598
+ </div>
599
+ {/* ... more variants */}
600
+ </div>
601
+ </main>
602
+
603
+ {/* CRITICAL: FeedbackOverlay must be included */}
604
+ <FeedbackOverlay targetName="ComponentName" />
605
+ </div>
606
+ );
607
+ }
608
+ ```
609
+
610
+ **If you forget the FeedbackOverlay, the user CANNOT provide feedback.** This defeats the entire purpose of the Live Canvas.
611
+
612
+ ### Code Quality
613
+
614
+ **Conventions:**
615
+ - Follow the project's existing code conventions (file naming, imports, etc.)
616
+ - Use the detected styling system (Tailwind, CSS modules, etc.)
617
+ - Use existing components from the project where appropriate
618
+
619
+ **Accessibility (from DESIGN_PRINCIPLES):**
620
+ - Semantic HTML: `<button>` not `<div onclick>`, `<nav>`, `<main>`, `<section>`
621
+ - Keyboard navigation: all interactive elements focusable and operable
622
+ - Focus states: visible `:focus-visible` with 2px ring and offset
623
+ - Color contrast: 4.5:1 for text, 3:1 for UI elements
624
+ - Touch targets: minimum 44x44px
625
+ - ARIA only when HTML semantics aren't enough
626
+
627
+ **States (every component needs):**
628
+ - Default, Hover, Focus, Active, Disabled, Loading, Error, Empty
629
+ - See DESIGN_PRINCIPLES "State Handling" section
630
+
631
+ **Motion:**
632
+ - Use appropriate timing: 150-200ms for micro-interactions, 200-300ms for transitions
633
+ - Use ease-out for entrances, ease-in for exits
634
+ - Respect `prefers-reduced-motion`
635
+
636
+
637
+ ## Phase 4: Present Live Canvas to User
638
+
639
+ After generating the lab files, **immediately** present the lab to the user. Do NOT attempt to:
640
+ - Start the dev server yourself (it runs forever and will block)
641
+ - Check if ports are open
642
+ - Open a browser
643
+ - Wait for any server response
644
+
645
+ ### What to say — mode-dependent
646
+
647
+ Use the version matching the mode detected in Phase 0.
648
+
649
+ **If LIVE mode:**
650
+
651
+ ```
652
+ ✨ Live Canvas ready — Live mode
653
+
654
+ Variants are at: http://localhost:3000/__live_canvas (adjust to your dev port)
655
+
656
+ Make sure your dev server is running, then:
657
+ 1. Click "Add Feedback" (bottom-right)
658
+ 2. Click any element → type → Save
659
+ 3. Each Save streams here instantly — I'll acknowledge and edit the corresponding variant
660
+ 4. Keep going, or tell me "done" whenever you're ready to synthesize a winner
661
+ ```
662
+
663
+ **If BATCH mode:**
664
+
665
+ ```
666
+ 📝 Live Canvas ready — Batch mode
667
+
668
+ Variants are at: http://localhost:3000/__live_canvas
669
+
670
+ Click "Add Feedback" (bottom-right), comment on elements, fill "Overall Direction", click Submit.
671
+ Then paste the JSON/markdown here, or just tell me your feedback in plain English.
672
+
673
+ (To enable Live mode next time, see the one-time setup printed at the top.)
674
+ ```
675
+
676
+ ### Then proceed to Phase 5
677
+
678
+ Don't wait for the user to confirm they opened the browser — move on so the feedback instructions are queued.
679
+
680
+ ### Why Not Start the Server
681
+
682
+ Running `pnpm dev` or `npm run dev` starts a long-running process that never exits. If you run it, you'll wait forever. The user likely already has their dev server running, or can start it themselves in another terminal.
683
+
684
+
685
+ ## Phase 5: Collect Feedback
686
+
687
+ Behavior depends on the mode detected in Phase 0.
688
+
689
+ ### Live mode — handling streamed channel events
690
+
691
+ In Live mode, feedback arrives in your context as:
692
+
693
+ ```
694
+ <channel source="live-canvas" target="PostCard" variant="B" selector="[data-testid='reply-b']" tagName="button" commentId="c-123...">
695
+ make this more prominent
696
+ </channel>
697
+ ```
698
+
699
+ **For each `<channel>` tag, do all four steps, in this order:**
700
+
701
+ 1. **Acknowledge back to the user in chat** — one short sentence confirming what you received. Examples:
702
+ - `Got it — variant B's Reply button, "make this more prominent". Editing now.`
703
+ - `On it: variant C post card, "add more spacing". Updating.`
704
+ Do not skip this. The user is watching their browser and needs a text signal that the push landed.
705
+
706
+ 2. **Locate the file** — the variant attribute tells you which file (`.claude-design/lab/variants/Variant<X>.tsx`). The selector identifies the element inside it.
707
+
708
+ 3. **Edit the file** — make the change implied by the feedback text. Prefer small, surgical edits over rewrites. If the feedback is ambiguous ("change this"), ask one clarifying question rather than guessing.
709
+
710
+ 4. **Close the loop** — one short reply after the edit: `✅ Done — variant B Reply button is now larger and primary-colored.` Then wait for the next channel event or user message.
711
+
712
+ If multiple `<channel>` tags arrive together, batch the acknowledgments but do each edit one at a time so the user's dev server hot-reloads visibly between changes.
713
+
714
+ ### Batch mode — interactive or pasted
715
+
716
+ The Live Canvas includes a Figma-like feedback overlay. When presenting the lab, include these instructions:
717
+
718
+ ```
719
+ ✅ Live Canvas created!
720
+
721
+ I've generated 5 design variants in `.claude-design/lab/`
722
+
723
+ To view and provide feedback:
724
+ 1. Make sure your dev server is running (run `pnpm dev` if not)
725
+ 2. Open: http://localhost:3000/__live_canvas
726
+
727
+ **To add feedback:**
728
+ 1. Click the "Add Feedback" button (bottom-right corner)
729
+ 2. Click any element you want to comment on
730
+ 3. Type your feedback and click "Save"
731
+ 4. Repeat for all elements you want to comment on
732
+ 5. Fill in the "Overall Direction" field (required)
733
+ 6. Click "Submit All Feedback"
734
+ 7. Paste the copied text here in the terminal
735
+
736
+ Or just describe your feedback manually below!
737
+ ```
738
+
739
+ **When the user pastes feedback**, it will be in this format:
740
+
741
+ ```markdown
742
+ ## Live Canvas Feedback
743
+
744
+ **Target:** ComponentName
745
+ **Comments:** 3
746
+
747
+ ### Variant A
748
+ 1. **Button** (`[data-testid='submit']`, button with "Submit")
749
+ "Make this more prominent"
750
+
751
+ ### Variant B
752
+ 1. **Card** (`.product-card`, div with "Product Name")
753
+ "Love this layout"
754
+
755
+ ### Overall Direction
756
+ Go with Variant B's structure. Apply Variant A's button styling.
757
+ ```
758
+
759
+ **How to parse and act on this feedback:**
760
+
761
+ 1. **Read the Overall Direction** first - this guides your synthesis
762
+ 2. **For each comment**, locate the element using:
763
+ - Primary: The CSS selector in backticks (e.g., `[data-testid='submit']`)
764
+ - Secondary: The element description (e.g., "button with 'Submit'")
765
+ 3. **Apply the feedback** by editing the corresponding variant file
766
+
767
+ ### Fallback: Manual Feedback via AskUserQuestion
768
+
769
+ If the user prefers not to use the interactive overlay (or pastes manual feedback), use the AskUserQuestion flow below:
770
+
771
+ ### Stage 1: Check for a Winner
772
+
773
+ **Question 1: Ready to pick?**
774
+ - Header: "Decision"
775
+ - Question: "Is there one variant you like as is?"
776
+ - Options:
777
+ - "Yes - I found one I like" - Ready to select a winner and refine
778
+ - "No - I like parts of different ones" - Need to synthesize a new variant
779
+
780
+ ### Stage 2A: If User Found a Winner
781
+
782
+ If user said "Yes", ask:
783
+
784
+ **Question 2a: Which one?**
785
+ - Header: "Winner"
786
+ - Question: "Which variant do you want to go with?"
787
+ - Options:
788
+ - "Variant A" - [brief description of A]
789
+ - "Variant B" - [brief description of B]
790
+ - "Variant C" - [brief description of C]
791
+ - "Variant D" - [brief description of D]
792
+ - "Variant E" - [brief description of E]
793
+
794
+ **Question 3a: Any tweaks?**
795
+ - Header: "Tweaks"
796
+ - Question: "Any small changes needed, or is it good as is?"
797
+ - Options:
798
+ - "Good as is" - No changes needed, proceed to final preview
799
+ - "Minor tweaks needed" - I'll describe what to adjust
800
+
801
+ If "Minor tweaks needed", ask user to describe changes via text input.
802
+
803
+ Then proceed to **Phase 7: Final Preview**.
804
+
805
+ ### Stage 2B: If User Wants to Synthesize
806
+
807
+ If user said "No - I like parts of different ones", ask:
808
+
809
+ **Question 2b: What do you like about each?**
810
+ - Header: "Feedback"
811
+ - Question: "What do you like about each variant? (mention specific elements from A, B, C, D, E)"
812
+ - (Let user provide detailed feedback via "Other" text input)
813
+
814
+ Example response format to guide user:
815
+ ```
816
+ - A: Love the card layout and spacing
817
+ - B: The color scheme feels right
818
+ - C: The interaction on hover is great
819
+ - D: Nothing stands out
820
+ - E: The typography hierarchy is clearest
821
+ ```
822
+
823
+ Then proceed to **Phase 6: Synthesize New Variant**.
824
+
825
+
826
+ ## Phase 6: Synthesize New Variant
827
+
828
+ Based on the user's feedback about what they liked from each variant:
829
+
830
+ 1. **Create a new hybrid variant** (Variant F) that combines:
831
+ - The specific elements the user called out from each
832
+ - The best structural decisions across all variants
833
+ - Any patterns that appeared in multiple variants
834
+
835
+ 2. **Replace the Live Canvas** with a comparison view:
836
+ - Show the new synthesized Variant F prominently
837
+ - Keep 1-2 of the original variants that were closest for comparison
838
+ - Remove variants that had nothing the user liked
839
+
840
+ 3. **Update the `/__live_canvas` route** to show the new arrangement
841
+
842
+ 4. **Ask for feedback again:**
843
+
844
+ **Question: How's the new variant?**
845
+ - Header: "Review"
846
+ - Question: "How does the synthesized variant (F) look?"
847
+ - Options:
848
+ - "This is it!" - Proceed to final preview
849
+ - "Getting closer" - Need another iteration
850
+ - "Went the wrong direction" - Let me clarify what I want
851
+
852
+ If "Getting closer" or "Went the wrong direction", gather more specific feedback and iterate. Support multiple synthesis passes until user is satisfied.
853
+
854
+ Then proceed to **Phase 7: Final Preview**.
855
+
856
+
857
+ ## Phase 7: Final Preview
858
+
859
+ Once user is satisfied:
860
+
861
+ 1. Create `.claude-design/preview/` directory:
862
+ ```
863
+ .claude-design/preview/
864
+ ├── page.tsx # Preview page
865
+ └── FinalDesign.tsx # The winning design
866
+ ```
867
+
868
+ 2. Create route at `/__design_preview`
869
+
870
+ 3. For redesigns, include before/after comparison:
871
+ - Toggle switch or split view
872
+ - Show original alongside proposed
873
+
874
+ 4. Ask for final confirmation:
875
+
876
+ **Question: Confirm final design?**
877
+ - Header: "Confirm"
878
+ - Question: "Ready to finalize this design?"
879
+ - Options:
880
+ - "Yes, finalize it" - Proceed to cleanup and generate implementation plan
881
+ - "No, needs changes" - Tell me what to adjust
882
+ - "Abort - cancel everything" - Delete all temp files, no plan generated
883
+
884
+ If "No, needs changes": gather feedback and iterate.
885
+ If "Abort": proceed to **Abort Handling** below.
886
+
887
+
888
+ ## Abort Handling
889
+
890
+ If the user wants to cancel/abort at ANY point during the process (not just final confirmation), they may say things like:
891
+ - "cancel"
892
+ - "abort"
893
+ - "stop"
894
+ - "nevermind"
895
+ - "forget it"
896
+ - "I changed my mind"
897
+
898
+ When abort is detected:
899
+
900
+ 1. **Confirm the abort:**
901
+ - "Are you sure you want to cancel? This will delete all the Live Canvas files I created."
902
+
903
+ 2. **If confirmed, clean up immediately:**
904
+ - Delete `.claude-design/` directory entirely
905
+ - Delete temporary route files (`app/__live_canvas/`, etc.)
906
+ - Do NOT generate any implementation plan
907
+ - Do NOT update Design Memory
908
+
909
+ 3. **Acknowledge:**
910
+ - "Design exploration cancelled. All temporary files have been cleaned up. Let me know if you want to start fresh later."
911
+
912
+
913
+ ## Phase 8: Finalize
914
+
915
+ When user confirms (selected "Yes, finalize it"):
916
+
917
+ ### 8.1: Cleanup
918
+
919
+ Delete all temporary files:
920
+ - Remove `.claude-design/` directory entirely
921
+ - Remove temporary route files:
922
+ - `app/__live_canvas/` (Next.js App Router)
923
+ - `pages/__live_canvas.tsx` (Next.js Pages Router)
924
+ - `app/__design_preview/`
925
+ - `pages/__design_preview.tsx`
926
+ - Revert any `App.tsx` modifications (Vite)
927
+
928
+ **Safety rules:**
929
+ - ONLY delete files inside `.claude-design/`
930
+ - ONLY delete route files that the plugin created
931
+ - NEVER delete user-authored files
932
+ - Verify file paths before deletion
933
+
934
+ ### 8.2: Generate Implementation Plan
935
+
936
+ Create `DESIGN_PLAN.md` in the project root:
937
+
938
+ ```markdown
939
+ # Design Implementation Plan: [TargetName]
940
+
941
+ ## Summary
942
+ - **Scope:** [component/page]
943
+ - **Target:** [file path]
944
+ - **Winner variant:** [A-E]
945
+ - **Key improvements:** [from feedback]
946
+
947
+ ## Files to Change
948
+ - [ ] `src/components/Example.tsx` - Main component refactor
949
+ - [ ] `src/styles/example.css` - Style updates
950
+ - [ ] ... (list all affected files)
951
+
952
+ ## Implementation Steps
953
+ 1. [Specific step with code guidance]
954
+ 2. [Next step]
955
+ 3. ...
956
+
957
+ ## Component API
958
+ - **Props:**
959
+ - `prop1: type` - description
960
+ - ...
961
+ - **State:**
962
+ - Internal state requirements
963
+ - **Events:**
964
+ - Callbacks and handlers
965
+
966
+ ## Required UI States
967
+ - **Loading:** [description]
968
+ - **Empty:** [description]
969
+ - **Error:** [description]
970
+ - **Disabled:** [description]
971
+ - **Validation:** [description]
972
+
973
+ ## Accessibility Checklist
974
+ - [ ] Keyboard navigation works
975
+ - [ ] Focus states visible
976
+ - [ ] Labels and aria-* attributes correct
977
+ - [ ] Color contrast meets WCAG AA
978
+ - [ ] Screen reader tested
979
+
980
+ ## Testing Checklist
981
+ - [ ] Unit tests for logic
982
+ - [ ] Component tests for rendering
983
+ - [ ] Visual regression tests (if applicable)
984
+ - [ ] E2E smoke test (if applicable)
985
+
986
+ ## Design Tokens
987
+ - [Any new tokens to add]
988
+ - [Existing tokens to use]
989
+
990
+
991
+ *Generated by Live Canvas skill*
992
+ ```
993
+
994
+ ### 8.3: Update Design Memory
995
+
996
+ Create or update `DESIGN_MEMORY.md`:
997
+
998
+ If new file:
999
+ ```markdown
1000
+ # Design Memory
1001
+
1002
+ ## Brand Tone
1003
+ - **Adjectives:** [from interview]
1004
+ - **Avoid:** [anti-patterns discovered]
1005
+
1006
+ ## Layout & Spacing
1007
+ - **Density:** [preference]
1008
+ - **Grid:** [if established]
1009
+ - **Corner radius:** [if consistent]
1010
+ - **Shadows:** [if consistent]
1011
+
1012
+ ## Typography
1013
+ - **Headings:** [font, weights used]
1014
+ - **Body:** [font, size]
1015
+ - **Emphasis:** [patterns]
1016
+
1017
+ ## Color
1018
+ - **Primary:** [color tokens]
1019
+ - **Secondary:** [color tokens]
1020
+ - **Neutral strategy:** [approach]
1021
+ - **Semantic colors:** [error, success, warning]
1022
+
1023
+ ## Interaction Patterns
1024
+ - **Forms:** [validation approach, layout]
1025
+ - **Modals/Drawers:** [when to use which]
1026
+ - **Tables/Lists:** [preferred patterns]
1027
+ - **Feedback:** [toast, inline, etc.]
1028
+
1029
+ ## Accessibility Rules
1030
+ - **Focus:** [visible focus approach]
1031
+ - **Labels:** [labeling conventions]
1032
+ - **Motion:** [reduced motion support]
1033
+
1034
+ ## Repo Conventions
1035
+ - **Component structure:** [file organization]
1036
+ - **Styling approach:** [Tailwind classes, CSS modules, etc.]
1037
+ - **Existing primitives:** [Button, Input, Card, etc.]
1038
+
1039
+
1040
+ *Updated by Live Canvas skill*
1041
+ ```
1042
+
1043
+ If updating existing file:
1044
+ - Append new patterns discovered
1045
+ - Update any conflicting guidance with latest decisions
1046
+ - Keep file concise and actionable
1047
+
1048
+
1049
+ ## Error Handling
1050
+
1051
+ ### Framework Not Detected
1052
+ If framework cannot be determined:
1053
+ - Ask user: "I couldn't detect your framework. What are you using?"
1054
+ - Provide common options: Next.js, Vite, Create React App, Vue, etc.
1055
+
1056
+ ### Dev Server Fails
1057
+ If dev server won't start:
1058
+ - Check for port conflicts
1059
+ - Provide manual instructions
1060
+ - Suggest user starts server themselves
1061
+
1062
+ ### Route Integration Fails
1063
+ If can't create temporary route:
1064
+ - Fall back to creating standalone HTML file
1065
+ - Provide instructions for manual preview
1066
+
1067
+ ### Cleanup Interrupted
1068
+ If cleanup is interrupted:
1069
+ - Log what was deleted vs remaining
1070
+ - Provide manual cleanup instructions
1071
+ - Never leave partial state without informing user
1072
+
1073
+
1074
+ ## Configuration Options
1075
+
1076
+ The plugin supports these optional configurations (via environment or project config):
1077
+
1078
+ - `DESIGN_AUTO_IMPLEMENT`: If `true`, implement the plan immediately after confirmation
1079
+ - `DESIGN_KEEP_LAB`: If `true`, don't delete lab until explicit cleanup command
1080
+ - `DESIGN_MEMORY_PATH`: Custom path for Design Memory file
1081
+
1082
+
1083
+ ## Example Session Flow
1084
+
1085
+ 1. User: `/design-variations:design CheckoutSummary`
1086
+ 2. Plugin detects: Next.js App Router, Tailwind, pnpm
1087
+ 3. Plugin finds: No existing Design Memory
1088
+ 4. Plugin asks: Interview questions (5 steps)
1089
+ 5. Plugin generates: Design Brief summary
1090
+ 6. Plugin creates: `.claude-design/lab/` with 5 variants
1091
+ 7. Plugin creates: `app/__live_canvas/page.tsx`
1092
+ 8. Plugin starts: `pnpm dev`
1093
+ 9. Plugin outputs: "Open http://localhost:3000/__live_canvas"
1094
+ 10. User reviews variants in browser
1095
+ 11. Plugin asks: "Which variant wins?"
1096
+ 12. User: "Variant C, but change X and Y"
1097
+ 13. Plugin refines: Updates Variant C
1098
+ 14. User: "Looks good"
1099
+ 15. Plugin creates: Final preview at `/__design_preview`
1100
+ 16. User: "Confirmed"
1101
+ 17. Plugin: Deletes all temp files
1102
+ 18. Plugin: Generates `DESIGN_PLAN.md`
1103
+ 19. Plugin: Creates `DESIGN_MEMORY.md`
1104
+ 20. Plugin: "Done! See DESIGN_PLAN.md for implementation steps"