Logo: Ui Diff

Ui Diff

Communautéit
imuratalpay
ui-diff

Before/after screenshots, highlighted pixel diffs and a short UX summary for pull requests that change UI, posted as one sticky PR comment whose images stay private in the same repository. Use when someone wants reviewers to see a frontend change ("add before/after screenshots to the PR", "what does this PR look like", "visual diff", "UI review", "did this CSS change break anything"), wants to check a hover, focus or open state ("check the mobile menu open state", "diff the checkout flow") or one component on its own ("diff the primary button"), or wants to compare design variants (?hero=1..4), record hover/transition clips, audit design-token usage, check accessibility regressions on changed screens, or capture auth-protected preview deployments.

Iwwersiicht

Editeurimuratalpay
Repositoryui-diff
Skill-Nummui-diff
Stären
155
Forks
10
Matgeliwwert Dateien
134
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 134 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    imuratalpay huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Ui Diff an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/imuratalpay/ui-diff/tree/main/skills/ui-diff
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/imuratalpay/ui-diff.git /tmp/ui-diff
mkdir -p .claude/skills
cp -r /tmp/ui-diff/skills/ui-diff .claude/skills/ui-diff
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Ui Diff an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Ui Diff automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Ui Diff net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

ui-diff

Renders the affected routes of a web app at the PR's base and head, diffs the screenshots, and posts one PR comment that starts with the verdict, then the measured element changes, still base | head pairs of each changed area and your UX summary. The mechanics are scripted; your job is the judgment: which routes matter, what the changes mean for users, and whether it is OK to post.

$SKILL is the directory containing this file. Run the CLI as:

bash
node "$SKILL/bin/ui-diff.mjs" <command> [options]

The first run installs dependencies and builds (about a minute); the first capture downloads Playwright's Chromium. Every command prints JSON on stdout and progress on stderr. Output goes to .ui-diff/ at the repo root, which is added to .git/info/exclude automatically.

Privacy rules (always)

  • Screenshots never go to public or third-party hosts (no imgur, gists, Slack, CDNs, pastebins). The only upload target is the repository's own ui-diff-assets branch.
  • publish refuses public repositories unless the user explicitly passes --allow-public-repo. If it says the repo is public or its visibility is unknown, stop and ask the user.
  • Never create Vercel share links, bypass URLs or URLs with tokens. Protected previews are reached with headers/cookies whose values come from environment variables (see references/privacy.md).
  • Never print secret values or paste them into comments or summaries.

1. Context

