Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add plugin87/ux-ui-agent-skills --skill image-to-code -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/image-to-code/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/image-to-code/

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.

image-to-code nexu-io A skill for visually important web tasks. It generates design images first, analyzes them, then builds frontend to match the references. CX Codex +1 1,800installs image-to-code official OpenAI Translates screenshots, mockups, and AI images into responsive frontend code. Helpful for turning visual concepts into functional web prototypes. CX Codex GP ChatGPT 14installs generate-ui-from-brand dembrandt Turns a site URL or a DESIGN.md file into design tokens, UX decisions and a UI spec you can paste into a project. CX Codex +1 870installs pulse typeui.sh Provides rules for the vibrant Pulse design system with 4px borders, orange color tokens, and Limelight typography. Generates component specs and checks WCAG 2.2 AA criteria. CX Codex +1 2,000installs editorial typeui.sh A skill that turns your agent into an editorial design-system author: serif type scale, 8pt grid, color tokens, component states and accessibility checks. CX Codex +1 2,700installs ui-ux-polish oakoss A skill that runs repeated polish passes on a working web app, treating desktop and mobile separately and checking accessibility along the way. CX Codex +1 539installs image-first-grid-layout MengTo Directs coding agents to build layout grids around full-bleed photography with subtle guide rails and low-contrast overlays. Great for cinematic landing pages. CX Codex +1 1,400installs ux-designer szilu A skill for reviewing and building interfaces: it checks accessibility, screen states and microcopy, and supplies the numbers for spacing and contrast. CX Codex +1 1,600installs

From the same set16

design-review The skill scores a screen or flow across six weighted dimensions, runs Nielsen's heuristics and returns a prioritized findings table. CX Codex +1 594installs a11y-audit Audits UI and design against WCAG 2.2 and ARIA patterns. It checks contrast, keyboard navigation, and screen-reader readiness with concrete severity ratings. CX Codex +1 550installs design-tokens Create, extend, and validate DTCG design tokens with a three-tier structure. Useful for palettes, typography, theming, and other interface values. CX Codex +1 538installs redesign This skill audits an existing interface and revises its design while preserving working features. Use it to refresh a website or app without changing its core behavior. CX Codex +1 535installs apply-aesthetic Picks a visual direction — an archetype or a named design system — and resolves it into your project's tokens. Useful when you want a specific look, not whatever the agent improvises. CX Codex +1 529installs design-code This skill generates component and screen code for a requested framework. Use it when you need token-based UI with accessibility checks. CX Codex +1 525installs design-component Produces UI component specifications covering anatomy, 8 interactive states, tokens, and accessibility. Useful when designing components in a design system before coding. CX Codex +1 522installs ux-writing Write or review interface text, from button labels to errors and empty states. The skill applies a project’s voice and checks copy against a pre-ship checklist. CX Codex +1 517installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor