/dev-flow:screenshot-to-pagefrom dev-flow
Generates a working page route and components from a UI screenshot, applying the project's DESIGN.md tokens and existing UI library (shadcn, Base UI, MUI, or Coss). Iterates render-screenshot-diff-fix until visual delta is below threshold. For use after app scaffolding is complete.
Ships in dev-flow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
This skill takes one screenshot and one route-name from the user, and produces a working page in the existing scaffolded app. The route renders close to the visual reference, uses only components and tokens already defined by the project's design system, and is reachable in pnpm dev.
Pixel-perfect on what's reproducible: layout, typography, color, spacing, radii, component states. The skill iterates render → screenshot → pixel-diff → fix until the visual delta is below threshold (default <2% off-tokens).
Placeholder, with explicit flag, on what isn't: photography, illustration, custom illustrations, brand-licensed imagery. These are static raster contents that no skill can synthesize from a screenshot alone.
Componentized aggressively: the skill detects repeated visual patterns in the screenshot (3 cards with the same structure, 4 nav links, a list of testimonials, ...) and extracts each pattern into a reusable component before writing JSX. The page file ends up short and readable; the heavy lifting is in components/<PageName>/.
<project-root>/ exists (phase >= scaffolded)..workflow/screenshots/ contains at least one image..workflow/DESIGN.md exists with valid tokens./, /pricing, /dashboard, etc.) or points at a specific screenshot.This skill follows the dev-flow contract — see references/contracts.md. Key facts:
<root>/.workflow/screenshots/<filename>, <root>/.workflow/DESIGN.md, <root>/.workflow/meta.json#stack.<project-root>/app/<route>/page.tsx<project-root>/src/router.tsx (or whatever the scaffold uses) plus a component file <project-root>/src/pages/<Route>.tsx.<project-root>/src/pages/<route>.astro.phase = "page_generated" (only if current phase is earlier in the enum).If the user named a screenshot, use it. Otherwise list .workflow/screenshots/*.png and ask which one.
Ask for the route name (e.g., /, /journal, /pricing). Validate: must start with /, must be a valid URL path, must not collide with an existing route in <project-root>/. If there's a collision, ask: replace, or pick a different route.
Use vision to inspect the screenshot. Identify, in this order:
Don't try to count pixels. Estimate, sanity-check against the design tokens.
Before writing any JSX, scan the screenshot for repeated visual patterns. The output of this step is a small plan, not code.
For each section identified in Step 2, ask: "is there a sub-element that appears 2 or more times with the same structure?" Common patterns:
<FeatureCard>, <ArticleCard>, etc.<NavLink> and map over an array.<PriceColumn>.<TestimonialCard> / <LogoCloud> / <StatCard>.<FormRow>.<MenuItem>.For each detected pattern, decide:
ArticleCard not RoundedBox).app/<route>/<ComponentName>.tsx for one-shot use or components/<ComponentName>.tsx if the pattern is likely reusable across pages.Don't over-componentize singletons. A unique hero section is fine inline in page.tsx. Extract only when there's reuse (the same shape ≥2 times) or when the section is over ~80 lines of JSX (readability).
State the plan to the user briefly: "Estraggo ArticleCard (4 occorrenze nella griglia 'Latest articles') e NavLink (5 occorrenze nell'header). Hero, footer, e signup-form restano inline. Procedo?" The user can override before any code is written.
Read .workflow/meta.json#stack.ui to know which UI library the project already uses — don't guess or mix libraries into an existing app.
For each component you identified in Step 2, decide:
stack.ui:
"shadcn" — copy-pasted source in components/ui/ (e.g. Button, Card). Import from @/components/ui/<name>."mui" — runtime-themed components from @mui/material (e.g. Card, Stack)."base-ui" (standalone Base UI, no shadcn CLI, no components/ui/ folder) — import headless primitives directly from @base-ui/react (e.g. @base-ui/react/dialog; the package was renamed from @base-ui-components/react, which npm marks deprecated) and style them with the project's Tailwind classes/tokens. There is no pre-styled component to fetch — the styling is part of what you write."coss" — primitives live in components/ui/ just like shadcn, but originate from the @coss/* registry (Cal.com design system on Base UI). Treat them exactly like shadcn primitives for import purposes (@/components/ui/<name>); if a needed component/particle hasn't been pulled into components/ui/ yet, hand off to the coss-ui skill to fetch it via pnpm dlx shadcn@latest add @coss/<name> rather than hand-rolling it here.Card + headline typography + body). A domain component (PricingTier, BookingSummary) is always such a composition, living in _components/ — never a new primitive.meta.json#stack_config.primitive_exceptions or an ADR). Layout-only JSX for a unique section (a grid, a hero arrangement of primitives) is not a primitive and stays in the page.Read design-md-to-app/references/primitives-first.md before writing any component — the pattern →
primitive table (a link in a sentence → Button variant="link", a clickable row → Item render, a chip →
ToggleGroup, a choice tile → FieldLabel + Field + RadioGroupItem, a section → Card, a notice →
Alert, a tag → Badge…) and the complete list of allowed raw elements.
From board to code, the primitive renders the design. When a screenshot or a wireframe artboard differs
from the primitive — a 16 px radius against the Card's 12, a border where the Card has a ring, a different
hover tint, the background of a selected item, a weight, a padding, a pill where the Badge is square — the
screen is still built from the primitive, and the primitive is tuned until it renders the board: its
cva variants and the DESIGN.md tokens it reads (components/ui/<name>.tsx changes in its variants and token
classes only). A difference the whole board shares is a token or a default variant; one a single role has is
a new variant — first in DESIGN.md, then in the cva, named in the hand-off. Never accept the drift, never
rebuild the look with classes at the call site, and never touch the board: it changes only when the user
decides to change the design. A visual difference never justifies a <button>, <label>, <a>, <hr>,
<img>, a hand-written role, or a div/span whose classes redraw a Card, Badge, Alert or Separator — that is
a golden-rule-3 violation even with no import, design/no-handmade-ui reports it, and the write-time guard
refuses the write. No primitive can render it without a fork → stop and ask the user; never write it by
hand, never eslint-disable it.
Verify the page against the board pixel by pixel. Screenshot the route at the board's widths (1440 and
390) and diff it against the artboard PNG with scripts/visual_diff.py (Step 6); every red area of the diff
PNG that comes from a primitive's measures is a token or a variant still to tune. Converting a page that
already exists (hand-made elements replaced, a retrofit): screenshot it before the change, convert,
screenshot after, and diff the pair (python3 scripts/visual_diff.py before.png after.png --threshold 0.1)
— the target is zero changed pixels; a diff left on purpose is a design change and needs the user's yes. Procedure: design-md-to-app/references/primitives-first.md §Converting
existing screens.
Golden rule 3 — primitives first (references/contracts.md §Golden rules). Before writing a component, search components/ui/ (shadcn monorepo: packages/ui/src/components/) for a primitive that covers the pattern; if it is there, use it, and if two together cover it, compose them. Never hand-roll one the library ships, never import a second component library, never change a primitive beyond its cva variants and tokens. A truly new primitive needs a recorded exception with its reason (ADR or meta.json#stack_config.primitive_exceptions).
Chat / conversation / rendered-markdown surfaces are NOT hand-rolled. If the screenshot shows a chat, an AI console, a support inbox, a comment thread — or any surface rendering markdown/AI output — compose the official shadcn chat primitives (MessageScroller / Message / Bubble / Marker, Jun 2026) + .typeset (Jul 2026) + streamdown. Follow design-md-to-app/references/chat-and-typeset.md. Never build chat with div bubbles + manual autoscroll, and never render model markdown as whitespace-pre-wrap (bold/lists/code leak as literal syntax).
For each color/spacing/radius decision, reference the token by name. Don't hardcode hex codes — use bg-primary, text-on-surface-variant, rounded-md (shadcn) or theme values (MUI). If the screenshot shows a color that's not in DESIGN.md, ask the user before adding — it's either an oversight in DESIGN.md or a one-off photo color that shouldn't become a token.
Generate the files at the canonical framework path (see Contract). Constraints:
page.tsx readable.<div> with bg-muted and the dimensions of the original, plus an HTML comment {/* TODO: replace with hero image */}. Don't link to external image services.<Skeleton> on the scale — and proof the page does not jump when it
lands (CLS ≤ 0.05): design-md-to-app/references/skeleton-audit.md.## Layout section for breakpoint rules. If the system documents 3 breakpoints (Desktop/Tablet/Mobile), generate the page with appropriate Tailwind breakpoint classes (md:, lg:) or MUI breakpoint props.A page that looks right but fails basic a11y checks is not done. Run through this list as you write — most items take seconds when done at write-time and hours when retrofitted:
<main> per page. Use <nav>, <header>, <footer>, <aside> instead of <div> when the role applies. Avoid wrapping everything in nested <div>s.<h1> per page, then <h2> → <h3> without skipping levels. Visual size and heading level are independent — style with classes, not by demoting <h1> to <h3>.<img> and <Image> needs alt. For decorative-only imagery, use alt="" (empty string, not absent) so screen readers skip it. Photography placeholders inherit alt="TODO" plus a comment.Button (a <button> underneath) for actions inside the page, Link for navigation — a navigation that must look like a button is Button rendering a Link, not a restyled anchor. Don't style a <div onClick> as a button — keyboard users can't reach it.outline: none without a replacement. shadcn ships focus-visible:ring-2 focus-visible:ring-ring by default — preserve it. If the design hides outlines for aesthetic reasons, add a custom :focus-visible style that's visible against the background.<label> (matched by htmlFor+id, or wrapping). Placeholder text is not a label substitute — it disappears on focus and many screen readers ignore it.p-2 minimum.aria-label for icon-only buttons: a <Button size="icon"> with only an icon inside is invisible to screen readers without aria-label="Toggle theme" or equivalent.prefers-reduced-motion: handled globally by globals.css if the scaffold ran design-md-to-app. If you add a new long animation here, double-check it respects the global guard.If any item can't be fixed in the screenshot-to-page run (e.g., the DESIGN.md mandates a low-contrast color), document it explicitly in the hand-off message under "Accessibility notes" — never silently ship an a11y violation.
The work isn't done after the first write. Iterate until visual quality matches the threshold for the chosen mode. Required when a browser tool (Playwright / Chrome MCP / etc.) is available — without one, fall back to the sub-section "No browser available" below.
Two modes — they're not interchangeable, and over-applying pixel-tight is a real failure pattern:
structure-first (default for app routes — dashboards, forms, internal product pages)
bg-[#abc123], only bg-primary / bg-card / etc.).text-display-lg, etc.), not free text-[42px].<Card> IS a <Card>, not a <div> faking it).pixel-tight (opt-in for marketing / landing pages / brand-critical surfaces)
structure-first rules still apply (still must use tokens, not arbitrary pixel values) — but on top of that, position, scale, and typographic detail must match the screenshot to within 2%.The signal is the kind of route, not the user's preference. Ask the user only if the case is genuinely ambiguous.
/, /pricing, /about, /blog/<post>, /sign-up, /showcase → pixel-tight./dashboard, /clienti/<id>, /settings, /admin, anything CRUD → structure-first.pixel-tight for the hero, write the rest in structure-first style and call it good.State the chosen mode in your hand-off message: "Iterated in structure-first mode (3 passes, final delta 6.4%) — token-correct, semantically clean. Switch to pixel-tight if you want closer fidelity for production."
Build & start dev server:
cd <project-root>
pnpm build # catch syntax/type errors before launching
pnpm dev & # background dev server
If build fails, fix the most likely cause once. If it still fails, stop and tell the user — don't loop on a broken build.
Render and capture the route at the same viewport as the source screenshot (typical: 1440×900 for desktop frames; read the source PNG dimensions and match):
# via Playwright MCP, or equivalent
browser_resize(width: <ref-width>, height: <ref-height>)
browser_navigate(url: "http://localhost:3000<route>")
browser_wait_for(time: 2) # let fonts + animations settle
browser_take_screenshot(filename: ".workflow/screenshots/_render-iter-N.png")
Diff the renders. Use the helper script:
python3 scripts/visual_diff.py \
<reference> .workflow/screenshots/_render-iter-N.png
Output: a delta percentage (0–100), and an annotated diff PNG showing where the renders differ. Threshold depends on the mode you picked:
structure-first (default for app routes): ≤ 8% delta is shippable. Concentrate on token correctness over pixel match.pixel-tight (landing/marketing): ≤ 2% delta. <5% is acceptable when the gap is on imagery placeholders.Identify the worst region in the diff and fix it. Common categories of delta, in order of frequency:
p-N / gap-N to the next token.bg-muted but the screenshot shows bg-surface-soft) → fix the token name.text-display-lg → text-display-xl or font-medium → font-semibold.Card where the board shows a Item row, or a Badge where it shows a
ToggleGroup chip) → swap to the other primitive. Never "swap" a primitive for a div with a
border because the board draws the box slightly differently: tune the primitive (see below).cva variant and the DESIGN.md token
it reads — a new variant in DESIGN.md first — never classes at the call site.Make one targeted fix per iteration. Don't try to fix everything at once — you lose the ability to attribute progress.
Repeat Steps 2–4 until delta drops below the threshold for your mode (≤ 8% for structure-first, ≤ 2% for pixel-tight) OR you've hit the iteration cap (3 for structure-first, 8 for pixel-tight). If stuck, stop and ask the user — usually the screenshot is ambiguous on the disputed region. Don't over-iterate in structure-first — past 3 passes you're chasing pixels in a context where pixels weren't the goal.
Kill the dev server when done.
If no browser tool is in this session: build only, don't loop. Say explicitly:
⚠ Verifica visiva richiesta: nessun browser tool in questa sessione. Apri
http://localhost:3000<route>e confronta con.workflow/screenshots/<filename>. Il pixel-perfect loop non è stato eseguito; il risultato è quindi un primo draft, non un match verificato.
Don't claim convergence you didn't measure.
design/no-handmade-ui at zero on the files you wrote is the other half.Update .workflow/meta.json:
page_generated, set phase = "page_generated"updated_at{
"skill": "screenshot-to-page",
"ran_at": "<now>",
"inputs": {"screenshot": "screenshots/<file>", "route": "<route>"},
"outputs": ["app/<framework-specific-path>"],
"phase_before": "<prev>",
"phase_after": "page_generated"
}
Tell the user:
app/ (relative).screenshot-to-page run for the next page, or module-add to wire features behind these routes.app/package.json is your kit. If a library's missing (e.g., a chart library for a dashboard screenshot), flag it in the report and let module-add handle it.page.tsx is fine. Don't split into 12 files just to "follow best practices" if there's no reuse.When generating a route + components, follow the canonical structure (spec: docs/superpowers/specs/2026-06-06-folder-structure-refactor.md):
app/<route>/_components/<Name>.tsx (L0 page-private).app/(app)/dashboard/, components go in app/(app)/dashboard/_components/.components/site/: that folder no longer exists. Cross-route shared components live in components/shared/<dominio>/.promote-component to lift it to L1 (group _components/) or L2 (components/shared/<dominio>/).<Card> + <Card.Header>) lives in a single file until ~250 lines, then becomes a folder with index.ts barrel.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lukedj78/dev-flow --plugin dev-flow57 skills in this plugin
/animated-iconsAdd a Motion-animated icon to a Next.js app from a shadcn registry instead of hand-animating an SVG. Two registries, picked from the project's icon set: **heroicons-animated** (316 icons, `shadcn add @heroicons-animated/<name>`) and **hugeicons-animated** (165 icons, `shadcn add @hugeicons-animated/<name>`, which also installs a shared `lib/use-icon-animation.ts`). Both MIT, both on the `motion` runtime, both copied into your repo as source. This skill owns the install plus the two things the raw components lack: a `prefers-reduced-motion` guard and timing aligned to the project motion tokens (`lib/motion/`). Use when the user says "animated icon", "animate this icon", "make the bell/heart/menu icon animate on hover", "aggiungi un'icona animata", or wants an icon micro-interaction. Refuses outside Next.js web — for React Native use `rn-animations-gestures`. Not for: static icons, a whole motion system (`transitions`), or installing the runtime itself (`module-add motion`)./app-securityCheck whether an app's own code can be attacked before it ships — vulnerable dependencies, secrets in the code and in git history, Next.js authorization gaps (Server Actions and route handlers without a session check, queries by id with no owner filter — IDOR), data over-exposure, secrets in public env vars, raw SQL — then read the flagged code against an OWASP checklist, with an opt-in dynamic level (Strix) that proves exploits against the app running locally. The fifth pre-deploy gate, beside compliance-audit, vercel-doctor, shadscan and launch-audit; reports and routes, never blocks. Triggers: "security review", "è sicura l'app?", "controllo di sicurezza prima del deploy", "IDOR", "secrets in the repo", "pentest". Not for: GDPR and legal (compliance-audit), UI quality (shadscan), cost (vercel-doctor), launch readiness (launch-audit), a review of one branch diff (Claude Code's /security-review), third-party registry code (registry-intake)./app-verificationGive a project a manual for proving its features on the real app, written once and kept true: `.claude/skills/verify-<app>/` with how to launch it until it is usable, a read-only doctor check, how to drive it with the repo's real selectors, what counts as proof and where it goes, how to stop only what it started — plus one feature file per PRD story, seeded from the wireframe screen inventory, and a headless-Chrome render probe (overflow, wrapped headings, text hidden under reduced motion). Two modes: create (scaffold, fill from the code, prove it live once, record `meta.json#verification`) and maintain (re-read every feature from source, drive them all live, fix the manual, report real regressions). Web, Expo and eve. Triggers: "verify the app", "prova che funziona", "verification skill", "come si avvia l'app per provarla", "maintain the verify skill", "il manuale di verifica è aggiornato?". Not for: writing tests (write-tests), UI audits (shadscan), security (app-security), deploying (vercel-deploy)./compliance-auditRun a GDPR + EU AI Act compliance audit on an existing dev-flow project (web / mobile / eve agent) and remediate what it finds. Two modes: Audit (scan the codebase and `meta.json#stack` against a 11-point risk register — DSAR, consent/cookies, EU data residency, retention and PII-scrubbing, AI-transparency Art.50, high-risk Annex III, sub-processors — into a report with severity, evidence and article mapping) and Remediate (apply the safe mechanical mitigations, flag the ones needing a legal decision, never deciding legal basis or high-risk for the user). A pre-deploy gate; run it any time. Triggers: "audit GDPR", "compliance check", "AI Act", "siamo conformi?", "DSAR / cancellazione account / cookie consent / data residency". Not for: the other pre-deploy gates (vercel-doctor, shadscan, launch-audit, app-security), legal advice or DPIA sign-off (a DPO confirms), building features, or writing the PRD (use prd-from-idea)./composition-patterns-guideUse when refactoring React or React Native components that suffer from boolean prop proliferation, missing compound structure, prop drilling, or unclear ownership of state. Codifies the 7 Vercel composition-patterns rules for our web + RN stack — composition or explicit variants over boolean props, compound components with shared context, state lifted into providers, children over render props, React 19 (no forwardRef) — plus our colocation rules (Rule of Three, L0/L1/L2, `_components/`). Triggers on: "refactor this component", "questo componente ha troppi prop booleani", "rendi questo componente più componibile", "compound component", "context provider per X", "design del componente". Not for: scaffolding new components (use design-md-to-app, screenshot-to-page, rn-add-screen), or moving components up the hierarchy (use promote-component)./coss-uiSet up or extend a Next.js web app with Coss/UI — the official Cal.com design system, built on Base UI + Tailwind CSS v4 and installed through the shadcn CLI via the namespaced `@coss/*` registry. Two modes: Init (`shadcn init @coss/style` on a new project) and Add (pull `@coss/ui` primitives, single `@coss/<name>` components, or particles into an existing one). Sets `meta.json#stack.ui = "coss"`. Triggers: "usa Coss/UI", "coss.com/ui", "Cal.com design system", "aggiungi un componente Coss", "init @coss/style", "scaffold con Coss UI", or dev-flow routing when `stack.ui = "coss"`. Requires Tailwind CSS v4 and carries a mixed MIT/AGPLv3 license. Not for: writing the DESIGN.md (use figma-to-design-md / image-to-design-md), the generic Next.js scaffold (design-md-to-app owns it), backend modules (module-add), or React Native (RN uses NativeWind, not Coss).