agentleFS
AiatullaAiatulla/agent-kit/skills/image-scanner/SKILL.md

image-scanner

Skill2 starsChanged 46 days agoMITView on GitHub

Scan one or more design screenshots/mockups and reproduce them as working code. Use this skill whenever the user provides images of a UI (website, mobile app, desktop app, component, landing page, screen, mockup, wireframe, Figma export, or any visual interface) and wants code that looks like it, is inspired by it, or uses it as a starting point. Triggers include: "build this", "recreate this", "make something like this", "clone this UI", "create a component from this image", "build a page like this", "turn this screenshot into code", "use this as reference", or any message that contains an image alongside a build/create/design request. Works across all AI assistants (Claude, GPT, Gemini, etc.) and all platform targets (web, iOS, Android, React Native, Flutter, desktop Electron/Tauri, etc.).

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 6 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before writing a single line of code, ask these two questions together in one message:

    line 23
  2. Very specific:

    If the user is in Mode 2 or 3, extract the following from their provided doc/tokens/description before coding.

    line 102
  3. Distinctive:

    Ask (or infer from context) which fidelity level the user wants:

    line 123
  4. Distinctive:

    Default to Faithful if not specified.

    line 131
  5. Very specific:

    Read the relevant section from references/platforms.md before writing code.

    line 158
  6. Very specific:

    Web (HTML/CSS/JS): Use CSS custom properties for all colors/radii/spacing.

    line 160
  7. Very specific:

    React Native: Use StyleSheet.create(). flex layout only (no CSS grid/float).

    line 162
  8. Distinctive:

    Electron/Tauri: Treat as web; use the specified web stack.

    line 166
  9. Distinctive:

    Scan once, generate from the scan: Don't re-describe the image while generating code — the scan report anchors everything.

    line 185
  10. Very specific:

    Skip responsive code if not needed: If the user said no to breakpoints, don't generate @media queries.

    line 189
  11. Distinctive:

    When in doubt, the scan report format is the universal bridge — it converts visual information into a compact text representation any model …

    line 203

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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 Scanner — UI-to-Code Skill

You are acting as a senior UI engineer and design-faithful code generator. The user has provided one or more reference images and wants working code that matches, resembles, or is inspired by those designs.


Step 0 — Ask Two Blocking Questions (do this before anything else)

Before writing a single line of code, ask these two questions together in one message:

Question 1 — Color Mode

Which color mode should I use?

  Mode 1 — Match the image exactly
    Use the exact colors, fonts, spacing, and visual style from the screenshot.
    Good for: cloning, pixel-faithful reproductions, studying someone else's design.

  Mode 2 — Use my own brand/style
    Keep the layout and structure from the image, but apply your own colors,
    fonts, and copy. You'll provide a brand doc, design tokens, or describe
    your style directly.
    Good for: building inspired-by components with your own identity.

  Mode 3 — Reskin (layout only)
    Borrow the layout skeleton and UX patterns only. Everything visual
    (colors, fonts, copy, imagery) will be yours from scratch.
    Good for: using the image purely as a structural reference.

Question 2 — Platform & Tech Stack

What platform and tech stack should I target?

  Web         → HTML/CSS/JS  |  React/JSX  |  Vue  |  Svelte
  Mobile      → React Native  |  Flutter (Dart)  |  SwiftUI  |  Jetpack Compose (Kotlin)
  Desktop     → Electron (React/HTML)  |  Tauri  |  WPF  |  SwiftUI macOS

  (If you're unsure, just tell me what framework your project uses and I'll figure it out.)

Also ask: "Do you need responsive / adaptive breakpoints?" (yes / no / mobile-first)

Why block here? These choices affect every decision downstream — color extraction, unit system (px vs pt vs dp), component structure, and styling approach. Getting them wrong means throwing away the first pass entirely.


Step 1 — Structured Image Scan

Once you have the answers, analyze the image(s) systematically before generating code. Produce a compact scan report in this format — it anchors the generation and replaces re-reading the image mid-build:

SCAN REPORT
───────────────────────────────────────────────
Layout Type     : [single-column / sidebar+content / grid / stacked / tabbed / split-screen / etc.]
Platform Hint   : [what platform does this look designed for — web, iOS, Android, desktop?]

Sections        : [ordered list, e.g. navbar → hero → features×3 → testimonial → footer]
Components      : [compact inventory, e.g. avatar, card×4, modal, toast, data-table, nav-item×5]

Typography      : [heading style — weight/size/style, body style, any distinctive font personality]
Spacing Rhythm  : [tight / balanced / generous, any notable gutters or padding patterns]
Border Radius   : [sharp / subtle / pill-heavy]
Shadow Usage    : [none / subtle / dramatic]
Motion Hints    : [any states that imply animation — hover, open/close, loading]

Color Palette (Mode 1 only):
  Background    : #______
  Surface       : #______
  Primary       : #______
  Accent        : #______
  Text Main     : #______
  Text Muted    : #______
  Border        : #______

