Skip to content

dbalas/preview-lab

v0.5.0MIT

Fast UI/UX screen review for coding agents: capture, review in a branded lab, feedback straight back to the session.

A review round: screens grouped by flow, each with its tips

Your agent captures the screens it changed and opens them in a review page styled like your project. You approve them or mark what to change, right on the screenshot. Press Send, and the agent gets short, structured feedback it can act on. Approved screens leave; the rest come back next round, with every change tagged.

Quick start

npx skills add dbalas/preview-lab

Then ask your agent:

let me review the new checkout screens

That's it. The agent captures the screens, opens the lab in your browser, and waits for you to press Send.

Why Preview Lab

  • Fast to review. Screens are grouped by flow. ← → to move, A to approve, C for changes, drag on a screenshot to mark the exact area.
  • Feedback agents can act on. Statuses, areas in percent of the screenshot, comments and notes arrive as a few lines of markdown, not a wall of prose.
  • Rounds, not restarts. Approved screens leave. After a code change only the screens whose pixels changed are tagged Updated. Past rounds stay one click away, read-only.
  • Expert tips (beta). Ask for a complete review and the agent adds measured UX, UI, accessibility, responsive and consistency tips, pinned to the screenshot. You tick the ones to apply.
  • Not only screens. Markdown, text, HTML, PDF and video files open in the same lab, so copy, docs, emails and recordings get the same review loop.
  • Built-in screenshots. Viewports, dark mode, full pages, single components, and states reached by clicking or typing, using the Chrome, Edge or Chromium you already have.
  • Your brand, not ours. The lab takes your colors, font, logo and language.
  • Works everywhere. Local, remote or cloud sessions; light, dark or system theme; desktop or phone.
  • Leaves nothing behind. Zero dependencies. One lab per checkout, kept in ~/.preview-lab/, cleaned automatically.

Install

AgentCommand
Any of the 60+ supported agentsnpx skills add dbalas/preview-lab
Claude Code (plugin)/plugin marketplace add dbalas/preview-lab, then /plugin install preview-lab@preview-lab
Gemini CLI (extension)gemini extensions install https://github.com/dbalas/preview-lab
Anything elseCopy skills/preview-lab/ into the agent's skills folder

The repo also ships an Agent Plugins manifest (plugin.json) for tools that install plugins from a repository. For agents without skills support, add one line to AGENTS.md: "For UI reviews, follow <path>/preview-lab/SKILL.md."

Requirements: Node 18+ (22+ for full-page, component and state screenshots), and Chrome, Edge or Chromium for built-in screenshots.

Use

Talk to your agent in plain words, or call the skill directly (/preview-lab in most agents):

You sayWhat happens
let me review the onboarding screensVisual review: you give the feedback.
complete review of the checkoutThe agent adds tips for every screen.
only the settings modal, mobile and dark, in SpanishAnything you add overrides the defaults.

How a round works

 agent                          you
 ─────                          ───
 captures screens  ──────────▶  review in the lab
                                approve · changes · areas · notes
 reads the feedback ◀─────────  Send
 fixes the code
 next round        ──────────▶  only what changed comes back

The agent receives something like this:

# Preview Lab feedback: shop · round 2 (complete)
1 approved · 1 changes · 0 unreviewed
**General:** Next round, show me the error state of payment.
**Approved:** Settings

## Order confirmed [done] — changes
- Area 1 (mobile @ x 8.5%, y 48.7%, 85.3×22.5%): Show item thumbnails
- Apply rec r1 [a11y/high]: The order number is 13px … raise it to 16px.
- Declined recs: r2, r3

Remote and cloud sessions

The lab is served on 127.0.0.1:4747 of the machine the agent runs on. If your browser can't reach it, either forward that port, or let the agent run pl.mjs export: the round becomes one self-contained HTML file you open anywhere, and Copy feedback gives you the text to paste back into the chat.

Commands

Your agent runs these; you never have to. They live in skills/preview-lab/scripts/pl.mjs.

CommandWhat it does
init [--in-project]Create or find this checkout's lab.
brand [file]Read or set colors, font, logo, language and texts.
add <items.json>Check, capture and add items. If anything fails, nothing changes.
recapture [id…]Retake stored screenshots. Only changed screens are flagged.
remove <id…>Remove items and their screenshots.
serve [--detach]Serve the lab and print the feedback when it is sent.
feedback / stopPrint the last feedback, or stop the server.
export [file]Save the round as one self-contained HTML file.
round [--keep N]Archive the round, drop approved items, start the next one.
contrast <fg> <bg>WCAG contrast ratio of two colors.
upgrade / clean / resetUpdate the lab code, delete unused files, or start over.
prune [--all]Labs untouched for 7 days expire by themselves (emptied, branding kept; session labs deleted). This runs it now; --all clears every other lab right away.

The agent's instructions are in SKILL.md, the review guide in complete-mode.md, and the lab's design contract in lab-spec.md.

Troubleshooting

ProblemFix
No screenshots, NO_BROWSERInstall Chrome, Edge or Chromium, or set PREVIEW_LAB_CHROME to its path.
Full-page or component shots failThey need Node 22+. Older Node still takes viewport shots.
The lab page doesn't openOpen the PREVIEW_LAB_URL the agent printed. In a remote session, forward port 4747 or ask for an export.
Send says the agent is unreachableThe feedback was copied: paste it into the chat.
Labs in an odd placeSet PREVIEW_LAB_HOME, or ask for the lab inside the project.

Develop

No install step. Run the tests (they also open the lab in a real browser when one is installed):

npm test

License

MIT · Made with ♥ by dbalas