bash
gh pr view <n> --json number,url,baseRefName,headRefName,headRefOid   # or: gh pr view (current branch)
git status --short
  • Look for ui-diff.config.json (repo root or the app's directory). If there is none, run node "$SKILL/bin/ui-diff.mjs" init, check the suggested startCommand and routes, and offer to commit the file. doctor checks git, gh, the browser, the config and repo visibility: FAIL blocks a run; WARN (no gh login, no remote) only matters for publishing or --pr.
  • Posting to a PR: pass --pr <n> so head is the pushed commit. Mention uncommitted or unpushed work, because it will not appear.
  • Checking work in progress: node "$SKILL/bin/ui-diff.mjs" check diffs the working tree (uncommitted changes included) against the merge base with the default branch (--base <ref> to change it), prints a short summary with the measured changes, writes .ui-diff/out/ and posts nothing; exit 0 no visual changes, 1 changes, 2 errors (--json for JSON). run without --head does the same into .ui-diff/ for a later publish.
  • Deployed previews: pass --base-url / --head-url (or preview in the config). For protected previews configure auth once; see references/privacy.md.

2. Detect changed UI and choose routes

bash
node "$SKILL/bin/ui-diff.mjs" detect --pr <n>

Its JSON starts with status: capture (routes to capture), nothing-mapped (UI files that match no route) or no-ui-changes. It maps changed files to routes through routes[].files and globalFiles in the config, then framework conventions (Next.js, SvelteKit, Nuxt, Astro, Remix, TanStack Router, plain HTML) and an import graph (relative imports, tsconfig aliases, package.json # imports, workspace packages, CSS @import/url(), HTML href/src). The JSON lists each route with reasons and confidence, plus:

  • unmatched: UI files it could not place. Find their pages yourself (grep for imports) and pass them with --routes.
  • If the user only cares about part of a page, or a part is noise (ads, live feeds), set focus or ignore selectors in the config; a selector that matches nothing is reported as a warning.
  • needsExample: dynamic routes (/blog/[slug]). Find a real id and pass --routes /blog/hello.
  • notes: e.g. routes beyond detect.maxRoutes.
  • dependencies: changed packages from package.json and lockfiles. A ui: true one (React, Tailwind, a component library; detect.uiPackages) makes every route affected; mention the others as not checked visually.

If no UI file changed, say so and stop; do not produce an empty report. If UI files changed but none maps to a route (run prints "status": "nothing-mapped" and a notChecked reason), nothing was checked: resolve the routes yourself or tell the user; never report that as "no visual changes". Tell the user in one or two lines which routes you will capture and why. Remember routes that are affected but not captured (login walls, modals, limits): they go in the summary so "no change" is not read as an all-clear.

3. Capture and diff

bash
node "$SKILL/bin/ui-diff.mjs" run --pr <n> [--routes "/,/pricing"] [--viewports desktop,mobile] [--themes light,dark] \
  [--variants hero=1..4] [--motion | --motion-all] [--tokens path/to/tokens.json | auto] [--a11y]

In one go it creates git worktrees for base (the merge base) and head, links or installs dependencies, starts each app on a free port in its own process group, captures every route × viewport × theme, diffs with pixelmatch, writes per changed area a still base | head pair with the changed boxes outlined, a blink GIF and a before | after | diff crop (plus the full page), runs the enabled extras, and cleans up. Captures are deterministic (freeze, on by default): Date frozen at run start, Math.random and crypto seeded, animations, transitions and the caret stopped, web fonts and images awaited; plus hidden scrollbars, scroll reset and masked selectors (capture.mask, for carousels and live counters), and each screenshot is retaken until consecutive shots match (if something keeps moving, the page's JavaScript timers are paused for the final shots).

The JSON result has stats, changed (with image paths), flows, components, variants, motion, a11y, tokens, timing (one measured line: detect, prepare per side, capture, diff, extras; timings in report.json has the numbers), warnings, notCaptured and unmatchedFiles. Add --themes light,dark when colors or tokens changed. If it fails, the error names the step and the log in .ui-diff/logs/ (common causes and fixes: references/troubleshooting.md); fix the cause (missing env var, wrong startCommand, auth) and rerun. Never post a one-sided result. A capture whose page returns HTTP 4xx/5xx is reported as failed, not as "unchanged". A failed run keeps the previous report in .ui-diff/ (render and publish warn that it is from an earlier run): do not publish until a rerun succeeds.

Flows: changes that need someone to use the page

Still captures show pages as they load. When the change sits behind an interaction (a menu, a dialog, a filled form, a tab), add a flow to flows in ui-diff.config.json: it is replayed on base and head with the same frozen inputs, and at each checkpoint the first viewport is captured, mapped and diffed like a still capture. To write one from a sentence such as "check the mobile menu open state":

  1. Route and viewport: the page the sentence names (/ when none), plus viewports when it names one ("mobile" → ["mobile"], a name from the config's viewports).
  2. Steps: read the component to find the trigger and what appears. Prefer stable selectors: data-testid, id, aria-label (button[aria-label='Open menu']), then a class; never a generated class. Steps are click, hover, focus, type (+ text), press (a key), select (+ value), scroll (px or selector) and wait (ms or selector).
  3. Checkpoint: put "checkpoint": "<state>" on the step that reaches the state the user means; when that state appears asynchronously, end with a wait for it carrying the checkpoint. Without one, the end of the flow is captured as end.
json
{ "flows": [{ "name": "mobile menu", "route": "/", "viewports": ["mobile"],
  "steps": [{ "click": "button[aria-label='Open menu']" }, { "wait": "nav#menu", "checkpoint": "open" }] }] }

Keep flows short (at most flowLimits.maxSteps, 15 steps; flowLimits.maxFlows, 5 flows, run). A flow runs only when its route is captured; pass --routes to force it. Offer to commit the flow. Changes at a checkpoint are listed under "/ · flow 'mobile menu' · open" (what the still capture already lists is not repeated), with images compare/<capture>__flow-<name>-<checkpoint>.png (and its __pair-* crops) and flows in report.json. "flow 'checkout' stops at step 3 on head: button 'Pay' not found" means users can no longer get through it: lead "worth a look" with it. A flow that stops at the same step on both sides is a warning about the flow, not the PR: fix its selector and rerun.

Components: one part of a page on its own

When the user cares about one component ("check the primary button", "diff the pricing card"), add it to components in ui-diff.config.json: it gets a tight crop on both sides, only the measured changes inside it, and its own row in the comment. To write one:

  1. Route: the page the component is on (find where it renders; / when it is on the home page). When it only shows after an interaction (a menu, a dialog), point at a flow and its checkpoint instead: "flow": "mobile menu", "checkpoint": "open" (write the flow first).
  2. Selector: one that matches exactly one element, the component's root: data-testid, id or aria-label first ([data-testid=hero-cta], section[aria-label='Pro plan']), else a class unique on the page; never a generated class. If the name is ambiguous ("the button"), pick the one the PR touches and say which.
  3. States: add "hover" and "focus" when the sentence or the change is about interaction (a button, a link, a field); otherwise leave the default.
json
{ "components": [{ "name": "primary button", "route": "/", "selector": "[data-testid=hero-cta]", "states": ["default", "hover", "focus"] },
                 { "name": "pricing card", "route": "/pricing", "selector": ".plan-card--pro" }] }

At most componentLimits.maxComponents (10) run. Offer to commit the entry. The comment groups changes under "component 'primary button'" with how its box changed ("size 320×48 → 320×52px"), with images compare/<capture>__component-<name>*.png, and components in report.json. "component 'primary button' removed on head: nothing matches …" means the selector found it on base only: check whether the component was removed or only renamed, and say which. A component missing on both sides is a warning about the selector: fix it and rerun.

4. Review and write the UX summary

Start from the measured changes: captures[].styleDiff.changes in report.json names each changed element with exact before → after values (padding, color, radius, text, added, removed, reordered), and styleDiff.regions says which element each changed area belongs to; quote those values instead of estimating from pixels. A change with verified: false did not pass the check (weak match, or no changed pixels under it): its unverified reasons say why; do not state it as fact without the images. Open the images before writing (the still pairs compare/*__pair-*.png first, then the compare/*__focus-*.png diff crops, the full composites, variants/*__strip.png and motion/*.gif). Read .ui-diff/report.json for the measured data, and start from .ui-diff/summary.auto.md. The comment's first line is the verdict and the measured changes follow it, so the summary need not repeat them: say what they mean for users. Write .ui-diff/summary.md for a designer or PM who will not read the code:

A change with a state (hover or focus) happened only while the element was hovered or had keyboard focus; its crops are under states/ and its pair in compare/*__state-hover-*.png or compare/*__state-focus-*.png. A removed focus ring is an accessibility problem: name it in "worth a look".

markdown
**What changed**
- **Primary button**: padding 8×14 → 10×18px, corner radius 4 → 8px. The link beside it shifts right, and the page below moves down 4px.
- **Newsletter label**: "Work email" is now brand blue.

**Worth a look**
- The label is 3.45:1 in dark mode (`#2563eb` on `#0f172a`).
- Button padding `10px` / `18px` and the 17px action gap are not spacing tokens.

**Not checked:** `/settings` (needs login).

A capture whose base and head environments differed (fonts, device pixel ratio, browser; see fingerprint.differences in report.json) gets a warning in the comment, and notComparable in the report makes the verdict say the captures were not comparable: name it in "worth a look" and do not describe that diff as a product change without checking the images.

Guidelines: lead "worth a look" with likely-unintended changes (a page changed without its files changing, breakage at one viewport, new a11y issues, off-token values). Content that only moved (a taller hero pushing sections down) is matched row by row and reported as "shifted down Npx" (diff.shifted in report.json); it is not in the changed percentage, so mention the shift without calling the moved sections changed. A "page did not settle" warning names an element that kept moving by itself (carousel, ticker); when a capture says every difference is inside such an area, do not describe it as a change: suggest the capture.mask the warning gives. Say "changed", not "intentionally changed". Keep it proportional: a one-color tweak gets one bullet. If you cannot view images, write from report.json and say the screenshots were not reviewed.

Preview the final comment locally:

bash
node "$SKILL/bin/ui-diff.mjs" render     # writes .ui-diff/comment.preview.md

5. Publish one sticky comment

Posting writes to a shared PR and pushes a branch: show the user the summary and get a yes first, unless the request already said to post.

bash
node "$SKILL/bin/ui-diff.mjs" publish --pr <n> --dry-run   # lists uploads, writes .ui-diff/comment.md, pushes and posts nothing
node "$SKILL/bin/ui-diff.mjs" publish --pr <n>
  • Read the dry run's publishable and problems: if it says the repository is public, its visibility is unknown or there is no GitHub remote, the real publish will stop there. Tell the user; do not add --allow-public-repo or --assume-private on your own.
  • Images go to the orphan branch ui-diff-assets of the same repository (single commit, other PRs' files kept) and are linked as https://github.com/<owner>/<repo>/raw/ui-diff-assets/…, which renders only for people who can read the repo.
  • The comment is found by a hidden marker (<!-- ui-diff:sticky id=default -->) and edited in place; reruns never stack comments, unchanged bodies are not re-sent, and ticked variant picks survive.
  • Exit code 3 means git could not read or push the repository (no push access, e.g. a fork, or missing git credentials; the error says which): use --no-upload for a text-only comment, or --no-comment to upload and print the markdown without posting.
  • When the report has no changed UI file, publish uploads nothing and creates no comment; an existing sticky comment gets "no UI files changed in " as its top line, with the last result that had UI changes kept below it, collapsed.
  • No PR yet: use render (or publish --dry-run) to produce the comment and offer to post once the PR exists.

6. Wrap up

Report the comment link, the counts, the "worth a look" items and anything not captured. If you worked out routes, masks or dynamic ids yourself, offer to save them in ui-diff.config.json. After a PR closes, node "$SKILL/bin/ui-diff.mjs" prune --closed removes its images.

Extras

FeatureEnableWhat you get
Variant compare--variants hero=1..4 or routes[].variantsHead captured once per ?hero= value, shown side by side in one table with tick boxes reviewers use to pick.
Motion clips--motion or motion.enabled + routes[].motion.stepsShort before/after GIF (and optional WebM) of a scripted hover/click/scroll, for transitions screenshots miss. Only routes whose changed files touch motion (transitions, keyframes, :hover, the elements the steps target; transition-only changes included) unless --motion-all; a single-frame clip is flagged "no motion detected".
Token audit--tokens tokens.json or tokens.enabledComputed colors, spacing, radii and type in changed areas that match no token (JSON, CSS variables or StyleX *.stylex.ts; --tokens auto finds them), with selectors and the nearest token.
Protected previews--base-url/--head-url + authCaptures behind Vercel Authentication and similar, with credentials from env vars sent only to the preview origin.
Accessibility delta--a11y or a11y.enabledaxe-core on both sides; only new and fixed issues (contrast, labels, focus), plus tab-order changes.

Details and examples: references/extras.md. All config options: references/config.md. Hosting trade-offs and protected previews: references/privacy.md. Failures and flaky captures: references/troubleshooting.md.

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

An nach 74 weider Dateien.

Heefeg gestallte Froen

Wat mécht de KI-Skill Ui Diff?

Before/after screenshots, highlighted pixel diffs and a short UX summary for pull requests that change UI, posted as one sticky PR comment whose images stay private in the same repository. Use when someone wants reviewers to see a frontend change ("add before/after screenshots to the PR", "what does this PR look like", "visual diff", "UI review", "did this CSS change break anything"), wants to check a hover, focus or open state ("check the mobile menu open state", "diff the checkout flow") or one component on its own ("diff the primary button"), or wants to compare design variants (?hero=1....

Firwat Ui Diff op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Ui Diff besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Ui Diff an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/imuratalpay/ui-diff/tree/main/skills/ui-diff an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Ui Diff benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Ui Diff benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Ui Diff domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Ui Diff gratis?

Jo. imuratalpay huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