visual-comparison

A browser-checking procedure for comparing a web page with its Figma design at different screen widths. Figma is a design tool, and Playwright is a tool for controlling a browser in tests.

In plain words
What is it for?
It is for checking provided Figma frames against a running page at matching viewport sizes and recording visual differences.
Why use it?
It helps find layout differences that appear only on mobile, tablet, or desktop screens.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/adobecom/da-express-milo/visual-comparison
Clone the repo
git clone --depth 1 https://github.com/adobecom/da-express-milo

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,155 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02155
Opus 5 $0.00000 $0.01077
Sonnet 5 $0.00000 $0.00431
Haiku 4.5 $0.00000 $0.00215

Measured 2d ago against content hash a1f0ecc4afe8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

visual-comparison scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf .playwright-mcp/
.claude/skills/build-block-from-figma/agents/visual-comparison.md · 229 lines

How it starts

The opening of the file, as written. The whole thing — 229 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Visual Comparison Subagent

This script is delegated from Phase 5 of the main SKILL.md. Use Playwright MCP for all browser interactions.


Viewport → width mapping

Viewport Playwright width CSS breakpoint it falls within
Mobile 375 px base (< 600 px)
Small tablet 768 px 600 px – 899 px
Large tablet 960 px ≥ 900 px
Desktop 1440 px ≥ 1200 px
Widescreen 1800 px ≥ 1680 px

Match these to whichever Figma frames were provided.

Only test viewports for which a Figma frame was provided.

Important: "Small tablet" (768 px) and "Large tablet" (960 px) may have different layouts even though they are both ≥ 600 px — the block's actual side-by-side breakpoint is derived from the Figma design, not the generic grid system. Always test both narrower and wider sides of the tablet range when a 600–899 px Figma frame was provided.


Comparison procedure (per breakpoint)

For each breakpoint:

  1. Navigate to the Playwright URL (constructed in Phase 5b).
  2. Set viewport width to the value from the table above. Set height to a generous value (e.g. 900 px) to avoid scroll clipping.
  3. Wait for the block to finish rendering — wait for the block's root element to be visible and for any images inside it to load.
  4. Force-refresh the block's CSS to bypass the CDN's max-age cache (EDS serves code with max-age=7200):
    const links = [...document.querySelectorAll('link[rel="stylesheet"]')];
    const blockLink = links.find(l => l.href.includes('blocks/<block-name>'));
    if (blockLink) blockLink.href = blockLink.href.split('?')[0] + '?v=' + Date.now();
    
    Skip this step for localhost mode.
  5. Verify DOM structure with browser_evaluate before screenshotting. Check that decorated classes and any expected structural divs (e.g. .foreground, .text-content, .cta-container) are present. If the structure doesn't match what the latest JS should produce, the browser module cache may be stale — close the browser with browser_close, navigate fresh, and re-check before continuing.
  6. Broken-image guard: run the following to detect broken images:
    const broken = [...document.querySelectorAll('.<block-name> img')]
      .filter(img => !img.complete || img.naturalWidth === 0)
      .map(img => ({
        src: img.src,
        cssAspectRatio: getComputedStyle(img).aspectRatio,
        intrinsic: `${img.naturalWidth}x${img.naturalHeight}`,
      }));
    
    If any images are broken:
    • Note it in Obstacles Encountered: "Image broken — CSS aspect-ratio cannot be visually verified; confirmed via getComputedStyle."
    • Skip shape, size, and aspect-ratio comparisons for those elements.
    • Do not fail the visual comparison for layout issues caused by the broken placeholder rendering at unexpected dimensions.
  7. Screenshot the block's bounding box (not the full page). Use Playwright's element screenshot to capture just the component.
  8. Computed-style spot-check: after the screenshot, run:
    const block = document.querySelector('.<block-name>');
    const fg = block.querySelector('.foreground');
    return {
      blockFlexDir:    getComputedStyle(block).flexDirection,
      blockPaddingInline: getComputedStyle(block).paddingInline,
      blockPaddingBlock:  getComputedStyle(block).paddingBlock,
      fgMaxWidth:      fg ? getComputedStyle(fg).maxWidth : null,
    };
    
    Verify flexDirection matches the expected layout (column vs row) for this breakpoint. If it doesn't match, treat as a layout failure regardless of how the screenshot looks — the CSS breakpoint is wrong.

Read the full file on GitHub · 229 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 229 lines · 0 tokens per session scan C a1f0ecc4afe8

Subscribe to this mod's changes

visual-comparison is an agent published in the GitHub repository adobecom/da-express-milo (6 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,155 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

alchemist

Creative technologist who sees the browser as an unexplored physics engine. Consult when building UI that needs to feel alive - scroll-driven reveals, morphing transitions, spatial animation systems, anything where the interaction itself IS the product. Thinks in weight, tension, and breath before thinking in code.…

drobins25/craft · 355 tokens

audit-geo

Evaluates AI crawler access, llms.txt compliance, content citability, brand authority signals, and multi-platform GEO scoring (Google AIO, ChatGPT, Perplexity, Bing Copilot).

XuanRanL/loamwright-SEO-Skill · 44 tokens

praman-sap-planner-cli

SAP UI5 test planner via Playwright CLI. Token-efficient alternative to MCP planner. Generates test plan + gold-standard spec using CLI commands.

mrkanitkar/playwright-praman · 36 tokens

FAI Browser Agent

Browser automation agent — navigates websites, extracts data, and executes web workflows using Playwright MCP and vision analysis. Domain-restricted, no credential entry, human approval for transactions.

frootai/frootai · 41 tokens

test-writer

Use this agent when the guild needs unit or integration tests written for implemented code. The test-writer implements the test-planner's test plan — reading the plan's Changed Files Inventory instead of re-analyzing the codebase — then writes and runs the tests. Spawned by the check-in skill when a test-writing task…

HirogaKatageri/hirokata · 77 tokens

performance-optimizer

Full-Stack Performance Architect. Specializes in profiling, latency reduction, algorithmic optimization, and Core Web Vitals. Operates on the principle of "Evidence over Intuition.".

DDS-Solutions/AI-TadPole-OS · 40 tokens