en un clic
designfigma-to-code
// Implement a Figma design using shadcn/ui components. Use when converting Figma URLs to React code.
// Implement a Figma design using shadcn/ui components. Use when converting Figma URLs to React code.
| name | design.figma-to-code |
| description | Implement a Figma design using shadcn/ui components. Use when converting Figma URLs to React code. |
| argument-hint | [figma-url] |
| allowed-tools | ["mcp__figma-remote-mcp__get_design_context","mcp__figma-remote-mcp__get_screenshot","mcp__figma-remote-mcp__get_variable_defs","mcp__figma-remote-mcp__get_metadata","Read","Write","Edit","Bash","Glob","Grep"] |
Implement the Figma design at $ARGUMENTS using shadcn/ui components.
Note: All shadcn/ui components are already installed and available at apps/web/src/components/ui/. Import them directly (e.g., import { Button } from '@/components/ui/button'). Avoid other components.
Extract from URL https://figma.com/design/:fileKey/:fileName?node-id=:nodeId:
fileKey: The file identifiernodeId: Convert 123-456 to 123:456 formatmcp__figma-remote-mcp__get_design_context(
fileKey: "<fileKey>",
nodeId: "<nodeId>",
clientLanguages: "typescript",
clientFrameworks: "react,nextjs"
)
Also get screenshot and metadata:
mcp__figma-remote-mcp__get_screenshot(fileKey, nodeId)
mcp__figma-remote-mcp__get_metadata(fileKey, nodeId)
Check data-name attributes in Figma output - don't assume from visuals!
| Visual Appearance | Check data-name for | Likely Component |
|---|---|---|
| Grouped buttons with one active | Tabs, Tab | <Tabs> |
| Toggle between options | Switch, Toggle | <Switch> |
| Button group | ButtonGroup | <ToggleGroup> |
| Dropdown trigger | Select, Dropdown | <Select> |
Red Flags - Verify Before Coding:
For shadcn Figma libraries, extract props from attributes only:
What to LOOK AT:
--general/primary, --general/secondarydata-name for component typeget_variable_defs — map Figma text styles (e.g. heading 2, paragraph/regular) to Typography variants (see reference.md)What to IGNORE:
Priority Order:
data-name with variant (e.g., "Button/Secondary/sm")--general/secondary → variant="secondary")Typography: NEVER use hardcoded Tailwind for text. Always use <Typography variant="…" /> from @/components/ui/typography. Map Figma variable names (e.g. heading 2, paragraph-bold) to Typography variants (e.g. h2, paragraph-bold).
import { Button } from '@/components/ui/button'
import { Card, CardContent } from '@/components/ui/card'
type MyComponentProps = {
// typed props
}
export function MyComponent({ ...props }: MyComponentProps) {
return (
// Implementation
)
}
Styling Guidelines:
DO:
variant="outline", size="sm")flex, grid, gap-*, p-*grid-cols-2 for 50/50 split, or specific column ratios)DON'T:
bg-blue-500)Place story files next to the component they document (e.g., MyComponent.stories.tsx next to MyComponent.tsx).
For shadcn/ui components and simple UI components that don't need API mocking:
import type { Meta, StoryObj } from '@storybook/react'
import { MyComponent } from './MyComponent'
const meta = {
title: 'Components/MyComponent',
component: MyComponent,
} satisfies Meta<typeof MyComponent>
export default meta
type Story = StoryObj<typeof meta>
export const Default: Story = {
args: {
// component props
},
}
MyScreen/
├── MyScreen.stories.tsx
├── HeaderCard.stories.tsx
└── DataTable.stories.tsx
Note: For pages/widgets that need Redux state and API mocking, use createMockStory from @/stories/mocks (see AGENTS.md for details).
yarn workspace @safe-global/web type-check
yarn workspace @safe-global/web storybook
apps/web/src/components/ui/apps/web/src/utils/cn.tslucide-reactSee reference.md for detailed component mappings and patterns.
Write or refactor Cypress E2E tests following Page Object Model, action/assertion separation, and project conventions. Use when creating new tests, refactoring existing ones, or adding page object functions.
Creates a Storybook UI prototype from a PRD-style input using existing shadcn/ui components, subtle visual tone, and a clear hierarchy. Use when the user invokes /design.prototype or asks for a prototype Storybook story.
Sync a UI component from Figma to code using the component sync workflow. Use when updating components to match Figma designs.
Sync CSS variables from Figma plugin export to globals.css. Use when updating design tokens/colors from Figma.
Verify Figma implementation is pixel-perfect. Use after implementing Figma designs to catch and fix discrepancies.