Generates custom design system rules for the user's codebase. Use when user says "create design system rules", "generate rules for my project", "set up design rules", "customize design system guidelines", or wants to establish project-specific conventions for Figma-to-code workflows. Requires Figma MCP server connection.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill helps you generate custom design system rules tailored to your project's specific needs. These rules guide Claude to produce consistent, high-quality code when implementing Figma designs, ensuring that your team's conventions, component patterns, and architectural decisions are followed automatically.
Design system rules are project-level instructions that encode the "unwritten knowledge" of your codebase - the kind of expertise that experienced developers know and would pass on to new team members:
Once defined, these rules dramatically reduce repetitive prompting and ensure consistent output across all Figma implementation tasks.
Use this skill when:
Follow these steps in order. Do not skip steps.
Call the Figma MCP server's create_design_system_rules tool to get the foundational prompt and template.
Parameters:
clientLanguages: Comma-separated list of languages used in the project (e.g., "typescript,javascript", "python", "javascript")clientFrameworks: Framework being used (e.g., "react", "vue", "svelte", "angular", "unknown")This tool returns guidance and a template for creating design system rules.
Structure your design system rules following the template format provided in the tool's response.
Before finalizing rules, analyze the project to understand existing patterns:
Component Organization:
src/components/, app/ui/, lib/components/)Styling Approach:
Component Patterns:
Architecture Decisions:
Based on your codebase analysis, create a comprehensive set of rules. Include:
- IMPORTANT: Always use components from `[YOUR_PATH]` when possible
- Place new UI components in `[COMPONENT_DIRECTORY]`
- Follow `[NAMING_CONVENTION]` for component names
- Components must export as `[EXPORT_PATTERN]`
- Use `[CSS_FRAMEWORK/APPROACH]` for styling
- Design tokens are defined in `[TOKEN_LOCATION]`
- IMPORTANT: Never hardcode colors - always use tokens from `[TOKEN_FILE]`
- Spacing values must use the `[SPACING_SYSTEM]` scale
- Typography follows the scale defined in `[TYPOGRAPHY_LOCATION]`
## Figma MCP Integration Rules
These rules define how to translate Figma inputs into code for this project and must be followed for every Figma-driven change.
### Required Flow (do not skip)
1. Run get_design_context first to fetch the structured representation for the exact node(s)
2. If the response is too large or truncated, run get_metadata to get the high-level node map, then re-fetch only the required node(s) with get_design_context
3. Run get_screenshot for a visual reference of the node variant being implemented
4. Only after you have both get_design_context and get_screenshot, download any assets needed and start implementation
5. Translate the output (usually React + Tailwind) into this project's conventions, styles, and framework
6. Validate against Figma for 1:1 look and behavior before marking complete
### Implementation Rules
- Treat the Figma MCP output (React + Tailwind) as a representation of design and behavior, not as final code style
- Replace Tailwind utility classes with `[YOUR_STYLING_APPROACH]` when applicable
- Reuse existing components from `[COMPONENT_PATH]` instead of duplicating functionality
- Use the project's color system, typography scale, and spacing tokens consistently
- Respect existing routing, state management, and data-fetch patterns
- Strive for 1:1 visual parity with the Figma design
- Validate the final UI against the Figma screenshot for both look and behavior
## Asset Handling
- The Figma MCP server provides an assets endpoint which can serve image and SVG assets
- IMPORTANT: If the Figma MCP server returns a localhost source for an image or SVG, use that source directly
- IMPORTANT: DO NOT import/add new icon packages - all assets should be in the Figma payload
- IMPORTANT: DO NOT use or create placeholders if a localhost source is provided
- Store downloaded assets in `[ASSET_DIRECTORY]`
## Project-Specific Conventions
- [Add any unique architectural patterns]
- [Add any special import requirements]
- [Add any testing requirements]
- [Add any accessibility standards]
- [Add any performance considerations]
Guide the user to save the generated rules to the CLAUDE.md file in their project root:
# MCP Servers
## Figma MCP Server Rules
[Paste generated rules here]
After saving, the rules will be automatically loaded by Claude Code and applied to all Figma implementation tasks.
After creating rules:
Component Discovery:
- UI components are located in `src/components/ui/`
- Feature components are in `src/components/features/`
- Layout primitives are in `src/components/layout/`
Design Token Usage:
- Colors are defined as CSS variables in `src/styles/tokens.css`
- Never hardcode hex colors - use `var(--color-*)` tokens
- Spacing uses the 4px base scale: `--space-1` (4px), `--space-2` (8px), etc.
Styling Approach:
- Use Tailwind utility classes for styling
- Custom styles go in component-level CSS modules
- Theme customization is in `tailwind.config.js`
Component Patterns:
- All components must accept a `className` prop for composition
- Variant props should use union types: `variant: 'primary' | 'secondary'`
- Icon components should accept `size` and `color` props
Import Conventions:
- Use path aliases: `@/components`, `@/styles`, `@/utils`
- Group imports: React, third-party, internal, types
- No relative imports beyond parent directory
Code Quality:
- Add JSDoc comments for exported components
- Include PropTypes or TypeScript types for all props
- Extract magic numbers to named constants
Accessibility:
- All interactive elements must have aria-labels
- Color contrast must meet WCAG AA standards
- Keyboard navigation required for all interactions
Performance:
- Lazy load images with the `Image` component from `@/components/Image`
- Use React.memo for components that receive complex props
- Icons should be SVG components, not icon fonts
Testing:
- Include unit tests for new components in `__tests__/` directory
- Use Testing Library queries (getByRole, getByLabelText)
- Test all interactive states and variants
User says: "Create design system rules for my React project"
Actions:
create_design_system_rules(clientLanguages="typescript,javascript", clientFrameworks="react")# Figma MCP Integration Rules
## Component Organization
- UI components are in `src/components/ui/`
- Page components are in `src/app/`
- Use Tailwind for styling
## Figma Implementation Flow
1. Run get_design_context for the node
2. Run get_screenshot for visual reference
3. Map Figma colors to Tailwind colors defined in `tailwind.config.js`
4. Reuse components from `src/components/ui/` when possible
5. Validate against screenshot before completing
## Styling Rules
- IMPORTANT: Use Tailwind utility classes, not inline styles
- Colors are defined in `tailwind.config.js` theme.colors
- Spacing uses Tailwind's default scale
- Custom components go in `src/components/ui/`
## Asset Rules
- IMPORTANT: Use localhost sources from Figma MCP server directly
- Store static assets in `public/assets/`
- DO NOT install new icon libraries
CLAUDE.md in project rootResult: Claude now consistently follows the project's conventions when implementing Figma designs.
User says: "Set up Figma rules for my Vue app"
Actions:
create_design_system_rules(clientLanguages="typescript,javascript", clientFrameworks="vue")# Figma MCP Integration Rules
## Component Organization
- Components are in `src/components/`
- Composables are in `src/composables/`
- Vue SFC structure: <script setup>, <template>, <style scoped>
## Design Tokens
- IMPORTANT: All colors defined in `src/styles/tokens.css` as CSS variables
- Use `var(--color-primary)`, `var(--color-secondary)`, etc.
- Spacing: `var(--space-xs)` through `var(--space-xl)`
- Typography: `var(--text-sm)` through `var(--text-2xl)`
## Figma Implementation Flow
1. Run get_design_context and get_screenshot
2. Translate React output to Vue 3 Composition API
3. Map Figma colors to CSS variables in `src/styles/tokens.css`
4. Use CSS Modules for component styles
5. Check for existing components in `src/components/` before creating new ones
## Styling Rules
- Use CSS Modules (`.module.css` files)
- IMPORTANT: Reference design tokens, never hardcode values
- Scoped styles with CSS modules
CLAUDE.md in project rootResult: Claude now correctly translates Figma designs to Vue components using the project's design token system.
User says: "Generate rules for our design system library"
Actions:
create_design_system_rules(clientLanguages="typescript", clientFrameworks="react")# Design System Rules
## Repository Structure
- Design system components: `packages/design-system/src/components/`
- Documentation: `packages/docs/`
- Design tokens: `packages/tokens/src/`
## Component Development
- IMPORTANT: All components must be in `packages/design-system/src/components/`
- Component file structure: `ComponentName/index.tsx`, `ComponentName.stories.tsx`, `ComponentName.test.tsx`
- Export all components from `packages/design-system/src/index.ts`
## Design Tokens
- Colors: `packages/tokens/src/colors.ts`
- Typography: `packages/tokens/src/typography.ts`
- Spacing: `packages/tokens/src/spacing.ts`
- IMPORTANT: Never hardcode values - import from tokens package
## Documentation Requirements
- Add Storybook story for every component
- Include JSDoc with @example
- Document all props with descriptions
- Add accessibility notes
## Figma Integration
1. Get design context and screenshot from Figma
2. Map Figma tokens to design system tokens
3. Create or extend component in design system package
4. Add Storybook stories showing all variants
5. Validate against Figma screenshot
6. Update documentation
CLAUDE.md and share with teamResult: Entire team follows consistent patterns when adding components from Figma to the design system.
Don't try to capture every rule upfront. Start with the most important conventions and add rules as you encounter inconsistencies.
Instead of: "Use the design system"
Write: "Always use Button components from src/components/ui/Button.tsx with variant prop ('primary' | 'secondary' | 'ghost')"
Each rule should tell Claude exactly what to do, not just what to avoid.
Good: "Colors are defined in src/theme/colors.ts - import and use these constants"
Bad: "Don't hardcode colors"
Prefix rules that must never be violated with "IMPORTANT:" to ensure Claude prioritizes them.
- IMPORTANT: Never expose API keys in client-side code
- IMPORTANT: Always sanitize user input before rendering
When rules seem arbitrary, explain the reasoning:
- Place all data-fetching in server components (reduces client bundle size and improves performance)
- Use absolute imports with `@/` alias (makes refactoring easier and prevents broken relative paths)
Cause: Rules may be too vague or not properly loaded into the IDE/MCP client. Solution:
Cause: Contradictory or overlapping rules. Solution:
Cause: Excessive rules increase context size and processing time. Solution:
Cause: Codebase changes but rules don't. Solution:
Design system rules transform how Claude works with your Figma designs:
Before rules:
After rules:
The time invested in creating good rules pays off exponentially across every Figma implementation task.