npx skills add ...
npx skills add jasny/perfect-agent --skill pixel-perfect
Reproduce a UI as exactly as possible from a reference (Figma, live source, screenshot, or image). TRIGGER when: user wants to copy a design exactly, reproduce a screen from a screenshot, clone a Figma design, match spacing/colors/typography in detail, or port a design to another framework without changing the look. DO NOT TRIGGER for redesigns, loose "something like this" requests, or UX improvement tasks.
npx skills add jasny/perfect-agent --skill pixel-perfect
A skill for reproducing a UI as exactly as possible from a screenshot, image, Figma preview/export, clickable demo, or live website.
The result is not just code. The result is:
This skill is for exact copying, not for inspiration, redesign, cleanup, normalization, or stylistic interpretation.
Use this skill when the user wants to:
Do not use this skill when the user wants:
jqawkmagick (v7) or convert + compare + identify (v6)Use this skill as a strict execution loop:
Repeat steps 3 to 5 until every required issue is resolved (fixed, accepted_by_user, or renderer_only_drift) and the validation gates pass.
MUST and MUST NOT are hard requirements.SHOULD is a strong default that may be overridden only with explicit justification in the report.When tradeoffs must be made, prioritize in this order:
Accepted input types in priority order:
Rules:
This skill must produce four things during execution:
The agent must not jump straight into coding without first creating the specification.
Use the report heading schema in references/report-template.md.
Use two reporting modes:
iteration mode during refine loops (compact summary projection, changed/failing items only)final mode at completion handoff (full-fidelity report)Do not enforce fixed token limits. Keep intermediate output concise by using artifact projections instead of repeating full report content.
When the agent believes the task is complete, it MUST provide a final user-verification handoff that includes all of the following:
Use these references for detailed execution guidance:
references/report-template.mdreferences/responsive-scope-playbook.mdreferences/measurement-playbook.md (index)references/measurement-chrome-devtools.mdreferences/measurement-image.mdreferences/measurement-figma.mdreferences/specification-playbook.mdreferences/validation-playbook.mdDetermine which of these applies:
If there is a live inspectable source, use that as the primary measurement source. If there is a Figma inspectable source, use Figma inspect data as the primary measurement source. If there is only an image, use screenshot-based measurement.
Source selection MUST follow the Input preference order. Lower-priority sources SHOULD be used only as supplemental confirmation unless no higher-priority source is available.
Select required viewports before implementation starts.
Use the deterministic scope and classification rules in references/responsive-scope-playbook.md.
Minimum requirements:
Use browser tooling such as Chrome DevTools MCP to inspect the rendered UI directly.
Use the exact measurement sequence in references/measurement-chrome-devtools.md.
Measure and record:
Also capture screenshots of:
Do not eyeball values from the screenshot first if the DOM can be inspected. Measure first.
When the design is only available as an image, infer structure and measure visually.
Use the screenshot-only procedure in references/measurement-image.md.
Determine:
Use repeated screenshot comparison during implementation to refine uncertain values.
When the source is a Figma preview or file with inspect access, measure from Figma inspect data.
Use the Figma procedure in references/measurement-figma.md.
Measure from inspect values first, then use exported or captured frame images for visual confirmation.
Before writing the detailed specification, write a concise execution plan.
This plan MUST include:
Example:
Keep the plan short. It is an execution plan, not the full specification.
Create a measurement-based UI spec before coding.
The specification must be concrete enough that another engineer could implement the screen without seeing the original reference.
Use the field-level schema and quality checks in references/specification-playbook.md.
Phase 5 concept:
Required sections:
Screen metadata: defines target environment and global layout behavior.Component hierarchy: defines structural tree and naming used across implementation and validation.Section-by-section measurements: defines geometry, spacing, alignment, and surface styling per major section.Typography spec: defines exact text rendering rules for key text elements.Color palette: defines concrete color values and gradients used by the screen.Border and radius spec: defines borders, corner radii, and divider treatments.Iconography spec: defines icon asset, size, placement, and style details.Asset parity + user decisions: records font/icon availability and user-approved fallback decisions.Interaction and state notes: defines visible state-dependent styling/layout behavior.Platform translation notes: documents renderer translation constraints without redesign.For required fields and example outputs for each section, use references/specification-playbook.md.
All 10 required specification sections MUST be present before implementation starts.
Before implementation starts, the report MUST include an acceptance contract with:
Must-match list: annotated design decisions that are non-negotiableIgnore list: explicitly allowed mismatchesPortable-allowed drift: renderer-only drift allowancesRules:
Must-match listIgnore listWrite code using the specification as the source of truth.
Rules:
If the source uses odd values such as 23px or 18px, keep them.
Run the implementation in the correct target environment.
Use the environment setup defined in the execution plan. Do not switch target environment during validation.
Run checklist:
web, react-native, or other declared target)For each required viewport in the selected viewport set, capture screenshots of:
Use the exact viewport size declared in the plan for each pass. Viewport sizes MUST match the plan exactly. Required screenshots for each viewport MUST be captured.
Artifact output requirements:
./scripts/validate-visual.sh and save JSON output (for example validation/<viewport>.json)Compare the implementation screenshots against the reference for each required viewport.
Check specifically for:
Also run objective diff checks and record numeric results.
Use the validation flow and reporting format in references/validation-playbook.md.
For LLM-facing updates, first project validator artifacts into a compact summary with ./scripts/summarize-validation.sh.
Validation profiles:
lenient (allowed only when explicitly justified)portable (default for cross-renderer work)strict (default for same-renderer work)ultra (opt-in only, never default)Profile selection rules:
strict by default when source and target use effectively the same renderer and font stackportable by default when source and target render differently, such as browser to React Nativeultra only when the user explicitly asks for it and conditions are controlled (same renderer version, same OS, same DPR, same fonts, same capture pipeline)lenient only when hard constraints prevent higher-fidelity matching; record the exact blocker and why higher profiles are not achievablePortable interpretation:
portable MUST allow only renderer-level driftportable MUST NOT relax annotated design decisions in the Must-match listValidation artifact priority:
Marked issue resolution:
fixed, accepted_by_user, or renderer_only_driftgood, bad, bad_with_reasonrenderer_only_drift MUST include a brief reasonvalidated unless all marked issues have one of the required statusesvalidated if it has not been updated after the latest visual changesFor every run, report the selected profile and why it was selected before reporting metrics. For every run, report viewport-level metrics for every required viewport.
LLM input projection rules:
Adjust the code to remove visible mismatches.
If a mismatch reveals the specification was incomplete or wrong, update the specification.
Repeat:
until obvious differences are gone or a hard platform limitation blocks perfect replication.
At least one full capture -> compare -> fix -> re-capture loop MUST occur after the last substantive UI edit.
The refine loop MUST run at least once and MUST NOT run more than 10 times.
If unresolved mismatches remain after 10 loops, the report MUST include a detailed unresolved section with:
If blocked, document the limitation and the remaining discrepancy.
Iteration reporting rules:
iteration report block from projection outputfinal report mode at handoffThe skill is done only when all of the following are true:
lenient is used, the blocker and reason are explicitly documented.Must-match list, Ignore list, and Portable-allowed drift.fixed, accepted_by_user, or renderer_only_drift with reason.capture -> compare -> fix -> re-capture loop has run after the last substantive UI edit."Roughly similar" is not done. "Good enough" is not done. "Framework-idiomatic but slightly different" is not done.
Do not do any of the following:
fixed, accepted_by_user, or renderer_only_driftThis skill turns a vague prompt like "copy this design" into a strict process:
This skill does not ask the agent to be creative. It asks the agent to be precise.