/ravidsrk-agent-skills:visual-regressionfrom ravidsrk-agent-skills
Detect unintended UI changes by comparing Playwright screenshots against reviewed baselines — stabilize renders, redact sensitive DOM, cluster perceptual diffs, verify fixes, and gate CI. Use when the user asks for visual regression tests, screenshot diffs, baseline updates, UI change verification, responsive layout checks, or "did this CSS change break anything?"
Ships in ravidsrk-agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Catch visual regressions the way tests catch logic regressions: capture stable screenshots, compare them against reviewed baselines, and make the diff the gate. This skill covers the whole loop — deterministic capture, sensitive-data redaction, perceptual triage, fix verification, baseline promotion, CI, and agent-readable evidence.
It works with plain @playwright/test. Frontguard is an optional backend for perceptual clustering, orphan-branch baselines, and an MCP loop for agents.
Trigger on any of:
references/evidence.md.Minimum:
npm i -D @playwright/test
npx playwright install --with-deps chromium
export APP_URL="http://localhost:3000"
Optional, for perceptual clustering and an agent MCP loop:
npx @frontguard/cli doctor
npx @frontguard/cli init --yes
Scaffold a starting point:
bash scripts/scaffold.sh --dir . --url "$APP_URL"
The scaffold writes playwright.config.ts and tests/visual/home.spec.ts. It refuses to overwrite existing files unless --force is passed.
List routes × viewports × states. Capture only surfaces a user can see.
| Dimension | Start with |
|---|---|
| Routes | /, /pricing, /login, the page the PR changes |
| Viewports | 375×812, 768×1024, 1440×900 |
| States | default, hover/focus, open menu, empty, error, loading |
| Themes | light and dark if both ship |
Keep the matrix small. Ten meaningful screenshots reviewed every PR beat two hundred ignored ones.
Before the first capture, remove sources of false diffs:
document.fonts.ready and network idle.await page.goto(url, { waitUntil: "networkidle" });
await page.evaluate(() => document.fonts.ready);
await page.addStyleTag({
content: `*, *::before, *::after { animation: none !important; transition: none !important; }`,
});
npx playwright test tests/visual --update-snapshots
Review every new baseline image before committing it. A baseline is a test expectation: committing a broken screenshot makes the bug permanent.
Store baselines in git (small apps) or a dedicated orphan branch (visual-baselines) for large matrices. See references/ci.md.
npx playwright test tests/visual
Playwright writes expected/actual/diff images on failure. For perceptual clustering and a machine-readable report:
npx @frontguard/cli run --url "$APP_URL" --wait-for-stability --redact-sensitive
Exit codes: 0 = pass, 1 = visual diff or new snapshot, 2 = configuration/runtime error. Treat 2 as a broken test, not a regression.
For each diff:
[data-testid], computed styles, box model).Never promote a baseline to make red turn green. Promote only after a human or an independent verifier accepts the new appearance.
# After the CSS/component fix
npx playwright test tests/visual
Required evidence before claiming the fix works:
Run the suite on every PR, upload expected/actual/diff artifacts on failure, and block merge on a diff. See references/ci.md for a complete GitHub Actions job.
If the agent has Frontguard MCP tools:
list_regressions
→ inspect_diff_cluster_dom
→ verify_css_patch
→ promote_baseline
The loop is: enumerate regressions, inspect the cluster and its DOM, patch the smallest cause, re-verify the same cluster, then promote only the accepted baseline. Without MCP, use the CLI plus the same order.
Screenshots prove a state; videos prove an interaction. For both:
ffprobe; do not report the requested viewport as the video size.See references/evidence.md for the capture and upload contract.
| Symptom | Cause | Fix |
|---|---|---|
| Every screenshot differs by a few pixels | Fonts or anti-aliasing differ between machines | Run in the same container/browser version; wait for document.fonts.ready; use a perceptual threshold |
| Diff only on the first run | Animations, lazy images, or network still settling | Disable animations; wait for stability; mock slow requests |
| Diff contains a timestamp, avatar, or token | Volatile or sensitive content | Freeze time; redact with a stable mask |
| Dark mode changes every screenshot | Color scheme not pinned | Set colorScheme per project or per test |
| Mobile layout differs wildly | Device scale factor or viewport not pinned | Pin viewport and deviceScaleFactor |
| Huge diff after a dependency bump | Browser version changed rendering | Re-baseline in the pinned CI image and review the diff |
| Test passes locally, fails in CI | Different OS/font stack | Run visual tests in the same container locally and in CI |
| New snapshot silently accepted | --update-snapshots in CI | Never run update mode in CI; fail on new snapshots |
references/setup.md — install, config, auth state, route inventoryreferences/diffing.md — thresholds, perceptual metrics, stability, redactionreferences/playwright.md — component-scoped assertions, fixtures, selectorsreferences/ci.md — GitHub Actions, baseline storage, artifactsreferences/evidence.md — screenshot/video evidence and uploadscripts/scaffold.sh — generate a minimal Playwright visual setupREADME.md (opens in a new tab)assets/banner-prompt.txt (opens in a new tab)assets/banner.png (opens in a new tab)references/ci.md (opens in a new tab)references/diffing.md (opens in a new tab)references/evidence.md (opens in a new tab)references/playwright.md (opens in a new tab)references/setup.md (opens in a new tab)scripts/scaffold.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (ravidsrk/agent-skills) — no native marketplace selected
npx claudepluginhub p/ravidsrk-agent-skills12 skills in this plugin
/cloudflare-dnsMigrate DNS hosting from Namecheap to Cloudflare and manage records via API — handles zone creation, bulk record import, nameserver flip at the registrar (Namecheap-specific; other registrars need a manual flip), propagation watch, and rollback. Zone management works for any Cloudflare zone regardless of registrar. Use when the user wants to "move DNS to Cloudflare", "add a domain to Cloudflare", "manage Cloudflare DNS records", or "automate DNS setup for multiple sites"./deep-researchGeneric parallel multi-source deep-research orchestrator. Fans out across 8 data sources in parallel (X via monid/tikhub, Reddit via monid, Hacker News via Algolia, GitHub repos + issues, Polymarket Gamma, YouTube with transcripts via monid, Exa neural web search via monid) and dumps quotable evidence as JSON + human-readable markdown in a single command. Use whenever the user says "do deep research on X", "what's the discourse on Y", "research this topic", "give me a primer on Z", asks for cross-source validation of a thesis, or needs broad evidence before drafting any long-form piece (briefing, post, report, memo)./finish-lineDrives an AI-built product that has docs, specs or GitHub issues but was never finished to verified launch-readiness, fully autonomously — no questions or approvals mid-run. It learns what the product is only from the docs and the running app (every claim quotes its source; an independent verifier approves it), audits what works, freezes a hash-locked definition of done, then works it item by item with Playwright / Maestro visual checks, a verifier subagent and tamper checks against skipped or weakened tests, up to a release candidate on a preview. Every issue found is researched until fixed. Starts over cleanly when a run misread the product. Use when the user says "finish this product", "take it to launch", "do it autonomously", "don't ask me", "verify what actually works", "the AI says it's done but it isn't", "audit my half-built app", "test everything visually", "it misunderstood my product, start over", or has many unfinished AI-coded products and must pick one to ship.Other plugins' skills for the same job