/react-development:design-to-componentfrom react-development
Converts Figma designs into typed React components by extracting specs, variants, and design tokens via the Figma MCP. Scaffolds TypeScript components with proper prop interfaces.
Ships in react-development. 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.
None: SKILL.md is the whole skill.
Convert a Figma design into a typed, production-ready React component by extracting specs directly from the Figma MCP — no manual measurements or guesswork.
Use this skill when:
Follow these steps in order. Use the Figma MCP tools at each stage.
Before touching any Figma tool, read CLAUDE.md, README.md, and any design system rules files (e.g. .cursor/rules/, AGENTS.md) to determine:
tailwind.config.js), design token library, or nonePay close attention to README.md sections that document the project's CSS or design system structure — these are a primary source of truth for how tokens are named, where they live, and how they're used. If no such documentation exists, suggest the user add it to their README before or alongside this component, as it will make every future conversion more accurate.
If no rules exist and the project's approach is unclear, ask the user before generating code. Never assume a styling approach.
If the project uses the Figma MCP and has not yet generated design system rules, suggest running figma_create_design_system_rules once to produce a project-specific rules file they can save to CLAUDE.md or equivalent — this prevents the styling mismatch problem on every future component.
Call figma_get_metadata with the node ID or URL to retrieve:
Use the component name to determine the file name and export name.
Call figma_get_design_context to get the full design spec:
Map layout mode to CSS:
HORIZONTAL auto-layout → display: flex; flex-direction: rowVERTICAL auto-layout → display: flex; flex-direction: columnposition: absolute or position: relative with explicit sizingCall figma_get_variable_defs to retrieve variables bound to the node:
If no variables exist, extract raw values from Step 2 and treat them as fallbacks — always wrap them in the project's token reference where possible (e.g. var(--color-primary, #0070f3) or a Tailwind arbitrary value bg-[#0070f3]).
Avoid over-tokenization: Do not create a new token or config entry for every value you see. Slight Figma value differences (e.g. #0071f4 vs #0070f3, 13px vs 14px) are almost always unintentional design drift — map them to the nearest existing token rather than minting new ones.
When a value has no match: If a Figma value genuinely doesn't correspond to any existing token, ask the user before creating a new one:
"The design uses
[value]which isn't in the token system. Should I map it to the nearest existing token ([closest]), create a new token, or use a raw/arbitrary value?"
If the node is a COMPONENT_SET, it has variants. Parse the variant properties from the metadata:
prop?: booleanprop: 'value1' | 'value2' | 'value3'Example: A button with variant: Primary | Secondary | Destructive and size: SM | MD | LG becomes:
interface ButtonProps {
variant?: 'primary' | 'secondary' | 'destructive';
size?: 'sm' | 'md' | 'lg';
}
Call figma_get_screenshot to get a visual snapshot of the design. Keep this in context to validate the generated component visually.
Generate the component following these rules:
File structure:
Match the project's existing conventions (discovered in Step 0). A common layout:
ComponentName/
├── ComponentName.tsx # Component implementation
├── ComponentName.module.css # Only if using CSS Modules
└── index.ts # Re-export
If the project uses a flat file structure or co-locates styles differently, follow that instead.
Component template:
Use the project's styling approach (discovered in Step 0). A generic starting point:
interface ComponentNameProps {
// Extracted from Figma variants and design context
children?: React.ReactNode;
className?: string;
}
export function ComponentName({ children, className }: ComponentNameProps) {
return (
<div className={className}>
{children}
</div>
);
}
Fill in className using the project's styling method — CSS Modules reference, Tailwind utility string, styled-component, etc.
Typing rules:
ComponentNameProps), never inline typesclassName?: string for style overrideschildren?: React.ReactNode if the design has a content slotReact.HTMLAttributes<HTMLDivElement> (or the appropriate element) for native prop passthrough when the component is a simple wrapperElement selection:
<button> or <a>, never <div><input>, <select>, <textarea><nav>, <ul>, <li><div> or <section>Variant implementation: Map each variant value to the appropriate style expression for the project's approach:
// CSS Modules example
const variantClass = { primary: styles.primary, secondary: styles.secondary }[variant ?? 'primary'];
// Tailwind example
const variantClass = { primary: 'bg-blue-600 text-white', secondary: 'bg-transparent border border-gray-300' }[variant ?? 'primary'];
Use clsx, cx, or a similar utility if already present in the project. Fall back to .filter(Boolean).join(' ') only if no utility is available.
Use the styling approach established in Step 0. Do not introduce a new approach.
CSS Modules / vanilla CSS: Map Figma values to CSS properties. Reference project tokens as custom properties with raw value fallbacks:
.root {
display: flex;
flex-direction: row;
align-items: center;
gap: var(--spacing-2, 8px);
padding: var(--spacing-3, 12px) var(--spacing-4, 16px);
background-color: var(--color-primary, #0070f3);
border-radius: var(--radius-md, 6px);
font-size: var(--text-sm, 14px);
font-weight: 500;
line-height: 1.4;
}
Tailwind: Map Figma values to utility classes. Use tailwind.config.js theme keys for colors and spacing. Don't create new properties or arbitrary values such as bg-[#0070f3], w-[42px] unless absolutely necessary. If a value in Figma is slightly off from what's been set in tailwind.config.js use the version in the config file:
<div className="flex flex-row items-center gap-2 px-4 py-3 bg-primary text-sm font-medium rounded-md" />
styled-components / Emotion / CSS-in-JS: Generate a styled component using the project's theme object:
const Root = styled.div`
display: flex;
gap: ${({ theme }) => theme.spacing[2]};
background: ${({ theme }) => theme.colors.primary};
`;
In all cases: never hardcode raw values where a project token exists, never introduce a styling method not already used by the project, and never silently create new tokens or config entries — ask the user first.
Call figma_get_code_connect_suggestions to see if the component has existing Code Connect mappings. If mappings exist, follow the established prop naming conventions. If not, consider calling figma_send_code_connect_mappings to register the new component.
After generating the component:
figma_get_screenshot visual referenceIf a browser automation tool is available, use it to capture the rendered component and compare side-by-side with the Figma screenshot (e.g. chrome_devtools_take_screenshot via chrome-devtools MCP, browser_screenshot via browser MCP, or a Playwright screenshot command).
Before finishing, confirm:
<div>)className prop is supported for external style overridesindex.tsBefore applying any pattern, read the project's CLAUDE.md and README.md to understand the conventions already in use — component structure, styling approach (CSS Modules, Tailwind, styled-components, etc.), naming conventions, and any established patterns. Adapt the examples below to match what the project already does.
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'primary' | 'secondary' | 'ghost';
size?: 'sm' | 'md' | 'lg';
icon?: React.ReactNode;
iconPosition?: 'left' | 'right';
}
export function Button({
variant = 'primary',
size = 'md',
icon,
iconPosition = 'left',
children,
className,
...props
}: ButtonProps) {
return (
<button
className={[styles.root, styles[variant], styles[size], className]
.filter(Boolean)
.join(' ')}
{...props}
>
{icon && iconPosition === 'left' && <span className={styles.icon}>{icon}</span>}
{children}
{icon && iconPosition === 'right' && <span className={styles.icon}>{icon}</span>}
</button>
);
}
interface CardProps {
header?: React.ReactNode;
footer?: React.ReactNode;
children: React.ReactNode;
className?: string;
}
export function Card({ header, footer, children, className }: CardProps) {
return (
<div className={[styles.root, className].filter(Boolean).join(' ')}>
{header && <div className={styles.header}>{header}</div>}
<div className={styles.body}>{children}</div>
{footer && <div className={styles.footer}>{footer}</div>}
</div>
);
}
export function Tabs({ children, className }: TabsProps) { ... }
Tabs.List = function TabsList({ children }: { children: React.ReactNode }) { ... };
Tabs.Tab = function Tab({ value, children }: TabProps) { ... };
Tabs.Panel = function TabPanel({ value, children }: TabPanelProps) { ... };
Use compound components when the Figma design has clearly named sub-components (e.g., Tabs/Tab, Menu/MenuItem, Accordion/AccordionItem).
| Tool | When to use |
|---|---|
figma_get_metadata | First call — get component name, type, dimensions |
figma_get_design_context | Extract layout, colors, typography, children |
figma_get_variable_defs | Resolve design tokens bound to the node |
figma_get_screenshot | Get visual reference for validation |
figma_get_code_connect_map | Check existing prop mappings |
figma_get_code_connect_suggestions | Get suggested prop mappings for a node |
figma_send_code_connect_mappings | Register new component → Figma mapping |
What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/onboardDeep project onboarding that deploys a team of specialized agents to explore any codebase and generate comprehensive, didactic markdown documentation with Mermaid diagrams. Use this skill whenever starting work on an unfamiliar project, joining a new team, needing to understand a codebase before a refactor, or when asked to "onboard me", "explore this codebase", "document the project", "understand how this works", "map the architecture", "help me get up to speed", or "generate project docs". Goes far beyond /init — produces interconnected documents covering architecture, data flows, design patterns, directory structure, and component hierarchies with rich diagrams. Always invoke this skill when the user is orienting themselves to a new project./review-reactReact and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.npx claudepluginhub thoughtbot/skills --plugin react-developmentOther plugins' skills for the same job