skills/imagegen-ui-match/SKILL.md
Use when implementing a UI from a visual mock and the user wants an imagegen-based compare-and-iterate workflow until the current page closely matches the target screenshot or mock. Covers browser screenshots, explicit side-by-side comparisons, imagegen visual audits, bitmap asset generation, and avoiding stale-reference mistakes.
npx skillsauth add iamkaf/skills imagegen-ui-matchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this when a user asks to make an implemented UI match a mock, screenshot,
or generated concept, especially when they want $imagegen to judge similarity.
Treat visual matching as an artifact loop, not a vibe loop:
Do not ask imagegen to compare against loose conversation context if old screenshots exist. Always provide a freshly generated comparison image.
Identify the target image and save/confirm its path. If there are multiple mocks, ask or infer the primary one and state it.
Record:
Use the target's aspect ratio as the browser viewport when practical.
Use browser automation for real screenshots. Prefer agent-browser when
available:
agent-browser --session ui-match set viewport 1680 944
agent-browser --session ui-match open http://127.0.0.1:3000/path
agent-browser --session ui-match wait --load networkidle
agent-browser --session ui-match screenshot /tmp/current-ui.png
Inspect the screenshot yourself before asking imagegen. Fix obvious breakage first: blank screens, overflow, clipped panels, missing assets, or wrong route.
Create a single image with the target on the left and the current screenshot on the right. This prevents stale-image audits.
Using ImageMagick:
target=/path/to/target.png
current=/tmp/current-ui.png
convert "$target" -resize 840x472\! /tmp/target-840.png
convert "$current" -resize 840x472\! /tmp/current-840.png
convert -size 1680x560 xc:white \
/tmp/target-840.png -geometry +0+60 -composite \
/tmp/current-840.png -geometry +840+60 -composite \
-gravity northwest -pointsize 28 -fill black -annotate +28+36 'TARGET MOCK' \
-gravity northwest -pointsize 28 -fill black -annotate +868+36 'CURRENT IMPLEMENTATION' \
/tmp/ui-comparison.png
If ImageMagick is unavailable, use any deterministic image composition tool. Do not handwave the comparison step.
Use imagegen in infographic/diagram mode with the explicit comparison visible. Use this prompt shape:
Use case: infographic-diagram
Asset type: visual similarity verdict
Primary request: Evaluate the single provided comparison image. The left half is labeled TARGET MOCK and the right half is labeled CURRENT IMPLEMENTATION.
Composition/framing: Keep the comparison visible. Add a verdict badge at the top: either "VERY SIMILAR - few feel differences" if the implementation reads as the same UI with only minor feel differences, or "NOT THERE YET" if meaningful implementation differences remain. Add at most 4 short callouts for remaining differences.
Criteria to judge: overall layout proportions, header placement and scale, canvas size and position, side panel sizing, asset scale, spacing/density, color palette/visual language, and controls.
Constraints: Use only the provided comparison image. Do not compare against earlier screenshots. Do not invent features. Do not redesign the UI.
If imagegen says NOT THERE YET, implement the callouts directly. If the callouts are vague, translate them into measurable CSS/layout changes before editing.
Prioritize changes in this order:
Use the existing frontend stack and design system. If the mock uses real bitmap artwork, use or generate bitmap assets. Do not recreate complex illustrations with CSS or SVG unless the user explicitly asks for code-native art.
For mock-like UI assets, prefer generated or cropped bitmap assets over CSS art.
If an asset needs transparency:
#00ff00, #ff00ff, or
#0000ff) with no shadow, gradient, checkerboard, or texture.python3 "$HOME/.codex/skills/.system/imagegen/scripts/remove_chroma_key.py" \
--input source.png \
--out asset.png \
--key-color '#00ff00' \
--soft-matte \
--transparent-threshold 12 \
--opaque-threshold 220 \
--despill \
--force
convert source.png -alpha set -fuzz 32% -transparent '#00ff00' asset.png
convert asset.png -background '#ff00ff' -alpha remove -alpha off /tmp/check-magenta.png
convert asset.png -background '#2f80ff' -alpha remove -alpha off /tmp/check-blue.png
Do not accept a fake checkerboard background as transparency.
Before declaring done, verify with real artifacts:
If the imagegen verdict says "VERY SIMILAR - few feel differences", you may stop after reporting the exact screenshot/comparison paths and verification commands.
development
Review a git diff, branch, or pull request for newly introduced, high-confidence security vulnerabilities. Use when the user asks for a security review, PR security pass, AppSec triage, exploitability check, or a low-noise audit of changed code, workflows, auth, input handling, secrets, or trust-boundary changes.
documentation
Transform boring, flat README files into polished, visually compelling project pages. Use when the user asks to improve, redesign, or make a README more interesting. Covers structure, copy, badges, banner images, and overall presentation. Produces GitHub-flavored Markdown that renders well on GitHub, npm, and similar platforms.
tools
Create, edit, debug, or review Charmbracelet VHS terminal demo recordings and .tape files. Use when the task involves terminal GIFs/videos, VHS scripts, demo cassettes, CLI screencasts, reproducible terminal recordings, or converting terminal interactions into renderable tape files.
tools
Use when the user asks you to gather requirements, or when the request is vague and needs clarity before acting.