visual-diff
Skill1 starsChanged 6 days agoMITView on GitHub
Before/after visual regression for websites. Screenshots pages at desktop (1366 wide) and mobile (390x844) in a headless Chromium with animations frozen, then compares two sets pixel by pixel and writes an HTML report with before/after/diff images, % of pixels changed and boxes around the changed regions; exits 1 when a page changes more than a threshold. Use before and after a CSS refactor, dependency upgrade, redesign or deploy to catch unintended layout or style changes, or when asked "did my change break how anything looks?". Pairs with site-qa.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- jocarrd/crux-agentstheir own version, first seen Nov 8, 2026
- NicholasFlemmer/styx-apptheir own version, first seen Oct 9, 2026
- aditya-deokar/software-factorytheir own version, first seen Sep 29, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- NicholasFlemmer/styx-app★ 31same name
- jocarrd/crux-agents★ 4same name
- aditya-deokar/software-factory★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository25 other files it gives its agents.
- bash-checkpointSkill
- brave-cdpSkill
- cf-backupSkill
- cf-pages-deploySkill
- claude-md-doctorSkill
- claude-safety-auditSkill
- claude-sandboxSkill
- claude-token-auditSkill
- cws-extension-checkSkill
- env-doctorSkill
- event-recap-videoSkill
- freelance-proposalSkill
- gif-makerSkill
- itch-html5-packageSkill
- link-preview-checkSkill
- mcp-auditSkill
- package-guardSkill
- pwa-checkSkill
- read-guardSkill
- readme-upgradeSkill
- release-notesSkill
- secret-commit-guardSkill
- session-handoffSkill
- site-qaSkill
- thumbnail-makerSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 40
If something changes height, everything below it moves, so the whole lower page turns magenta and the screenshot height changes ("size …
- Distinctive: line 43
When a change is intended, make the current capture the new baseline (copy the folder over the baseline).
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
visual-diff
scripts/visual-diff.mjs is zero-dependency Node 22+. It starts its own headless Chrome / Edge / Brave / Chromium with a temporary profile (never the user's browser or logins) and closes it when done. Set BROWSER=/path/to/chrome if none is found. PNG decoding and diffing are done in plain Node, so there is nothing to install.
# 1. baseline before the change
node visual-diff.mjs capture https://example.com /pricing /about --out vd/before --full
# 2. after the change (same flags)
node visual-diff.mjs capture https://example.com /pricing /about --out vd/after --full
# 3. compare
node visual-diff.mjs compare vd/before vd/after --out vd/report # exit 1 if any page > 0.5 %
# or in one step: first run creates the baseline, later runs capture to vd/runs/<time>/ and compare
node visual-diff.mjs run http://localhost:5173 /pricing --baseline vd/baseline --fullCapture options:
--fullfull-page screenshot (page is scrolled first so lazy images load; capped at 16000 px tall). Without it, only the first screen.--hide ".clock, .ad-slot, canvas"hides dynamic regions (visibility:hidden, so layout does not move).--wait 1500extra ms after the page is quiet (default 500).--viewports desktopormobileto do only one.- Paths like
/aboutresolve against the first URL. In Git Bash,/aboutis rewritten by MSYS; the script undoes that (a one-letter path like/pcomes back as/p/), or writeaboutwithout the slash.
Compare options: --threshold 0.5 (% of pixels, per screenshot) and --tolerance 16 (per-channel 0-255 difference ignored, to skip antialiasing noise).
What it does to make two runs comparable: emulates prefers-reduced-motion: reduce, injects *{animation:none;transition:none;caret-color:transparent}, waits for network quiet, document.fonts.ready and every <img> to load and decode, pauses videos at 0, blurs the focused element, scrolls to the top.
Outputs
- capture dir:
<page>__desktop.png,<page>__mobile.png(mobile is 2x, so 780 px wide),manifest.json(url, viewport, size, HTTP status). Pages are matched between runs by name + viewport. - report dir:
index.html(summary table, then before / after / diff side by side, most-changed first),report.json,<page>__<viewport>__diff.png. - Terminal: one line per screenshot with % changed, region count, largest region and size change.
Reading the results
- Open
index.htmland LOOK at the diff column. Magenta = changed pixels on a faded copy of the new screenshot, orange boxes = changed regions. Box coordinates are screenshot pixels (mobile is 2x CSS pixels). - A small change that stays in place (a button color) gives a small % and one tight box. In testing, a button color change was 0.43 % desktop / 1.42 % mobile with a box exactly around the button.
- If something changes height, everything below it moves, so the whole lower page turns magenta and the screenshot height changes ("size 1366x1021 -> 1366x1101"). Look at the topmost box: that is where the shift starts.
ok (small change, under threshold)means some pixels changed but less than--threshold. Still glance at it.MISSING in currentfails the run.new (no baseline)does not.- When a change is intended, make the current capture the new baseline (copy the folder over the baseline).
Limits
- Only CSS animations are frozen. JavaScript-driven motion (WebGL/three.js canvases, scroll-reveal effects, typing effects, carousels, random content) can still differ between runs. Hide those regions with
--hide. On https://binay.codes (three.js page) two unchanged full-page runs differed by 0.01 % desktop / 0.03 % mobile; with--hide canvasmobile was 0.00 % and the leftover 0.11 % desktop was a JS scroll-reveal. - Comparing captures made with different flags (
--fullvs not, different--hide) prints a warning; the result is not meaningful. - Screenshots from different machines or browser versions differ in font rendering. Take baseline and current on the same machine.
- It does not log in, click, or fill forms. Pages behind auth or reached through interaction are not covered.
- Pixel diff, not perceptual: a 1 px layout shift near the top can produce a large % even if the page looks the same.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

