← 返回列表
全部 Skill›开发 Development›ui-canvas

ui-canvas

作者 @affaan-m · 语言 en
Preview a UI component mockup in a local browser canvas where the human directly edits it (move, resize, edit text, delete, restyle), switches mobile/desktop/custom viewports, tests it, chats with you, and clicks Save and Finish. You then turn the exported edited markup into the production component. Use before committing or rebuilding a feature just to check a visual change.
开发 Development前端开发需海外环境执行命令访问网络待翻译
存储库
最近源活动
2026-11-20 09:13
检测 SKILL.md 语言
en
星标 ★
307,331
分支 Fork
45,351
安装选项
提示
指令
使用 AI 助手安装
将下面的提示复制到你正在使用的 AI 助手中。
下载完整 Skill 目录(含全部配套文件)。 下载压缩包 ↓
SKILL.md 原文预览

UI Canvas

Approve-before-you-build loop for user interface work: you write a quick,

self-contained HTML mockup of the component, the human opens it in the

browser and adjusts it by hand like a website builder, and **Save and

Finish** hands you the exact result to wire into the real code. Nobody has to

rebuild and rerun the whole app to check a padding change.

Any component qualifies: a card, a sidebar, a modal, a settings pane, a

single button state, an animation, a page section. Any harness qualifies:

the loop is a CLI that prints JSON.

Shares its server, state, and hooks with plan-canvas (inspired by

lavish-axi by @kunchenguid).

Editing conventions follow

VisBug and

Onlook: Enter/Shift+Enter walk the

tree, Delete removes, an edit/interact mode switch.

When to Use

  • The user asks to redesign, restyle, or add a UI component and wants to see

it before you commit, rerun, or rebuild.

  • Feedback is visual ("make it tighter", "move that up", "lose the border")

and is faster done by hand than typed.

  • Mobile and desktop both matter and the user wants to check the component

at exact dimensions.

  • The user asks for /ui-canvas, a preview, a mockup, "show me first".

Do NOT use for: plan or document review (/plan-canvas), running the real

app, remote URLs, or components you cannot render as plain HTML/CSS/JS in one

file. The canvas serves local files only.

How It Works

Invoke the CLI as ecc-ui-canvas (bin from the ecc-universal package, on

PATH after a global or plugin install; node "$CLAUDE_PLUGIN_ROOT/scripts/ui-canvas.js"

also works). It runs the same detached loopback server as plan-canvas

(127.0.0.1:4517), keyed by artifact path; there are no session ids.

1. Write the mockup

Write one self-contained .html file (for example .claude/previews/<name>.html

or next to the component): markup, a <style> block, and any <script> the

component needs to behave (tabs, toggles, open/close, animation). Rules:

  • Use the project's real brand tokens, fonts, copy, and realistic data. Read

the existing CSS or theme file first; do not invent a palette.

  • Give meaningful elements an id or a distinctive class. The canvas records

every human edit against a CSS selector; stable names make the export map

cleanly back to your code.

  • Keep it faithful to production: same breakpoints, same max-width, same

states. The canvas renders at true CSS-pixel viewport sizes, so media

queries behave exactly as they would in the app.

  • Sibling assets (images, fonts) may sit next to the file and be referenced by

relative path; a data: URI or an inline SVG also works.

  • Inline only what the component needs. A mockup is a sketch, not the app.

2. Open and listen

ecc-ui-canvas open .claude/previews/pricing-card.html --viewport desktop --title "Pricing card"
ecc-ui-canvas await .claude/previews/pricing-card.html   # run in the background; leave it running

--viewport takes mobile (393×852), desktop (fills the window), custom,

or exact WxH such as 1024x768. Run await in the background if your

harness time-limits foreground commands; re-run it if interrupted, queued

feedback is never lost. While it runs, the canvas shows "<your harness>

listening" so the human knows you are connected.

3. Handle what comes back

await prints JSON when the human acts. Items:

{ "kind": "chat", "text": "change this to dark gray in the brand colors",
  "anchor": { "selector": "#pricing-card", "tag": "article", "snippet": "Most popular Team plan…", "size": { "width": 720, "height": 388 } },
  "pendingEdits": ["resized img.art to 220px wide, 220px tall (was 260×260)", "removed button.btn.secondary"] }
  • chat is a request. anchor is the element the human had selected when

they sent it; pendingEdits summarizes hand edits they have made that are

not yet in your file. Make the requested change in the mockup file.

The preview reloads within a second and re-applies their pending edits on

top, so do not bake pendingEdits into the file yourself: they are

context, and doubling them up would misplace things. Answer in the canvas

and keep listening with one command:

```bash

ecc-ui-canvas await <file> --reply "Background is now var(--gray-800) from the brand tokens."

```

Speed matters here. Run ecc-ui-canvas typing <file> --state thinking

the moment you start, edit the file, then reply. Under two seconds from

request to repaint is the target for a one-property change.

{ "id": "fb-123", "kind": "edits", "editCount": 3, "edits": [ { "kind": "resize", "selector": "img.art", "width": 220, "height": 220, "before": { "width": 260, "height": 260 } } ],
  "viewport": { "preset": "mobile", "width": 393, "height": 852 },
  "exportPath": "/abs/.claude/previews/pricing-card.apply-mf3k2x-9a1c.edited.html", "editsPath": "/abs/.claude/previews/pricing-card.apply-mf3k2x-9a1c.edits.json" }
  • edits means the human clicked Apply to file: they want their hand

edits written into the mockup now. Replace the mockup file with the

contents of exportPath (it is the full DOM they are looking at, with

their inline-style changes), tidy it into real CSS if it is messy, keep it

self-contained, and reply. Each Apply writes its own

<name>.apply-<batch>.* pair, so a queued earlier batch keeps its own

snapshot. The canvas keep

评论
Aaffaan-m
affaan-m
affaan-m/ECC
查看 GitHub 仓库 查看作者的其他 Skill
来源信息
作者@affaan-m
所属大类开发 Development / 前端开发
国内可用性需海外环境
最近源活动2026-11-20 09:13
风险提示执行命令、访问网络
提示:风险标签为程序静态扫描结果,仅作提示,不代表安全认证。安装前请阅读 SKILL.md 及其引用的脚本、权限,自行判断是否可信。