ui-compare
Capture pages and Storybook stories before and after a UI change, and compare them in one HTML report.
ui-compare is built for changes made by coding agents: the agent captures Before, edits the code, captures After, and hands you a one-page report that names what changed in your words and shows each changed spot in Before and After side by side. It runs on your machine against the dev server or Storybook you already have running. Nothing is committed, and there is no baseline to maintain.
Install
pnpm add -D ui-compare
pnpm exec playwright install chromium
Or run it without installing: npx ui-compare ....
To let a coding agent drive it, install the bundled agent skill:
gh skill install k35o/ui-compare
In Claude Code, install the plugin instead. It carries the same skill and adds the pane:
/plugin install ui-compare --marketplace k35o/ui-compare
In the Claude Code Desktop app, click + next to the prompt box, then Plugins, Add marketplace with k35o/ui-compare, then Add plugin.
Usage
# 1. Before editing: capture the named targets and note the run id
ui-compare before "Home=http://localhost:5173/" "Settings page=http://localhost:5173/settings" --viewport 1280x720 --viewport 375x812
# Captured Before for run 3k9x2a: 2 screens, 4 shots
# ok Home 1280x720, 375x812
# ok Settings page 1280x720, 375x812
# Next: make the change, then run: ui-compare after 3k9x2a
# 2. Change the code
# 3. Capture again and compare (repeat after every round of edits)
ui-compare after 3k9x2a
# Compared run 3k9x2a: 1 screen changed, 0 errors
# changed Home
# 1280x720, 375x812: 1 area at x=555 y=243 170x42 (in 1280x720) .ui-compare/3k9x2a/diff/001-localhost-5173-1280x720-light.png
# unchanged Settings page 1280x720, 375x812
# Report: .ui-compare/3k9x2a/report.html
# Summary: .ui-compare/3k9x2a/summary.json
after always compares with the Before of its run, so the report covers the whole change, however many times you run it.
The output is grouped by screen: a page, or a Storybook component with all its stories, listed under its name. Each line under a changed screen is one change: where it was seen, its areas (three at most, then a count of the rest) and a diff image. A change with five or more areas, or areas that cover more than half of the page, reads changed across the page instead. A change seen at several viewports, color schemes or stories is listed once with all of them; its areas and diff image are those of the one named in parentheses, such as (in 1280x720) or (in Primary · 1280x720), because the same change can sit at other coordinates at another viewport. When the page grew or shrank, the line also gives both page sizes, such as page size 1280x720 -> 1280x1600. Errors come first; noise, unchanged and skipped screens get one line each at the end. The color scheme is named only when it is dark.
Targets
| Target | Example |
|---|
| URL | http://localhost:5173/settings |
| Static HTML file | ./dist/index.html, file:///path/to/page.html |
| Storybook story | --storybook http://localhost:6006 --story "src/components/Button.stories.tsx" |
Names
People read the report, so give every target a name with name=target, in the words you would use for it:
ui-compare before "Pricing page=http://localhost:5173/pricing" "Settings page=./dist/settings.html" \
--storybook http://localhost:6006 --story "Button=src/components/Button.stories.tsx"
- The name is the part before the first
=, trimmed. When that part is empty or contains ://, or nothing follows the =, the whole argument is the target, so http://localhost:5173/search?q=a stays an unnamed URL.
- A named
--story pattern must match the stories of one component (one Storybook title), and the name stands for that component. A named pattern that matches several components is a usage error; give each component its own pattern, or drop the name.
- The name is kept with the target in
run.json and shown in the CLI output, the report and the pane. summary.json and review.json (screen.target) keep the full URL or component title.