agentleFS
ishwar-iyer12ishwar-iyer12/design-toolkit/skills/image-to-code/SKILL.md

image-to-code

Skill0 starsChanged 45 days agoMITView on GitHub

Turn a screenshot or mockup into code that matches it. Use when given an image of a UI and asked to build, rebuild or match it. Measures first, then writes, then records every divergence from the source.

85 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use stitch-design-taste, brandkit and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • HK-hubSkill

    stitch-design-taste

    Semantic Design System Skill for Google Stitch. Generates agent-friendly DESIGN.md files that enforce premium, anti-generic UI standards — strict typography, calibrated color, asymmetric layouts, perpetual micro-motion, and hardware-accelerated performance.

    Also in 54 projects that use this

  • AnasX7Skill

    brandkit

    Premium brand-kit image generation skill for creating high-end brand-guidelines boards, logo systems, identity decks, and visual-world presentations. Trained for minimalist, cinematic, editorial, dark-tech, luxury, cultural, security, gaming, developer-tool, and consumer-app brand systems. Optimized for intentional logo concepting, refined composition, sparse typography, strong symbolic meaning, premium mockups, art-directed imagery, and flexible grid layouts.

    Also in 61 projects that use this

  • AnasX7Skill

    imagegen-frontend-web

    Elite frontend image-direction skill for generating premium, conversion-aware website design references. CRITICAL OUTPUT RULE — generate ONE separate horizontal image FOR EVERY section. A landing page with 8 sections produces 8 images. Never compress multiple sections into one image. Enforces composition variety (not always left-text / right-image), background-image freedom, varied CTAs, varied hero scales (giant / mid / mini minimalist), narrative concept spine, second-read moments, and a single consistent palette across all images. Optimized for landing pages, marketing sites, and product comps that developers or coding models can accurately recreate.

    Also in 53 projects that use this

  • HK-hubSkill

    design-taste-frontend-v1

    The original v1 taste-skill, preserved for projects depending on its exact behavior. The current default is `design-taste-frontend` (v2 experimental), which is a substantial rewrite. Use this v1 install name only if you need exact backward compatibility.

    Also in 29 projects that use this

  • hjdspaceSkill

    flutter-setup-declarative-routing

    Configure `MaterialApp.router` using a package like `go_router` for advanced URL-based navigation. Use when developing web applications or mobile apps that require specific deep linking and browser history support.

    Also in 3 projects that use this

  • +7 more from AnasX7

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 13 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 82 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not write code yet. Look at the image and write down:

    line 12
  2. Distinctive:

    If the image is too small or too compressed to measure, say so and ask for a better one.

    line 19
  3. Distinctive:

    Write the measured values down as a spacing scale.

    line 34
  4. Distinctive:

    Check vertical rhythm: distance from heading to body, body to action, section to section.

    line 35
  5. Distinctive:

    Check alignment: which edges line up across regions?

    line 36
  6. Distinctive:

    Check radii, border widths and icon sizes the same way.

    line 37
  7. Distinctive:

    Use semantic elements. A screenshot cannot show them, so infer: nav, main, headings in order, buttons versus links.

    line 41
  8. Distinctive:

    Use the real text from the image, exactly.

    line 42
  9. Distinctive:

    Add the states the image cannot show: hover, focus-visible, pressed, disabled, empty, error.

    line 43
  10. Distinctive:

    Put a comment block at the top of the output with a divergence table.

    line 49
  11. Distinctive:

    If you changed it, it has a row.

    line 68
  12. Distinctive:

    If there are no divergences, write "None found" and list what you checked.

    line 71
  13. Distinctive:

    Never fix the source design without a row.

    line 72

“Common” is measured: kept by at least 6 in 10 of the 82 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Image to code

The goal is fidelity. You are reproducing a design someone already made, not improving it. Save opinions for the divergence table.

1. Measure before writing

Do not write code yet. Look at the image and write down:

  • Canvas: the image width and height in pixels, and the likely device scale (1x, 2x, 3x). Divide by the scale to get CSS pixels.
  • Grid: the content width, the number of columns, the gutter, the outer margins.
  • Regions: header, nav, main, sidebars, footer, with the size of each.
  • Repeated elements: measure one, then check two others. Differences are information.

If the image is too small or too compressed to measure, say so and ask for a better one. Do not guess quietly.

2. Extract the palette and type sizes first

Palette. List every distinct colour with its hex value and its job: page, surface, border, text, muted text, accent, status. Sample from flat areas, away from antialiased edges. Merge values that differ by compression noise. Expect fewer than twelve.

Type. List every distinct text size with its weight, line height and letter spacing. Measure cap height or x-height and convert; do not estimate from "looks like 16". Name the typeface if you can identify it. If you cannot, say what you chose in its place and why.

Turn both lists into variables before any component code exists. If the project has tokens already, map each measured value to the nearest token and record the difference.

3. Reproduce spacing, not just layout

Getting the boxes in the right order is the easy half. The spacing is what makes it look like the source.

  • Measure the padding inside every container and the gaps between siblings.
  • Write the measured values down as a spacing scale. Most designs use five to eight values.
  • Check vertical rhythm: distance from heading to body, body to action, section to section.
  • Check alignment: which edges line up across regions? Reproduce the shared edges.
  • Check radii, border widths and icon sizes the same way.

4. Build

  • Use semantic elements. A screenshot cannot show them, so infer: nav, main, headings in order, buttons versus links.
  • Use the real text from the image, exactly. Mark any text you could not read.
  • Add the states the image cannot show: hover, focus-visible, pressed, disabled, empty, error. Derive them from the palette you extracted, and list them as additions.
  • Images and icons you do not have become labelled placeholders with the measured size. Do not substitute a stock icon and call it done.
  • Pick breakpoints only where you have evidence. For widths you were not shown, keep the proportions and say so.

5. Record every divergence

Put a comment block at the top of the output with a divergence table. One row for each place the code differs from the source, however small.

/*
DESIGN DIVERGENCE
Source: checkout-mockup.png (2880 x 1800 at 2x, so 1440 x 900 CSS px)

| Element         | Source value       | Implemented value    | Reason                                   |
| --------------- | ------------------ | -------------------- | ---------------------------------------- |
| Body text       | #8a8a8a on #ffffff | #6b6b6b on #ffffff   | Source is 3.45:1, below the 4.5:1 floor  |
| Card padding    | 22px               | 24px                 | Snapped to the project 4px grid          |
| Heading font    | Unidentified serif | Source Serif 4       | Could not identify; closest open match   |
| Promo code link | No focus state     | 2px outline, offset 2| State not shown in source; added         |
| Footer          | Cropped in image   | Not implemented      | Not enough of it visible to measure      |
*/

Rules for the table:

  • If you changed it, it has a row. "Close enough" is a divergence.
  • The reason names the cause: accessibility, a project token, missing information, a technical limit.
  • Things you added that the source does not show are divergences too.
  • If there are no divergences, write "None found" and list what you checked.
  • Never fix the source design without a row. The designer may have meant it.

6. Compare

Render the result at the source size and compare region by region. If you can take a screenshot, overlay it on the source. Fix what differs, or add a row.

Then tell the person the three largest divergences in plain words, so they do not have to read the table to find out.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.