figma-to-code
Convert Figma designs to JSX/Astro components with Tailwind CSS (requires Figma MCP server)
What this skill does
# Figma to Code Conversion
Convert Figma designs to production-ready React/Astro components with Tailwind CSS using a structured 6-step workflow.
## Requirements
This skill requires **Figma MCP Server**. See [setup guide](https://github.com/figma/mcp-server-guide).
**Available MCP Tools:**
- `get_design_context()` - UI structure, styles, and layout
- `get_screenshot()` - Visual reference capture
- `get_variable_defs()` - Design tokens and variables
- `get_metadata()` - Node structure and hierarchy
## Workflow
### Step 1: Detect Project Context
Analyze the target project to determine available utilities and framework.
**Class Utility Detection:**
```tsx
// Check for cn/clsx/classnames helper
import { cn } from '@/lib/utils' // shadcn pattern
import { clsx } from 'clsx' // clsx
import classNames from 'classnames' // classnames
```
**Framework Detection:**
- `.astro` files → Astro project
- `.tsx` files → React project
- Check `astro.config.*` for Astro configuration
### Step 2: Extract Design from Figma
Use Figma MCP tools to extract design information:
1. **`get_design_context()`** - Primary extraction
- Component hierarchy and structure
- Layout properties (flex, grid, spacing)
- Typography styles
- Color values and tokens
- Border, shadow, and effect styles
2. **`get_screenshot()`** - Visual reference
- Capture visual appearance for verification
- Use for complex visual patterns
3. **`get_variable_defs()`** - Design tokens
- Color tokens and semantic colors
- Spacing scales
- Typography tokens
- Border radius tokens
4. **`get_metadata()`** - Structure analysis
- Node hierarchy
- Component instances
- Auto-layout properties
### Step 3: Verify Design Understanding
Before generating code, confirm understanding with the user:
**Layout Structure:**
- Identify flex/grid containers
- Understand nesting hierarchy
- Recognize responsive patterns
**Spacing Values:**
- Extract padding and margin values
- Map to Tailwind spacing scale
- Note gap values for flex/grid
**Color Mapping:**
- Map Figma colors to Tailwind palette
- Identify semantic color usage
- Note transparency values
**Typography:**
- Font family, size, weight
- Line height and letter spacing
- Text color and decoration
**If unclear on any aspect:**
> Ask the user for clarification before proceeding
### Step 4: Generate JSX
**React (.tsx) - Default:**
```tsx
interface ComponentProps {
className?: string
children?: React.ReactNode
}
export function Component({ className, children }: ComponentProps) {
return (
<div className={cn('base-styles', className)}>
{children}
</div>
)
}
```
**Astro (.astro) - For static content:**
```astro
---
interface Props {
class?: string
}
const { class: className } = Astro.props
---
<div class:list={['base-styles', className]}>
<slot />
</div>
```
**Astro + React (.tsx with client directive) - For interactive:**
```astro
---
import { InteractiveComponent } from './InteractiveComponent'
---
<InteractiveComponent client:load />
```
### Step 5: Apply Styles
**Tailwind v4 (Default):**
Use Tailwind v4 patterns with auto-calculated spacing:
```tsx
// Spacing: value * 4px
// p-13 = 52px, gap-18 = 72px
<div className="flex flex-col gap-6 p-8">
<h1 className="text-2xl font-semibold text-gray-900">
Title
</h1>
<p className="text-base text-gray-600">
Description
</p>
</div>
```
**Class Organization Order:**
1. Layout (flex, grid, position)
2. Sizing (w-*, h-*)
3. Spacing (p-*, m-*, gap-*)
4. Typography (text-*, font-*)
5. Colors (bg-*, text-*, border-*)
6. Effects (shadow-*, rounded-*)
7. Responsive (sm:, md:, lg:)
8. State (hover:, focus:)
**With CSS Variables (@theme):**
```css
@import 'tailwindcss';
@theme {
--breakpoint-md: 992px;
--font-sans: 'Inter', system-ui, sans-serif;
--color-primary: oklch(0.7 0.15 250);
}
```
### Step 6: Validate
**Semantic HTML Checklist:**
- [ ] Appropriate heading hierarchy (h1-h6)
- [ ] Semantic elements (nav, main, section, article, aside, footer)
- [ ] Lists for list content (ul/ol/li)
- [ ] Buttons for actions, links for navigation
**Accessibility Checklist:**
- [ ] Alt text for images
- [ ] ARIA labels where needed
- [ ] Focus states for interactive elements
- [ ] Keyboard navigation support
- [ ] Color contrast compliance
- [ ] Screen reader considerations
**Responsive Design:**
- [ ] Mobile-first approach
- [ ] Breakpoint appropriateness
- [ ] Touch target sizes (min 44px)
- [ ] Content reflow for small screens
## Flags
- `--react`: Force React (.tsx) output
- `--astro`: Force Astro (.astro) output
## References
@references/tailwind-v4-patterns.md
## Usage Examples
```bash
# Basic conversion
/stylish-figma-to-code [figma-url-or-node-id]
# Force React output
/stylish-figma-to-code [figma-url] --react
# Force Astro output
/stylish-figma-to-code [figma-url] --astro
```
## Output Structure
Generated components follow project conventions:
**React Project:**
```text
src/components/
└── ComponentName/
├── index.tsx # Main component
└── ComponentName.tsx # (or single file)
```
**Astro Project:**
```text
src/components/
└── ComponentName.astro # Astro component
```
## Best Practices
1. **Start with structure** - Get the HTML hierarchy right first
2. **Use semantic elements** - Choose elements by meaning, not styling
3. **Apply Tailwind systematically** - Follow class order convention
4. **Test responsiveness** - Verify at multiple breakpoints
5. **Validate accessibility** - Use dev tools and screen readers
6. **Ask when uncertain** - Clarify with user rather than assume
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.