--- name: live-canvas description: Conduct design interviews, generate UI variations, and collect live click-to-annotate feedback that streams into the session so edits land without leaving the browser. Use when the user wants rapid iterative UI refinement, not just batched feedback. allowed-tools: Read, Grep, Glob --- # Live Canvas Skill Interview, generate variants, collect feedback, refine, preview, finalize. Why each rule exists: `docs/product/live-canvas-README.md`. **Rules** - **Always ask the feedback mode** with `AskUserQuestion` (Live vs JSON), every run. Never auto-select or auto-detect it. - **Never run the install or relaunch commands yourself.** Print them; the user runs them. - **Never start the dev server,** check ports, open a browser or wait for one. - **The overlay is always wired:** copy `overlay-vanilla.js`, call `LiveCanvas.init` once, put `data-variant` on every variant container. Never generate a lab without it. - **Only delete what this skill created,** inside `.claude-design/` or listed in `routes:` / `overlay:`. Never a user-authored file; verify each path first. - **Temp files never outlive the run.** On finish and on abort, clean up (Phase 8.1). - Never use generic or predefined visual styles; infer them from the project (Phase 0). --- ## Feedback mode Tool names (plugin-namespaced): `mcp__plugin_live-canvas-channel_live-canvas__channel_open`, `mcp__plugin_live-canvas-channel_live-canvas__batch_open`, `mcp__plugin_live-canvas-channel_live-canvas__channel_close`. Every tool returns JSON `{status, port, message?, ...}`. **Host:** run `test "$CLAUDECODE" = 1`. If not Claude Code (Droid, Amp, Opencode), skip the question, announce `๐Ÿ“ JSON mode (Live channel requires Claude Code)`, omit `channelUrl` and `batchEndpoint` in the overlay init, never mention the channel plugin, and go to Phase 0. **Claude Code:** ask with `AskUserQuestion`: | Header | Question | Options | |---|---|---| | Feedback mode | Pick a feedback mode | **Live channel** โ€” overlay streams each Save into this session; requires a session started with `live-claude`, else Live refuses to start. **JSON file** โ€” overlay writes feedback to `.claude-design/feedback.jsonl`; tell me "done" when ready; works in any session. | **If JSON:** call `mcp__plugin_live-canvas-channel_live-canvas__batch_open`. | Result | Do | |---|---| | Tool not available | Announce `๐Ÿ“ JSON mode โ€” overlay will offer JSON download on Submit`. Init with `channelUrl` and `batchEndpoint` omitted. | | `opened` or `already_listening` | Announce `๐Ÿ“ JSON mode โ€” submissions write to .claude-design/feedback.jsonl`. Init with `batchEndpoint: 'http://localhost:8788/feedback-jsonl'`, `channelUrl` omitted. | | `in_use` | Announce `๐Ÿ“ JSON mode โ€” overlay will offer JSON download on Submit (another session holds the port)`. Init with both omitted. | **If Live:** call `mcp__plugin_live-canvas-channel_live-canvas__channel_open`. | Result | Do | |---|---| | Tool not available | First-time setup: print the install block below and STOP. | | `opened` | Announce `โœจ Live mode โ€” feedback streams into this session`. Init with `channelUrl: 'http://localhost:8788'` and `batchEndpoint: 'http://localhost:8788/feedback-jsonl'`. | | `opened` + `took_over: ` | Same, announce `โœจ Live mode โ€” feedback streams into this session (took over channel from prior live-canvas session pid )`. | | `already_listening` | Same as `opened`. | | `no_channel_capability` | Print the result's `message` verbatim and STOP. Do not proceed to Live. | | `in_use` | Print the result's `message` verbatim and STOP (a foreign process holds 8788; never kill it). | **Install block (tool not available):** ``` Live mode needs a one-time install. Two steps: 1. From this repo's root (or wherever liteagents lives): bash packages/claude/plugins/live-canvas-marketplace/setup.sh This copies the marketplace into ~/.claude/plugins/ and runs npm install. 2. In any Claude session, register and install the plugin: /plugin marketplace add ~/.claude/plugins/live-canvas-marketplace /plugin install live-canvas-channel@live-canvas-marketplace That's it โ€” once the plugin is installed, /live-canvas in any session can claim the channel. Re-run /live-canvas and pick Live. ``` The `mode:` line is printed in the Phase 4 ready block; its format is in Phase 8. --- ## Phase 0: Preflight detection Detect before the interview, with file checks (`ls`, `Read`): - **Package manager** from the lock file: `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`, `bun.lockb`. - **Framework** from config: `next.config.*` (`app/` = App Router, `pages/` = Pages Router), `vite.config.*`, `remix.config.js`, `nuxt.config.*`, `astro.config.mjs`. None found: ask the user which framework. - **Styling** from `tailwind.config.*`, `package.json` deps (`@mui/material`, `@chakra-ui/react`, `antd`, `styled-components`, `@emotion/react`), or `.css` / `.module.css` files. - **Design Memory:** read `docs/design-memory.md` or `DESIGN_MEMORY.md` if present; use it to prefill defaults and skip redundant questions. - **Visual style (infer, never preset):** read the tailwind config, `:root` CSS variables (`globals.css`), or the UI-library theme (MUI `createTheme`, Chakra `extendTheme`, Ant `ConfigProvider`). Scan 2-3 existing buttons, cards, forms and headings for padding, borders, shadows, type scale. Store the result in the brief. Brief fields `framework`, `packageManager`, `stylingSystem` are always filled (`unknown` allowed) and echoed in the Phase 2 summary. --- ## Phase 1: Interview Use `AskUserQuestion` for every step (several questions per call is fine). Adapt to Design Memory. Ask every row; `multi` = multiSelect. | Header | Question | Options (label โ€” meaning) | multi | |---|---|---|---| | Scope | Are we designing a single component or a full page? | Component โ€” a reusable UI element; Page โ€” a complete page or screen layout | no | | Type | Is this a new design or a redesign of something existing? | New โ€” from scratch; Redesign โ€” improving an existing component or page | no | | Location | What is the file path or route of the existing UI? (only if Redesign) | no options listed in the current spec; the user answers via Other | no | | Problems | What are the top pain points with the current design (or what should this new design avoid)? | Too cluttered/dense; Unclear hierarchy; Poor mobile experience; Outdated look | yes | | Visual style | What products or brands should I reference for visual inspiration? | Stripe โ€” clean, minimal, trustworthy; Linear โ€” dense, keyboard-first; Notion โ€” flexible, content-focused; Apple โ€” premium, spacious | yes | | Interactions | What interaction patterns should I emulate? | Inline editing; Progressive disclosure; Optimistic updates; Keyboard shortcuts | no | | Brand tone | What 3-5 adjectives describe the desired brand feel? | Minimal; Premium; Playful; Utilitarian | yes | | Density | What information density do you prefer? | Compact; Comfortable; Spacious | no | | Dark mode | Is dark mode required? | Yes; No; Nice to have | no | | User | Who is the primary end user? | Developer; Designer; Business user; End consumer | no | | Context | What's the primary usage context? | Desktop-first; Mobile-first; Both equally | no | | Key tasks | What are the top 3 tasks users must complete? | no options listed in the current spec (open-ended); the user answers via Other | no | | Keep | Are there elements that must be preserved? | Existing copy/labels; Current fields/inputs; Navigation structure; None | no | | Constraints | Any technical constraints? | No new dependencies; Use existing components; Must be accessible (WCAG); None | yes | If the target is unclear, propose a name based on repo patterns and confirm. --- ## Phase 2: Design brief Write `.claude-design/design-brief.json` with every key present: `scope`, `isRedesign`, `targetPath`, `targetName`, `painPoints`, `inspiration` {`visual`, `functional`}, `brand` {`adjectives`, `density`, `darkMode`}, `persona` {`primary`, `context`, `keyTasks`}, `constraints` {`mustKeep`, `technical`}, `framework`, `packageManager`, `stylingSystem`, and: ```json "inferredStyles": { "colors": {}, "spacing": {}, "radius": {}, "typography": {}, "shadows": {}, "sources": ["tailwind.config.ts", "src/components/Button.tsx"] } ``` `inferredStyles` is the result of Visual Style Inference, never omitted: the object above, or `"inferredStyles": "NOT RUN: "`. Show the user a summary (including the detected framework, package manager and styling system) before proceeding. --- ## Phase 3: Generate the lab Files go under `.claude-design/`: `lab/page.tsx`, `lab/variants/Variant{A..E}.tsx`, `lab/components/LabShell.tsx`, `lab/data/fixtures.ts`, `design-brief.json`. Variant files are `.tsx` by default; adapt the extension to the framework. **Overlay.** Copy `~/.claude/skills/live-canvas/templates/overlay-vanilla.js` into the dir the dev server serves statically (`public/` for Next, `static/` or `public/` for Vite, the public dir for Rails/Django). Remember the copy's path: cleanup removes it. One vanilla file works in every framework. Load it with a `