browser-screenshot-diff — Claude Code skill: diff and install
Compares two recorded browser sessions by matching steps, screenshots, and accessibility snapshots. Use it for visual regression and replay checks.
npx skills add ruvnet/ruflo --skill browser-screenshot-diff -a claude-codeWhat browser-screenshot-diff does
The skill pairs matching step-id values across two RVF sessions. It compares the PNG screenshot and accessibility snapshot for each step, flags steps that exist on only one side, reports the first divergence, and calculates an aggregate similarity score. Pixel mode reports mse, psnr, and the bounding box of the largest diff cluster; DOM mode lists added, removed, and changed nodes.
It first checks both containers with npx -y [email protected] rvf status, then reads trajectory.ndjson and maps each step to its saved artifacts. The verdict is written to findings.md inside a new RVF container, while browser-sessions receives comparison tags for both source sessions. browser_eval is used for live verification.
The default pixel threshold is 0.02, and the available modes are pixel, dom, and both. Pixel comparison reacts to font hinting, antialiasing, and scrollbar position, so the viewport must stay pinned across both sessions. Dynamic content such as clocks and ads needs ignore regions or snapshot preprocessing.
What it helps with
- compare screenshots from two browser sessions step by step
- spot the first divergence after a UI change
- verify a replay against its parent session
- diff accessibility trees for two form variants
- save the comparison verdict in replayable RVF artifacts
Example prompts for the agent
- Compare
<session-id-a>and<session-id-b>inbothmode with threshold0.02. - Check whether the replay session matches the parent at every
step-id, then report the first divergence. - Compare the two form variants in
dommode and list changed nodes with their accessible names.
How to install browser-screenshot-diff
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill browser-screenshot-diff -a claude-code2Manually: put the files in place
~/.claude/skills/browser-screenshot-diff/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/browser-screenshot-diff/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill browser-screenshot-diff -a codex2Manually: put the files in place
.agents/skills/browser-screenshot-diff/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill browser-screenshot-diff -a cursor2Manually: put the files in place
.cursor/skills/browser-screenshot-diff/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ruvnet/ruflo browser-screenshot-diff2Manually: put the files in place
.github/skills/browser-screenshot-diff/SKILL.md1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill browser-screenshot-diff -a gemini-cli2Platform CLI
gemini skills install https://github.com/ruvnet/ruflo --path plugins/ruflo-browser/skills/browser-screenshot-diffManually: put the files in place
.devin/skills/browser-screenshot-diff/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill browser-screenshot-diff -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about browser-screenshot-diff
How do I install browser-screenshot-diff in Claude Code?
Run npx skills add ruvnet/ruflo --skill browser-screenshot-diff -a claude-code, then run npx skills add ruvnet/ruflo --skill browser-screenshot-diff -a claude-code again. The skill file is at ~/.claude/skills/browser-screenshot-diff/SKILL.md.
What does browser-screenshot-diff do?
It compares two recorded sessions at matching step-id values, checks screenshots and accessibility snapshots, then produces a first-divergence report and an aggregate similarity score.
Why can pixel diff report a difference when the UI looks the same?
Pixel diff is affected by font hinting, antialiasing, and scrollbar position. Keep the viewport pinned in both sessions, and handle dynamic content with ignore regions or snapshot preprocessing.
Source text
SKILL.md · MIT
--- name: browser-screenshot-diff description: Visual + DOM diff between two recorded sessions at matching trajectory step ids; used for visual regression and replay verification argument-hint: "<session-id-a> <session-id-b> [--threshold <0..1>] [--mode pixel|dom|both]" allowed-tools: mcp__plugin_ruflo-core_ruflo__browser_eval Bash Read Write --- # Browser Screenshot Diff Compare two recorded sessions step-by-step. Pairs each step in session A to the same `step-id` in session B, diffs the captured screenshot and accessibility snapshot, reports the first divergence and an aggregate similarity score. ## When to use - Visual regression after a UI change (record before, record after, diff). - Verifying a `browser-replay` run matches the parent session within tolerance. - Comparing two A/B variants of the same form flow. ## Steps 1. **Locate both RVF containers**: ```bash npx -y [email protected] rvf status <session-id-a>.rvf npx -y [email protected] rvf status <session-id-b>.rvf ``` 2. **Load both trajectories** from `trajectory.ndjson`. Build a `step-id → (screenshot_path, snapshot_path)` map for each. 3. **Pair steps** by `step-id`. Steps that exist on only one side are flagged as `unmatched` and contribute to the divergence score. 4. **Pixel diff** (`--mode pixel|both`): compare the two PNGs at each step. Report `mse`, `psnr`, and the bounding box of the largest diff cluster. Threshold default `0.02` (2% of pixels). 5. **DOM diff** (`--mode dom|both`): compare the accessibility snapshots node-by-node. Report added / removed / changed nodes with their accessible names. 6. **Aggregate similarity**: weighted average across matched steps, weighted by step duration. Verdict goes into a new `findings.md` under a fresh RVF container so the diff itself is replayable. 7. **Persist** the diff verdict in `browser-sessions` under both source ids' tags so future searches surface "ran a diff against session X". ## Caveats - Pixel diff is sensitive to font hinting, antialiasing, and scrollbar position. Keep viewport pinned across both sessions. - DOM diff over Playwright's accessibility tree is more stable than HTML diff. Prefer it. - This skill does not handle dynamic content (clocks, ads); add ignore regions to the field map or pre-process snapshots before diffing. - The `browser_screenshot_diff` MCP tool is **not** planned (ADR-0001 §7); the skill operates against locally-saved RVF artifacts and uses `browser_eval` only for live verification.
© ruvnet · MIT · ruvnet/ruflo