CommunityImagegithub.com

screenshot-to-compose

Turn app design screenshots (JPG/PNG, often AI-generated) or Figma frames into a native Kotlin Jetpack Compose UI that matches them, design-first. Measures pixels and colours (px to dp), writes screen/asset inventories and a design system with observed vs inferred values, builds Iconify icons into VectorDrawables, generates artwork instead of cropping the screenshots, implements MVI screens, then compares emulator or Roborazzi renders against the reference. Use whenever the user supplies screenshots, mockups or a design repository and wants them built as an Android Compose app, says "make this screen in Compose", "match the design", "px to dp", "screenshot to code", or wants a whole app UI built design-first, even if they never say "Compose".

What is screenshot-to-compose?

screenshot-to-compose is a Claude Code agent skill that turn app design screenshots (JPG/PNG, often AI-generated) or Figma frames into a native Kotlin Jetpack Compose UI that matches them, design-first. Measures pixels and colours (px to dp), writes screen/asset inventories and a design system with observed vs inferred values, builds Iconify icons into VectorDrawables, generates artwork instead of cropping the screenshots, implements MVI screens, then compares emulator or Roborazzi renders against the reference. Use whenever the user supplies screenshots, mockups or a design repository and wants them built as an Android Compose app, says "make this screen in Compose", "match the design", "px to dp", "screenshot to code", or wants a whole app UI built design-first, even if they never say "Compose".

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/zohaibmushwani/agent-skills/tree/HEAD/skills/screenshot-to-compose

Installed? Explore more Image skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

What does screenshot-to-compose do?

Reproduce a design faithfully in Compose without eyeballing it. The reference image is the acceptance test, so every number you use is either observed (measured on the image) or inferred (a guess you state), and the finished screen is compared with the reference at the end.

When the design is the input

  • Screenshots/mockups only: follow all phases below.
  • Figma frames available: skip measuring (read values from Figma) and keep the rest.
  • No design yet: use the app-design-studio skill first, then come back here.

Workflow

Work in files (docs/design/), one screen at a time after the shared foundations exist. Do not implement anything until the whole screen inventory is understood.

  1. Inspect. Read the repo first (architecture, theme, shared components, existing screens). Preserve what works. Note assumptions.
  2. Inventory. Copy the references unchanged into docs/design/reference/ (kebab-case names). Write SCREEN_INVENTORY.md: each image -> screen + state, links between screens, missing references (a screen linked but not shown), pixel size and aspect ratio. Include every state: loading, empty, error, offline, permission, premium.
  3. Measure. Run scripts/measure_image.py shot.png --frame-dp 390 --sample x,y ... for the px->dp scale and colour samples (references/measuring.md). Pixels are not dp: assume a 390 dp frame unless told otherwise, dp = px / (imageWidthPx / 390). Record observed and inferred values in separate columns.
  4. Design system. Map measured colours to Material 3 roles, type scale, shapes, spacing in the theme. Screens use only theme tokens (no hex, sizes or radii in screens). Define light and dark; if only light exists, derive dark without changing layout.
  5. Assets (references/assets.md). Icons: one family, fetched from Iconify, converted with scripts/svg_to_vectordrawable.py. Artwork: generate it, never crop it out of the screenshots. Text, buttons, cards, rings and charts are always Compose, never images. Log source, licence, model and prompt in ASSET_INVENTORY.md.
  6. Plan. Per screen decide up front: back behaviour, network/offline class, permissions, scroll-or-fit on small phones, motion. Write SCREEN_IMPLEMENTATION_PLAN.md with build order. (Quality rules for these live in the android-compose-quality-gate skill.)
  7. Implement shared foundations first, then screens: stateless composables over an immutable UI state, ViewModel with intents, one composable per file, string resources for all text. Parallelise only independent modules with disjoint files. Read references/compose-lessons.md before building cards, tiles or tight text.
  8. Compare (references/verification.md). Render the screen (emulator screenshot or Roborazzi), put it beside the reference at equal width with scripts/compare_side_by_side.py, list differences in layout, spacing, type, colour, shapes and assets, fix, repeat. Then check small devices (360 x 526 dp), long text/German, RTL, dark, font scale 1.3. Never trade function or responsiveness for pixel match.
  9. Deliver. Keep references, assets with prompts, icon sources/licences, inventories and comparison notes current. A screen is done only when it works and passes the visual comparison. Commit per topic.

Rules that stop the usual failures

  • Never crop images out of reference screenshots (low-res, compressed, UI baked in).
  • Never replace native UI with a picture of it.
  • Never invent a design when the reference is ambiguous: make the most reasonable inference, write it in the inferred column, stay close to the reference.
  • Do not claim a screen is done before it ran and was compared.
  • No secrets (API keys) in the repo or docs; image-service keys come from the environment.

Files

  • references/measuring.md - px to dp, colour sampling, observed vs inferred tables.
  • references/assets.md - Iconify to VectorDrawable, image generation order and review, export sizes, other sources.
  • references/compose-lessons.md - defects that cost real time: sibling card ratios, intrinsic measurement crash, width thresholds, auto-sizing text.
  • references/verification.md - emulator vs Roborazzi comparison loop and the device matrix.
  • scripts/measure_image.py, scripts/svg_to_vectordrawable.py, scripts/compare_side_by_side.py (Python 3 + Pillow).

Individual skills in this repo

This repo contains 2 individual skills — each has its own dedicated page.

app-design-studio

Turn an app name or a website / web-app idea into a complete high-fidelity UI design repository - pages or screens, every state (loading, empty, error, offline), dialogs, sheets, components, interactions - with a locked design system and measurable usability gates. Three targets, each with its own profile and wording - mobile app (portrait screens: splash, onboarding, auth, home, settings), website (landscape desktop pages plus a narrow responsive layout), web app / portal / dashboard. Use whenever the user gives an app name or idea and wants screens, pages, UI design, a design repo, mockups, a screen inventory, or a design to hand to developers/designers, even if they never say "skill" or "Figma". Also use to audit or fix an existing set of generated screens for usability (contrast, targets, states) while keeping them beautiful.

store-screenshots

Create App Store and Google Play marketing screenshot sets that look like top-chart apps - a headline-led story of 5-8 frames with a poster-style first frame, zoomed real UI fragments, a dominant brand colour, panoramic links between frames, social proof and human touches - generated frame by frame with Codex (GPT Image) using the app's real screens as reference images, text-checked and edit-passed, then fitted to the exact store sizes. Use whenever the user wants store screenshots, "App Store screenshots", "Play Store images", listing graphics, a screenshot redesign or "before/after" for a store page, or wants their app's store page to convert better, even if they only say "screenshots" for an app. Takes real app screens (for example from app-design-studio) as input.

Related Skills