From Figma to pixel-perfect: an AI agent that restores pages and reviews its own work
For teams doing AI-assisted frontend work, this closes the last loop that usually stays manual, the pixel-level acceptance check. The cost of visual regression is no longer a developer staring between two screens, but an agent looping until the diff converges.
A Chinese frontend developer has been using a self-built AI Skill that replaces the last manual chore of web page restoration: visually comparing the browser result against the Figma design and adjusting pixel offsets. The Skill takes a single Figma node and a local page URL, then runs a closed loop: read the design structure through Figma MCP, generate the page code, open the page in a controllable browser, screenshot it under fixed viewport and DPR conditions, align the screenshot with the design reference using Sharp, generate overlay and diff images, then inspect the DOM box model and element occlusion to find the real cause before changing code.
The workflow codifies several frontend heuristics into rules for the AI. Design baseline and slicing multipliers are computed separately, so a 360px or 720px artboard produces correct CSS sizes and 2x/1x exports. Layers are split by whether content changes, needs interaction, or is purely decorative: dynamic text and clickable areas go into real DOM, while complex visuals become image assets. Diff images mark few-pixel deviations as red patches, which a vision-based AI can actually perceive, and the agent is told to debug like a human would, using getBoundingClientRect, overflow checks, and elementsFromPoint, rather than blindly nudging margins.
The author deliberately ships no code. They argue that current AI models can write the required scripts and rules themselves once you describe each step, so teams can rebuild the same pipeline against their own tech stack. The article details the four required components, common failure modes like black edges from exporting canvas backgrounds, and the stop-loss rule that forces the agent to stop grinding after two failed fix rounds.
The most time-consuming part of AI-assisted page development is shifting from writing code to verifying code; this Skill treats visual acceptance as an automated loop, which is a more mature use of AI than one-shot prompt generation.
Relying on AI's direct image comparison fails for sub-pixel deviations, so the workflow reintroduces a deterministic image-processing step with Sharp; the hybrid of deterministic diffing and AI-driven diagnosis is what makes the loop reliable.
The workflow turns known frontend debugging heuristics into explicit agent rules, which suggests that prompt engineering for UI work is mostly encoding human inspection patterns, not inventing new ones.
The 'no code package' stance reflects a practical observation: agent tooling has advanced enough that rules and scripts are just artifacts an AI can generate from a description, making the workflow more about process design than implementation.