UI Proposal — sign off on a live preview before you build it
The UI sign-off loop (epic #307) requires human approval before you build/finalise a
visual surface. The default path deploys a rough real build to a staging preview with
the review overlay on, so the reviewer clicks the running page rather than reading a static
PNG. A --static fallback (offline HTML/CSS mockup + PNG) is available when a live deploy
isn't practical.
Either way the outcome is identical: a draft PR is posted, the reviewer gives feedback,
you iterate, and an ok comment unblocks the build.
When to use
- A task's diff adds or changes a visual surface: a
.vuecomponent, a layout, a page,
a theme (crouton-themes, a ui: block in app.config.ts), or app CSS/theme tokens.
- The user asks to "mock up", "propose", "show what it'd look like", or wants design sign-off.
- Skip for pure
<script>/composables/types,server/**, config, tests, and docs — no
visible result, no gate.
Reference design (if the epic has one)
If writeups/design/<epic>/ exists (see scripts/design-handoff.mjs), read its PNGs before building — they are the spec. When you post the preview URL, embed the matching reference PNG right beside it so the reviewer compares reference and live side by side.
Which path to choose
| | Default (live preview) | Fallback (--static) |
|---|---|---|
| When | App can be deployed to staging | Deploy is unavailable, broken, or would take too long |
| Fidelity | Real Nuxt UI styling, real data, real responsive behaviour | Offline HTML/CSS approximation |
| Reviewer UX | Click the running page, pin a comment | Read a PNG, comment inline on the .md diff |
| Approval signal | Reply ok (or not ok: …) — same loop | Reply ok (or not ok: …) — same loop |
Default path — live preview with review overlay
The loop (capture tooling provided by @fyit/crouton-devtools):
- Build a rough real version of the surface. You don't need a polished feature — a
scaffold that renders the changed component is enough. Commit and push the branch.
- Deploy to staging with the review flag using the
/poc-deployskill (for POC
apps) or pnpm cf:staging (for apps/). The flag must be on:
```bash
NUXT_PUBLIC_CROUTON_REVIEW=true pnpm cf:staging
```
Do not set this flag on production deploys (cf:deploy) — it is staging-only.
- Post the preview URL on the draft PR. Example comment:
```
🔍 Live preview ready: https://<name>.pmcp.dev
Reviewer: open the link, click any element, and type your change in the overlay.
Each pin posts a 🎯 Preview feedback comment here naming the source file.
Reply ok when satisfied, or not ok: what's wrong.
```
- Apply
status:blocked, @mention@pmcp, and stop. Do not build further until
approved.
- On each
🎯 Preview feedbackcomment: read the named source file, make the change,
commit, redeploy. Reply to the comment when done.
- On
okreply: removestatus:blocked, drop a short note on the PR,
and resume building/generating (step 6 of task-worker).
Env contract (already wired by WS2 of epic #590)
The staging deploy script in pocs/<name>/package.json carries the flag; the Worker secret
(NUXT_CROUTON_REVIEW_GITHUB_TOKEN) + vars (NUXT_CROUTON_REVIEW_REPOSITORY,
NUXT_CROUTON_REVIEW_PR) are set by scripts/inject-review-env.mjs during cf:staging.
You don't need to set these by hand — use the /poc-deploy skill or the app's cf:staging
script and they're handled automatically.
Fallback path — static mockup (`--static`)
Use when a live deploy is not available (e.g. a packages change that isn't a component, or
the deploy pipeline is broken and speed matters more than fidelity). A changed shared
component (packages/*/app/components/**.vue) is NOT this case: its PR gets a live gallery
link per changed piece automatically (pocs/gallery, #2462) — no mockup, no preview page. Pass --static when
invoking this skill, or when the task-worker agent determines staging isn't reachable.
What it produces
| Artifact | Path | Committed? |
|----------|------|-----------|
| Mockup source | writeups/ui-proposals/<slug>.html | yes (editable source of truth) |
| "What changes" list | writeups/ui-proposals/<slug>.md | yes (inline-commentable diff surface) |
| Rendered image | screenshots/<slug>.png | no — published to a non-branch ref and embedded by commit-ID URL (#3351) |
<slug> = kebab of the surface, e.g. mobile-collection-viewer.
Why the PNG is not committed (#3351). A comment can only show an image inline if it has a
fetchable URL (#569/#613). Committing PNGs bloated the repo, so they now go to a non-branch ref
(
refs/review-captures/issue<N>) vianode scripts/publish-review-captures.mjs --dir screenshots --key issue<N>,
which prints a commit-pinned
https://raw.githubusercontent.com/<repo>/<sha>/<slug>.pngURL and
curl-verifies it. That URL renders on web and mobile. Only the
.html+.mdare committed.
Step 1 — Understand the surface
Read the component(s) you're about to change. The mockup must reflect the actual current
UI for "before" and your intended design for "after". Use real labels/data where you
have them.
Step 2 — Build the mockup from the template
Copy template.html (next to this skill) to writeups/ui-proposals/<slug>.html and fill
the slots:
- Frame: phone frame for mobile surfaces, desktop frame for wide ones (both in the template).
- Before: mirror today's UI honestly (including rough edges the change fixes).
- After: your proposed design.
- "What changes" list: 3–5 plain-language bullets.
Rules (keep it portable):
- No JavaScript, no external/CDN assets. Inline SVG icons only (template ships a set).
Non-negotiable — the artifact must render offline.
- Match the app's look: dark Nuxt-UI palette, emerald primary, template variables.
- One file, self-contained.
example.html (next to this skill) is a complete worked reference.
Step 3 — Render to PNG
node .claude/skills/ui-proposal/render.mjs writeups/ui-proposals/<slug>.html screenshots/<slug>.png
# optional: --width 1100 (default 1000) --selector ".stage" (crop to element)
Uses the repo's Playwright (@playwright/test) headless Chromium — no network, 2× for crisp
image. Render into screenshots/ — the PNG is never committed (#3351); step 4 publishes it to a
non-branch ref and embeds it inline.
Step 4 — Hand off (review happens on the DIFF)
Commit a text artifact so feedback can be inline. Alongside the .html, write the
writeups/ui-proposals/<slug>.md — the "what changes" list, one item per line. Committed,
it lands in "Files changed" so the reviewer can inline-comment a specific change.
HARD RULE — the PNG MUST render inside the comment. The reviewer sees the design by
looking at the comment, not by opening a file. A path reference (
writeups/…/<slug>.png) or
a link to the
.htmlis a failed hand-off — it "opens as code" on mobile (#569/#613) and
makes the reviewer go hunting. Always embed a Markdown image by its raw URL, and only
after you've confirmed that URL serves the image.
- Commit the
.html+.md(via/commit, scopedocs). Do not commit the PNG. - Publish the PNG (renders to
screenshots/<slug>.png):
```bash
node scripts/publish-review-captures.mjs --dir screenshots --key issue<N> # prints sha= and url=; exits 1 if the URL doesn't serve image/png
```
- Use the printed
url=(commit-ID pinned) in the comment below — a failing exit means no inline image. - Post the sticky comment with the PNG embedded inline — on the PR if one exists,
otherwise on the tracking issue (interactive / no-PR runs). Same body either way:
```markdown
<!-- ui-proposal:<slug> -->
### 🎨 UI proposal — <slug>
Review the "what changes" list (writeups/ui-proposals/<slug>.md) and comment any change.
Reply ok when satisfied, or not ok: what's wrong.
```
Use the actual head branch in the URL (e.g. receiptDesign, claude/issue-<NN>-<slug>);
the image re-renders whenever the committed file changes, so editing in place (step 5) works.
> Confirm it rendered, not just that the URL is 200 (step 3). Read the posted body back:
> if the image shows as code not an image (the #569/#613 symptom), the GitHub-MCP writer
> mangled the Markdown URL (backtick-wrapped it / dropped the src) — a break curl-ing the
> URL can't detect. Re-post with an HTML <img src="<raw-url>" alt="…" width="380"> tag (a URL
> in an attribute can't be auto-wrapped) and re-read to confirm. (#1615)
- Steer feedback to the
.md— inline comments in the diff (PR) or on the committed file. - Apply
status:blocked, @mention@pmcp, and stop.
Step 5 — Revision loop (both paths share this)
On each change request: revise the proposal (mockup files for --static, source file for
live-preview), re-render / redeploy, edit the sticky comment in place (never post a new
one), and reply to/resolve each inline thread you addressed. Commit and push.
On ok reply: remove status:blocked, note "approved → building" on the
sticky comment, and resume.
Conventions
- Before and after side-by-side for a change; after-only for net-new UI (no "before" exists).
- Keep the proposal focused on the surface under discussion — don't redraw the whole app.
- Re-render / redeploy after every revision so the proposal never drifts.
- One sticky comment per proposal. Never post a new comment per revision — edit in place.