image-to-code · plugin87 — Claude Code skill: what it does, how to install
Reconstructs UI mockups and screenshots into token-driven accessible code with automated WCAG AA contrast validation.
npx skills add plugin87/ux-ui-agent-skills --skill image-to-code -a claude-codeWhat image-to-code does
This skill reads reference screenshots to infer structural styling rather than doing pixel-perfect copying. It extracts color palettes, typography scales, spacing density, corner radiuses, and layout archetypes. Instead of inline styles, it translates these choices into a 3-tier DTCG token architecture that generates a single theme.css.
Components are assembled with Lucide icons, full accessibility support, and all eight interactive states. The workflow evaluates every color combination with contrast.py and validate_contrast.py across light and dark modes. If a brand hue fails AA contrast, it gets corrected immediately.
Without the root kit files, this skill halts. A standard npx skills add setup grabs just the skill directory, so running npx ux-ui-agent-skills init is necessary to supply the required tokens directory and audit scripts.
What it helps with
- extract design tokens and palettes from mockups
- generate DTCG-compliant theme.css files
- verify color pairs against WCAG AA standards
- rebuild UI layouts without hardcoded styles or emojis
Example prompts for the agent
- Reconstruct the interface from screen-reference.png using tokenized styles.
- Inspect this card screenshot, build the theme.css tokens, and run contrast checks.
How to install image-to-code
1Skills CLI (Vercel)
npx skills add plugin87/ux-ui-agent-skills --skill image-to-code -a claude-code2Manually: put the files in place
~/.claude/skills/image-to-code/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/image-to-code/
1Skills CLI (Vercel)
npx skills add plugin87/ux-ui-agent-skills --skill image-to-code -a codex2Manually: put the files in place
.agents/skills/image-to-code/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add plugin87/ux-ui-agent-skills --skill image-to-code -a cursor2Manually: put the files in place
.cursor/skills/image-to-code/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install plugin87/ux-ui-agent-skills image-to-code2Manually: put the files in place
.github/skills/image-to-code/SKILL.md1Skills CLI (Vercel)
npx skills add plugin87/ux-ui-agent-skills --skill image-to-code -a gemini-cli2Platform CLI
gemini skills install https://github.com/plugin87/ux-ui-agent-skills --path .claude/skills/image-to-codeManually: put the files in place
.devin/skills/image-to-code/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add plugin87/ux-ui-agent-skills --skill image-to-code -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about image-to-code
How to install image-to-code in Claude Code?
Run npx skills add plugin87/ux-ui-agent-skills --skill image-to-code -a claude-code. To install the required tokens and verification scripts, also execute npx ux-ui-agent-skills init.
What does image-to-code do?
It translates screenshots into token-based UI components. It samples colors, spacing, and typography to generate a coherent design system instead of a static one-off template.
What causes the KIT_MISSING error?
The skill expects the repository's tokens folder and Python validation scripts to exist. If only the skill folder was installed, run npx ux-ui-agent-skills init to supply the missing assets.
Source text
SKILL.md · MIT
---
name: image-to-code
description: Turn a reference image, screenshot, or mockup into token-driven, accessible code. Infer the design system from the reference (palette, type scale, spacing, radius, layout archetype), map it to the 3-tier tokens, rebuild it, then verify with the kit's gates. Use when the user provides a design/screenshot and wants matching UI code.
# `invocation:` was not a field Claude Code reads - unknown frontmatter keys are
# ignored without an error, so these six were auto-invocable the whole time they
# were marked user-only. This is the field that actually does it.
disable-model-invocation: true
---
# Skill: Image to Code
> **Step 0: is the kit here?** This skill reads files from the kit. Check once:
> `ls ${CLAUDE_SKILL_DIR}/../../../tokens >/dev/null 2>&1 && echo KIT_OK || echo KIT_MISSING`
> On `KIT_MISSING` only the skill folders were installed, which is what
> `npx skills add` does. Say so plainly, point the user at
> `npx ux-ui-agent-skills init` or the plugin install, and stop. Do not guess the
> contents of a file you could not open.
Reconstruct a design from a visual reference as a real design system, not a one-off copy. Match the *system* (color/type/spacing language), never lift copyrighted imagery or brand assets.
## Steps
1. **Read the reference like a designer.** Infer and write down:
- **Palette**: 1 dominant surface family, text colors, 1 primary action + at most 1 accent (sample the hues; don't guess random hex).
- **Type**: family feel (geometric/grotesk/serif), the scale jumps, display vs. body contrast, weights.
- **Spacing & density**: base unit, section rhythm, card padding; airy vs. compact.
- **Radius & depth**: radius language (sharp/soft/pill), shadow vs. hairline separation.
- **Layout archetype + sequence**: bounded hero / asymmetric split / dense bento / editorial stack (`${CLAUDE_SKILL_DIR}/../../../taste/design-taste.md` → Variance Mandate).
2. **Anchor to a known system** if it's close: browse `${CLAUDE_SKILL_DIR}/../../../taste/aesthetic-systems.md` / `python3 ${CLAUDE_SKILL_DIR}/../../../scripts/design_systems.py search <term>` and adopt that recipe to stabilize decisions.
3. **Build the token theme** from the inferred values → 3-tier DTCG (`design-tokens` skill); generate a single `theme.css`. Verify every color pair with `${CLAUDE_SKILL_DIR}/../../../scripts/contrast.py` / `${CLAUDE_SKILL_DIR}/../../../scripts/validate_contrast.py` (light + dark). A sampled brand color that fails AA gets adjusted; taste never overrides POUR.
4. **Rebuild layout + components** token-driven via `${CLAUDE_SKILL_DIR}/../../../frameworks/adapter-protocol.md` + `${CLAUDE_SKILL_DIR}/../../../components/*`: one shared primitive layer, all 8 states, a11y wired, no emoji (lucide), single theme. Apply taste (`design-taste.md`) so it doesn't regress to generic.
5. **Verify against the reference**: render and screenshot it, compare side-by-side to the reference; run `node ${CLAUDE_SKILL_DIR}/../../../scripts/gate.mjs measure_render.mjs`, `lint_hardcodes.py`, `taste_audit.mjs`, and `npm run verify`.
## Verification (definition of done)
- `npm run verify` is 100% (tokens resolve, contrast AA light+dark, no hardcodes/emoji, real-render WCAG).
- The rebuilt UI uses ONE inferred token theme; no per-section palettes.
- A screenshot of the result visibly matches the reference's design language.
> Honest limit: this matches the design **system**, not a pixel-perfect copy. Do not reproduce the reference's photographs, logos, or copyrighted copy. Substitute your own or generic placeholders.
© plugin87 · MIT · plugin87/ux-ui-agent-skills
Similar skills
Everything for Frontend and UI →image-to-code by other authors comes first.