Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Visual regression testing through screenshot capture and comparison. Pixel-diff analysis, responsive screenshot capture across viewports, and visual change reporting with highlighted differences.
.claude/skills/a5c-ai-screenshot-comparison/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 15% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 185% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 171% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -34% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 86% | 0% |
You are screenshot-comparison - a specialized skill for visual regression testing through screenshot capture and pixel-level comparison, ensuring UI consistency across changes.
This skill enables AI-powered visual regression testing including:
pixelmatch or similar diff libraryCapture screenshots with various configurations:
javascript// Full page screenshot const screenshot = await page.screenshot({ fullPage: true, path: 'screenshots/home-full.png' }); // Element screenshot const element = await page.locator('.hero-section'); await element.screenshot({ path: 'screenshots/hero.png' }); // Viewport-specific screenshot await page.setViewportSize({ width: 375, height: 667 }); await page.screenshot({ path: 'screenshots/home-mobile.png' }); // Hide dynamic elements await page.evaluate(() => { document.querySelectorAll('[data-testid="timestamp"]') .forEach(el => el.style.visibility = 'hidden'); }); await page.screenshot({ path: 'screenshots/home-stable.png' });
Compare screenshots and generate diff images:
javascriptconst pixelmatch = require('pixelmatch'); const { PNG } = require('pngjs'); const fs = require('fs'); const baseline = PNG.sync.read(fs.readFileSync('baseline.png')); const current = PNG.sync.read(fs.readFileSync('current.png')); const { width, height } = baseline; const diff = new PNG({ width, height }); const numDiffPixels = pixelmatch( baseline.data, current.data, diff.data, width, height, { threshold: 0.1, // Sensitivity (0-1) includeAA: false, // Ignore antialiasing diffColor: [255, 0, 0], // Diff highlight color diffColorAlt: [0, 255, 0] // Alt color for anti-aliased } ); fs.writeFileSync('diff.png', PNG.sync.write(diff)); const diffPercentage = (numDiffPixels / (width * height)) * 100; console.log(`Diff: ${diffPercentage.toFixed(2)}%`);
Capture screenshots across multiple viewports:
javascriptconst viewports = [ { name: 'mobile', width: 375, height: 667 }, { name: 'tablet', width: 768, height: 1024 }, { name: 'desktop', width: 1440, height: 900 }, { name: 'wide', width: 1920, height: 1080 } ]; const results = []; for (const viewport of viewports) { await page.setViewportSize({ width: viewport.width, height: viewport.height }); await page.screenshot({ path: `screenshots/${pageName}-${viewport.name}.png`, fullPage: true }); results.push({ viewport: viewport.name, path: `screenshots/${pageName}-${viewport.name}.png` }); }
Generate comprehensive diff reports:
json{ "testRun": { "id": "vr-2026-01-24-001", "timestamp": "2026-01-24T10:30:00Z", "branch": "feature/new-header", "commit": "abc123" }, "summary": { "total": 25, "passed": 22, "failed": 2, "new": 1, "passRate": "88%" }, "comparisons": [ { "name": "homepage-desktop", "status": "passed", "diffPercentage": 0.01, "threshold": 0.1, "baseline": "baseline/homepage-desktop.png", "current": "current/homepage-desktop.png" }, { "name": "header-mobile", "status": "failed", "diffPercentage": 5.2, "threshold": 0.1, "baseline": "baseline/header-mobile.png", "current": "current/header-mobile.png", "diff": "diffs/header-mobile-diff.png", "changedRegions": [ { "x": 10, "y": 5, "width": 200, "height": 50, "description": "Logo area" } ] }, { "name": "new-feature-banner", "status": "new", "current": "current/new-feature-banner.png", "requiresApproval": true } ] }
Manage screenshot baselines:
bash# Update baseline for specific test /skill screenshot-comparison update-baseline \ --test header-mobile \ --approve # Update all failed baselines /skill screenshot-comparison update-baseline \ --all-failed \ --approve # Review pending approvals /skill screenshot-comparison review \ --status pending
Test individual components in isolation:
javascript// Storybook integration const stories = await getStorybookStories(); for (const story of stories) { // Navigate to story await page.goto(`${storybookUrl}/iframe.html?id=${story.id}`); // Wait for component await page.waitForSelector('#storybook-root > *'); // Capture component screenshot const component = await page.locator('#storybook-root > *'); await component.screenshot({ path: `screenshots/components/${story.id}.png` }); }
This skill can leverage the following MCP servers:
| Server | Description | Installation | |--------|-------------|--------------| | Percy via BrowserStack MCP | Cloud-based visual testing | BrowserStack | | Playwright MCP Server | Browser automation with screenshots | GitHub |
This skill integrates with the following processes:
component-library.js - Component visual regressionresponsive-design.js - Responsive visual testinghifi-prototyping.js - Design-to-implementation comparisonWhen executing operations, provide structured output:
json{ "operation": "compare", "status": "completed", "summary": { "total": 10, "passed": 9, "failed": 1 }, "results": [ { "name": "header-desktop", "status": "passed", "diffPercentage": 0.02 } ], "artifacts": [ "report.html", "diffs/header-mobile-diff.png" ] }
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 13,532 | 17,023 | +26% | 1 | 1 | 0% | 1,662 | 4,309 | +159% | 0 | 0 | — |
case-02 | fail→pass | 21,322 | 14,615 | -31% | 1 | 1 | 0% | 3,550 | 4,080 | +15% | 0 | 0 | — |
case-03 | fail→pass | 20,871 | 10,267 | -51% | 1 | 1 | 0% | 1,131 | 3,220 | +185% | 0 | 0 | — |
case-04 | pass→pass | 17,662 | 19,537 | +11% | 1 | 1 | 0% | 2,516 | 4,608 | +83% | 0 | 0 | — |
case-05 | pass→pass | 34,418 | 16,748 | -51% | 1 | 1 | 0% | 2,338 | 3,939 | +68% | 0 | 0 | — |
case-06 | pass→pass | 14,729 | 21,230 | +44% | 1 | 1 | 0% | 1,940 | 4,272 | +120% | 0 | 0 | — |
case-07 | pass→pass | 19,099 | 19,068 | -0% | 1 | 1 | 0% | 3,076 | 4,846 | +58% | 0 | 0 | — |
case-08 | fail→pass | 4,880 | 7,348 | +51% | 1 | 1 | 0% | 854 | 2,317 | +171% | 0 | 0 | — |
case-09 | fail→pass | 21,347 | 7,681 | -64% | 1 | 1 | 0% | 3,619 | 2,396 | -34% | 0 | 0 | — |
case-10 | fail→pass | 21,341 | 23,793 | +11% | 1 | 1 | 0% | 3,035 | 5,630 | +86% | 0 | 0 | — |
case-11 | pass→pass | 11,203 | 7,243 | -35% | 1 | 1 | 0% | 1,164 | 2,927 | +151% | 0 | 0 | — |
case-12 | pass→pass | 21,088 | 10,522 | -50% | 1 | 1 | 0% | 2,679 | 3,820 | +43% | 0 | 0 | — |
case-13 | fail→fail | 16,156 | 20,257 | +25% | 1 | 1 | 0% | 3,857 | 5,561 | +44% | 0 | 0 | — |
case-14 | pass→pass | 34,506 | 8,936 | -74% | 1 | 1 | 0% | 2,312 | 4,119 | +78% | 0 | 0 | — |
case-15 | pass→pass | 8,607 | 9,228 | +7% | 1 | 1 | 0% | 1,501 | 2,654 | +77% | 0 | 0 | — |
case-16 | pass→pass | 15,950 | 1,837 | -88% | 1 | 1 | 0% | 837 | 2,247 | +168% | 0 | 0 | — |
case-17 | pass→pass | 10,380 | 5,116 | -51% | 1 | 1 | 0% | 957 | 2,833 | +196% | 0 | 0 | — |
case-18 | pass→pass | 12,036 | 2,067 | -83% | 1 | 1 | 0% | 2,072 | 2,304 | +11% | 0 | 0 | — |
case-19 | fail→pass | 10,109 | 2,758 | -73% | 1 | 1 | 0% | 1,886 | 2,387 | +27% | 0 | 0 | — |
case-20 | pass→pass | 5,515 | 7,378 | +34% | 1 | 1 | 0% | 1,028 | 3,442 | +235% | 0 | 0 | — |
case-21 | pass→pass | 14,145 | 11,687 | -17% | 1 | 1 | 0% | 2,728 | 4,339 | +59% | 0 | 0 | — |
case-22 | pass→pass | 13,253 | 13,969 | +5% | 1 | 1 | 0% | 2,997 | 4,905 | +64% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +27 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.