Interactive States Visible : [any hover, active, disabled, focused states shown?]
Responsive Clues           : [any grid collapses, stacked mobile layout, hamburger menus visible?]
Ambiguous Areas            : [list anything unclear from the image that needs an assumption]
───────────────────────────────────────────────

State your assumptions clearly for any ambiguous areas. This is the checkpoint — if the user wants to correct your reading before you build, they can do it here with minimal cost.


Step 2 — Brand/Style Extraction (Mode 2 & 3 only)

If the user is in Mode 2 or 3, extract the following from their provided doc/tokens/description before coding. If they haven't provided anything yet, ask for one of:

  • A design tokens file (JSON, CSS variables, Tailwind config)
  • A brand doc (PDF, markdown, any format)
  • A quick written description: primary color, font, border-radius style, spacing feel

Extract and confirm:

BRAND TOKENS
  Primary color   : 
  Accent color    : 
  Background      : 
  Font family     : 
  Border radius   : 
  Spacing unit    : 
  Existing component naming conventions (if any) : 

Step 3 — Fidelity Declaration

Ask (or infer from context) which fidelity level the user wants:

LevelWhat it meansWhen to use
Pixel-perfectExact spacing, shadow values, precise color matches, all micro-detailsCloning / design handoff
FaithfulSame layout and visual hierarchy, cleaner code, minor simplifications OKMost builds
InspiredLayout and UX pattern only; aesthetic interpreted freelyRapid prototyping, early exploration

Default to Faithful if not specified.


Step 4 — Generation Strategy

Choose the right generation approach based on scope:

Single component (a card, navbar, modal, button group, etc.) → Generate in one pass. Include all visible states.

Full page or screen → Generate section by section, each clearly delimited:

/* ═══════════════════════════════════════
   SECTION: Hero
   ═══════════════════════════════════════ */

This lets the user review and redirect between sections rather than reviewing 400 lines at once.

Multi-screen flow (e.g. 3 app screens provided) → Ask if they want all screens in one file or separate files per screen.


Step 5 — Platform-Specific Output Rules

Read the relevant section from references/platforms.md before writing code. Key principles:

  • Web (HTML/CSS/JS): Use CSS custom properties for all colors/radii/spacing. Single file unless asked otherwise. Semantic HTML. No frameworks unless specified.
  • Web (React/JSX): Functional components with hooks. CSS Modules or inline styles unless Tailwind is confirmed. Props-driven where visual variants are visible.
  • React Native: Use StyleSheet.create(). flex layout only (no CSS grid/float). Platform-specific shadows (elevation for Android, shadowColor for iOS). dp units (no px).
  • Flutter: Dart with Widget tree. ThemeData for colors/typography. Column/Row/Stack for layout. Named const constructors where possible.
  • SwiftUI: Declarative view structs. @State/@Binding for interactive states. Use Color("name") or .hex() extensions for colors.
  • Jetpack Compose: @Composable functions. Material3 components where they match. dp/sp units.
  • Electron/Tauri: Treat as web; use the specified web stack.

Step 6 — Output Format

Always deliver:

  1. The code — formatted, commented at section boundaries, no placeholder TODOs unless the user's fidelity is "inspired"
  2. Assumptions made — brief list of any design decisions you couldn't determine from the image
  3. What's not included — explicitly call out anything visible in the image that was intentionally omitted (e.g. "The chart inside the card uses dummy data — connect to your real data source")
  4. Next steps — 2–3 concrete suggestions for what to build or refine next

Token Efficiency Rules

These rules exist to keep generation fast and cost-effective without sacrificing quality:

  • Scan once, generate from the scan. Don't re-describe the image while generating code — the scan report anchors everything.
  • Compact component inventory over prose. card×3, badge, avatar, CTA-button not "there are three cards each with an avatar and a badge..."
  • No filler commentary. Skip lines like "Great question!" or "Now I'll build the hero section for you." Just build it.
  • Inline token maps. For Mode 1, embed the color/spacing tokens as CSS variables at the top of the file rather than repeating hex values throughout.
  • Skip responsive code if not needed. If the user said no to breakpoints, don't generate @media queries.
  • Section-by-section for pages prevents regenerating the whole file when one section needs a fix.

AI Compatibility Notes

This skill is written to work well across all major AI assistants. Some notes:

  • Claude: Full image vision support. Can handle multi-image scans in one turn.
  • GPT-4o / GPT-4 Vision: Full image support. For long pages, split into multiple messages if context feels tight.
  • Gemini 1.5+ Pro/Flash: Full image support. Works best when the scan report step is explicit.
  • Older models without vision: Have the user describe the layout in text; use the scan report format as a structured prompt instead.

When in doubt, the scan report format is the universal bridge — it converts visual information into a compact text representation any model can generate from.


Quick Reference — Mode Summary

Mode 1Mode 2Mode 3
Colors fromImageYour brandYour brand
Layout fromImageImageImage
Copy/ContentImageYoursYours
Fonts fromImage (best guess)Your brandYour brand
Good forCloningBrand-aligned buildLayout inspiration only

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.