/canvas-to-app:canvas-to-appfrom canvas-to-app
Build any design canvas into the real app in one pass, without errors, keeping the codebase's own architecture, components, tokens and conventions. Reads the whole canvas (Claude Design canvas, spec-to-canvas boards and their canvas-states.json, an HTML canvas, Hub Studio pages, Figma frames or plain screenshots), maps the codebase, writes a contract per screen, takes a gate baseline, then builds screen by screen with tests first and proves each board state in the running app. Shares the canvas memory with spec-to-canvas. Use when the user asks to build, implement, port or ship a canvas, mockup, design or board set into the app, or to make the app match the canvas.
Ships in canvas-to-app. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A canvas is the spec. The codebase is the law. This skill turns the first into the second without breaking either.
"One shot" comes from reading everything before the first edit and from gates that will not let a broken step through. It does not come from typing fast. Fifteen rules, each from a run that went wrong without it:
scripts/gate.mjs baseline before the first edit; gate.mjs check after every screen. Pre-existing failures are recorded, never blamed on the build and never hidden.@ts-ignore, @ts-expect-error, eslint-disable, any cast, .skip, .only, deleted test, loosened assertion, raised threshold or caught-and-dropped exception to make a gate pass. Fix the cause.data-does lines.?view= or deep-link shortcut), same text as the board, 1 % or less pixel difference, zero "Not built yet" controls. Drawn stand-ins are FAIL.data-screen="S03", each built control data-feature="F123", the same IDs as the board. Commits, handoff and harness use them.data-does control does what its line says. A data-later control is drawn disabled with title="Later: …". Never build a store or button nothing reads.scripts/gate.mjs beside this file.<config>/plugins/cache/yra-skills-public/spec-to-canvas/*/skills/spec-to-canvas/scripts/ (<config> = $CLAUDE_CONFIG_DIR, default ~/.claude), else the spec-to-canvas plugin's skills/spec-to-canvas/scripts/ in a yra-skills-public checkout. Call it <stc>. If spec-to-canvas is not installed, say so; read and write the memory files directly and write the manifest by hand.$CANVAS_TO_APP_MEMORY, default ~/.claude/canvas-to-app-memory/ (lessons.md, projects/<slug>.md), shared with spec-to-canvas.node <stc>/memory.mjs show <project-slug> (no slug for a new app). Apply the lessons that touch this run; the user's words win over a lesson.docs/handoff/<slug>.md, the roadmap path the repo uses). A handoff means resume: trust its done rows, continue from its next step.AGENTS.md, CLAUDE.md, CONTRIBUTING.md. Their rules win over this file where they are stricter.Find the source, read all of it, and turn it into one manifest: <app>/canvas-states.json.
| Canvas source | How to read it |
|---|---|
spec-to-canvas generator in the repo (build.mjs + sample files) | Read the generator and sample data; they beat the published HTML. Manifest: rerun node <stc>/lint_boards.mjs <boards-dir> [--after-only] --manifest <app>/canvas-states.json |
| Claude Design canvas (claude.ai artifact url) | Artifact action: read the url; action: list, scope: files for every file; read project/canvas.json and each .dc.html with paths; comments with ArtifactComments. Boards follow the spec-to-canvas anatomy: lint them for the manifest. |
| Interactive or static HTML canvas file | Read the file; click every toggle and state in a browser; screenshot each state at 1600x900. |
| Hub Studio pages | Export HTML from the Hub (yraverage-hub:hub-studio skill), then as an HTML canvas. |
| Figma | figma:figma-design-to-code / figma:figma-use to read frames, variables and components. |
| Screenshots or images only | Read every image. Everything not visible (behaviour, data, empty and error states) is marked inferred and goes to the owner question batch. |
When the source has no manifest, write it by hand in the lint's schema, one entry per board:
{ "board": "S03-register", "screen": "S03", "features": ["F101", "F102"],
"states": [{ "state": "register", "entry": "Projects > Meridian > Register tab", "data": "src/sample/meridian-register.js -> all rows" }],
"controls": [{ "does": "Opens the COP page for the clicked row", "feature": "F102" }],
"later": ["Export to Primavera"] }
Also note per board: every label in order, every NEW / PARTIAL marker (PARTIAL: what exists, what is missing), every callout note (each becomes a test), the sample data shown, the reference images to diff against.
Anything that blocks a contract row (a state with no click path, a control with no action, data with no source, a board that conflicts with an existing screen) goes on the question list. Ask the whole list once with AskUserQuestion, recommended option first. A control the owner does not decide becomes data-later; a state with no click path is cut, never faked.
Write the map into the roadmap (section "Architecture map"), each line with a file:line exemplar. Use graft when the repo is indexed (graft_repo_map, graft_find_code), else an Explore agent for breadth, then read the exemplars yourself.
scripts/test-canvas-states.mjs)git worktree list)Screen contract per board, in the roadmap. One table per screen:
| Canvas item | App target | Reuses | New | Test |
|---|---|---|---|---|
| S03 root | src/screens/Register.tsx, route /projects/:id/register | layout of Cops.tsx (closest screen) | none | register.spec.ts |
F102 row click (data-does) | onRowOpen in useRegister | DataTable | handler | e2e: click COP-014, sees COP page |
state cop | Entry: Register, click COP-014 | meridian-register.js | none | harness row |
Order: shared data and sample files first, then shared components the boards need, then screens by dependency, then by value. A screen that touches another session's claimed files is blocked, named, and skipped.
Roadmap and handoff before code (global rule for big features): roadmap = goal, contract tables, order, open questions; handoff = status table per screen (open, in progress, done, blocked, with evidence), next step.
Who builds: one screen = one unit of work. For more than two screens, delegate per the owner's worker rules (Sonnet workers, checkpoint file, brief that names the roadmap, the handoff, the contract table and the files the worker owns). The lead keeps shared files (router, tokens, sample data, harness) and the combined gate. The lead judges the first built screen against its board before the rest start.
node scripts/gate.mjs baseline --dir <app> (add --cmd "<e2e command>" for slow suites that must also stay green). Write the pre-existing failures into the handoff.node <stc>/capture.mjs): screenshots and page text are the "no control lost" reference.For each screen, in contract order:
data-does line and callout note. Run them; they must fail for the right reason.data-screen and data-feature on the elements.node scripts/gate.mjs check. A failure: read the full error, fix the root cause in shared code once, rerun. The same error three times: stop, write it to the handoff with what was tried, ask the owner.git diff --cached first (a shared index can hold another session's files), git commit -- <paths>, message names the screen and feature IDs. CHANGELOG entry when the repo keeps one.done with the commit SHA and the tests by name, or to its honest status.The app keeps one harness (for example scripts/test-canvas-states.mjs) that reads canvas-states.json and prints one line per board state: PASS, FAIL <reason> or DRAWN. Write it in the first screen's loop when the app has none, with the repo's own browser test runner. A state missing from the harness is FAIL. Each manifest board has a hash; a changed hash puts its states back to FAIL until rerun. Per state:
data-screen; every board data-feature exists in the DOM. Panel text equals the board's (same strings, same order), values from the state's Data file.data-does control is clicked once and does what its line says.DRAWN, which fails.The sample project the boards use stays in the app's project list, so the owner can compare app and board side by side.
node scripts/gate.mjs check: no new failures. Quote its last line./review, or an agent with the diff, the architecture map and the contract tables, not your verdict) checks architecture fit, duplication of existing helpers, dead code, silenced errors, and missing states. Fix the real findings, rerun steps 1 and 2.lessons.md already holds. Add the rest, one line each, with evidence: node <stc>/memory.mjs add --lesson "..." --evidence "<commit or file>" --project <slug>.node <stc>/memory.mjs note --project <slug> --text "..." (gate commands, harness path, closest screens, claimed files, open owner decisions).lessons.md.gate.mjs: fix it in the canvas-to-app plugin source, bump .claude-plugin/plugin.json, add a CHANGELOG line.Every screen in scope is done or has a stated status and reason; every manifest state reports PASS; gate.mjs check shows no new failures; the review findings are fixed or answered; the handoff and status match the commits; nothing you started is still running; Phase 7 ran. "Looks like the canvas" is not done. Never round "partly" up: done, done, part blocked, done, part open, open, blocked.
One link per change: the running app at the exact route (dev server left running only when the owner wants it), the PR, or the deployed URL; plus the canvas url beside it. Then the gate line, the harness counts, the screens by status, what went into memory, and one or two lines on what was skipped or unchecked and any risk.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub yravg/yra-skills-public --plugin canvas-to-app