paper-to-code-components
Converts Paper design files into clean, modular React/Next.js code with proper component extraction.
Install
mkdir -p .claude/skills/paper-to-code-components && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13146" && unzip -o skill.zip -d .claude/skills/paper-to-code-components && rm skill.zipInstalls to .claude/skills/paper-to-code-components
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Use when implementing Paper MCP, Paper-to-code, design-to-code, Viewfinder, or Paper-exported JSX in React/Next.js apps. Covers component candidates, globals.css tokens for arbitrary values, shadcn reuse, data-paper-* roots, and avoiding monolithic JSX.Key capabilities
- →Map design hierarchy to component candidates
- →Identify page shell, semantic regions, and navigation
- →Extract repeated cards, rows, messages, and controls
- →Create one component per distinct icon or logo
- →Move arbitrary Paper values into `globals.css` tokens
- →Reconcile built page against canonical Paper frame
How it works
The skill requires inspecting the Paper design to identify component candidates and hierarchy before writing JSX, enforcing one component per icon, using `globals.css` tokens, and reconciling the build against the canonical artboard.
Inputs & outputs
When to use paper-to-code-components
- →Convert UI mockups to code
- →Extract reusable components
- →Implement design tokens
- →Refactor UI from design
About this skill
Paper-to-Code Componentization
You turn Paper designs into React/Next code with component boundaries identified before JSX grows.
Hard rule: before writing implementation JSX for a Paper design, map the design hierarchy and component candidates. Pixel fidelity and componentization are both required.
RED/GREEN Intent
This skill prevents these Paper-to-code failures:
- Dumping a whole artboard into one giant route or component
- Spotting repeated cards, rows, or controls only after the file is huge
- Collapsing distinct icons or logos into one
name-switched mega-component - Rebuilding a list, row, or card in a new section instead of reusing a component already extracted for it
- Removing Viewfinder
data-paper-*attributes from useful roots - Adding client hooks only to manage static visual variants
- Building from whichever artboard is easiest to convert instead of the one the stakeholder treats as canonical — multi-iteration files routinely include simplified handoff/cleanup frames
- Flattening a chart into pixels: dropping error bars, whiskers, ranges, or stacked segments and modelling one value where the design encodes several
- Re-deriving a chart from a screenshot or from className literals when transforms make those literals wrong
- Dumping every component into one flat folder so data charts sit intermixed with prose, chrome, and decoration
GREEN outcome: repeated visual groups are extracted once, components are grouped by kind (data visualizations in their own folder, not intermixed with chrome and prose), page files read as composition, charts carry every data dimension the design encodes, and the build still matches Paper — reconciled against the artboard the stakeholder considers canonical, not whichever one it was built from.
1. Extract the Design Hierarchy First
Before coding, inspect the Paper selection/tree/screenshot and identify:
- Page shell and semantic regions
- Navigation, hero, content sections, sidebars, overlays, and footers
- Repeated cards, rows, messages, list items, badges, pills, and controls
- Icon button variants, CTA variants, input variants, and menu items
- Reusable asset treatments: avatars, logo lockups, screenshot frames, masks, shadows, and image crops
Scan the entire design, not one section at a time. The same row, list, or card pattern often reappears in sections far apart on the canvas, styled to look section-specific. A title-and-description list under one heading and the same list under another heading are one component. Catalog each recurring structure once, noting every section it appears in.
Pick the canonical frame first. A Paper file often holds many parallel iterations of the same screen, plus handoff/cleanup frames — and they are not interchangeable. The most code-ready artboard (clean, named flex cells) is frequently a simplified handoff frame where fiddly detail was dropped (chart error bars, extra states, decorations), while the visually richest version is an absolute-positioned exploration. Do not default to whichever is easiest to convert. Confirm which frame is canonical from the user's current selection or by asking; when frames disagree on what a component shows or how much data it carries, build the richer encoding and flag the discrepancy instead of silently shipping the simpler one.
Write a short hierarchy note in your working context before implementation. Do not skip this because the export looks straightforward.
2. Choose Component Candidates
Create a named component when any of these are true:
- A visual group appears two or more times, including near-duplicates
- A semantic region has a reusable role, such as
PricingCard,MessageRow, orFeatureSection - A control has variants, such as
IconButton,Pill,Badge, orCTAButton - A repeated card, row, message, or list item changes only text, icon, media, color, or state
- An asset treatment repeats, such as an avatar frame, logo mark, image mask, or screenshot shell
Near-duplicates use variant props or slots. Do not copy and tweak the same JSX block.
Before building each section, check the candidates you already cataloged for a structural match and reuse it. Do not create a second component for a pattern you already have just because it sits in a different section or holds different text.
3. One Component Per Icon
Icons and logos that differ in their actual artwork are distinct components, not variants of a shared one.
- Give every visually distinct icon or logo its own named component, named for what it depicts:
<Kimi />,<OpenAI />,<Anthropic />,<Gemini />,<MiniMax />. - Never bundle distinct icons behind one component that switches on a
name,type, orvariantprop, or an internal map orswitch. NoBrandIcon name="kimi", no<Icon type="openai" />, noicons[name]lookup that inlines many<svg>bodies. - The near-duplicate-to-variant rule in Section 2 does NOT apply to icons. Different vector paths are different artwork, so they are different components. Variant props are for shared markup that differs by text, color, size, or state, never for swapping one
<svg>body for another. - Shared chrome around an icon is the exception worth extracting. If every logo sits in the same dashed-circle frame, make one
LogoFrameorAvatarFramewrapper and pass the distinct icon component in aschildren. The frame is shared; the mark stays per-icon. - Put each icon in its own file under the project's icon location, match the exported SVG exactly (viewBox, paths, fills), and reuse existing icon components or an installed icon set before hand-rolling new ones.
Bad: BrandIcon({ name }) with a switch (name) returning ten different <svg> blocks.
Good: Kimi, OpenAI, Anthropic, Gemini, and MiniMax as separate components, each its own SVG, with a shared LogoFrame wrapping whichever mark is passed in.
4. Define Boundaries and Props
For each component candidate, define before or while coding:
- Component name based on the reusable structural UI role, not the content of the first place it appears or Paper layer names. A title-plus-description list is
LabeledListorDefinitionList, notFailureList; a content-specific name hides the component from the next section that needs it - Responsibility in one sentence
- Props for changing text, icons, media, hrefs, state, and visual variants
childrenor named slots for flexible content areas- The root element that keeps relevant
data-paper-*attributes - File placement by kind — which folder the component lives in. Group by responsibility instead of one flat dump: data-visualization/chart components in a dedicated folder (e.g.
components/charts/), layout/chrome (nav, header, footer) together, typography/prose primitives together, and decoration (watermarks, background figures) separate. Icons go in the project's icon location (§3). A flat folder where aLeaderboardchart sits beside aWatermarkand aParaburies the substantive data components and blurs which files are figures versus chrome. Within each group, use flat kebab-case files imported directly (shadcn style) — not folder-per-component withindex.tsbarrels, which trip React Doctor'sno-barrel-import(§9).
Keep one-off decorative leaf elements inside the nearest semantic component. Extract repeated decoration into a small component only when the treatment repeats.
5. Implementation Rules
- Preserve Paper visual fidelity: spacing, typography, color, radius, shadows, image crops, and responsive behavior must still match the design.
- Keep Viewfinder/Paper
data-paper-*attributes on useful rendered roots. If splitting exported JSX, move the relevant attributes to the new component's root. - Use the project's existing styling system: Tailwind where nearby code uses Tailwind, CSS modules where nearby code uses CSS modules, and existing tokens when present.
- Prefer React Server Components in Next.js. Add
"use client"only for state, browser APIs, event handlers that need client behavior, or client-only animation libraries. - Do not add hooks for static presentational variants. Use props, classes, CSS variables, or data attributes.
- Reuse existing app components, icons, assets, and helpers before creating new local versions.
- Reuse the components you extracted earlier in the same pass. A structure that recurs across sections gets one component rendered with different props, not a near-copy per section.
6. Standardize Arbitrary Values
When Paper-exported JSX contains arbitrary values, preserve the rendered pixels and move the values into named project tokens in globals.css before completion.
Tokenize arbitrary values for:
- Typography:
text-[21px]/9.5,tracking-[-0.02em], font families, font weights - Colors:
text-[color(display-p3_...)], arbitrary backgrounds, borders, gradients - Shape and depth:
rounded-[13px], custom shadows, outlines, rings - Layout and spacing: arbitrary widths, heights, gaps, padding, margins, transforms
Use the local Tailwind/CSS pattern already present in globals.css, such as @theme, CSS variables, or project token aliases. Replace opaque inline arbitrary classes with named utilities backed by those tokens. Do not change the visual value while naming it.
For sizing and spacing, first reach for Tailwind v4's built-in spacing scale, not an arbitrary bracket. Utilities like w-, h-, max-w-, min-w-, p-, m-, gap-, inset-, top-/left- take a bare number where <n> = n × 0.25rem (4px at the default scale), so a pixel value that lands on the scale must use the scale utility: max-w-[1160px] → max-w-290, gap-[24px] → gap-6, h-[96px] → h-24. A linter will flag max-w-[1160px] precisely because max-w-290 already exists. Keep [...] brackets only for values that do NOT land on the scale (e.g. w-[17.18px] or a one-off max-w-[680px] that you would otherwise tokenize).
Bad:
Content truncated.
When not to use it
- →When the user is not implementing Paper MCP, Paper-to-code, design-to-code, Viewfinder, or Paper-exported JSX in React/Next.js apps
- →When the user wants to dump a whole artboard into one giant component
- →When the user wants to ignore componentization before writing JSX
Limitations
- →The skill is for implementing Paper MCP, Paper-to-code, design-to-code, Viewfinder, or Paper-exported JSX in React/Next.js apps.
- →The skill requires pixel fidelity and componentization.
- →The skill prohibits bundling distinct icons behind one component that switches on a `name`, `type`, or `variant` prop.
How it compares
This skill enforces a structured, component-first approach to converting Paper designs into React/Next.js code, preventing monolithic JSX and ensuring design token adherence, unlike directly translating design elements into code.
Compared to similar skills
paper-to-code-components side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| paper-to-code-components (this skill) | 0 | 1mo | No flags | Advanced |
| elegant-design | 21 | 5mo | Review | Intermediate |
| frontend-design-pro | 10 | 8mo | No flags | Intermediate |
| design | 0 | 4mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
elegant-design
rand
Create world-class, accessible, responsive interfaces with sophisticated interactive elements including chat, terminals, code display, and streaming content. Use when building user interfaces that need professional polish and developer-focused features.
frontend-design-pro
claudekit
Creates jaw-dropping, production-ready frontend interfaces AND delivers perfectly matched real photos (Unsplash/Pexels direct links) OR flawless custom image-generation prompts for hero images, backgrounds, and illustrations. Zero AI slop, zero fake URLs.
design
dyeoman2
Design and restyle TanStack Start routes and React components in this repo using the March 2026 GPT-5.4 frontend guidance while preserving local conventions. Use when building or refining marketing pages, dashboards, admin surfaces, authenticated app views, page-level layouts, visual systems, or int
frontend-design-zh
L-LesterYu
使用 React、Tailwind CSS 和 shadcn/ui 创建独特、生产级的静态网站——无需设计稿。从纯文本需求生成大胆、令人难忘的设计,具备反AI套路美学、移动优先响应式模式和单文件打包功能。适用于构建落地页、营销网站、作品集、仪表盘或任何静态Web界面。支持 Vite(纯静态)和 Next.js(Vercel部署)两种工作流。
frontend-design
darthlinuxer
Design thinking and decision-making for web UI. Use when designing components,
ui-ux-pro-max
darkmatter
UI/UX design intelligence for web and mobile. Includes 50+ styles, 161 color palettes, 57 font pairings, 161 product types, 99 UX guidelines, and 25 chart types across 10 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, and HTML/CSS). Actions: plan, build, cr