
claude2figma-design-system-harness
Enforce Design System compliance in AI-generated Figma designs with 4 skills that bind components, tokens, and styles
- Installs
- 123
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/reason-machines/design-skills --skill claude2figma-design-system-harness- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads claude2figma-design-system-harness automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
claude2figma Design System Harness
Skill by ara.so — Design Skills collection.
A harness for Claude Code + Figma that enforces Design System compliance in AI-generated designs. Prevents hardcoded values, ensures components stay linked, and binds all visual properties to tokens and styles.
What This Does
When AI writes to Figma without guidance, it creates everything from scratch:
- Hardcoded hex colors instead of color tokens
- Raw spacing values instead of spacing variables
- Components rebuilt from primitives instead of instances
claude2figma fixes this with 4 Claude Code Skills:
- figma-preflight — 3-step parallel check that loads Token Map + Component Registry
- component-rules — Library-first lookup, Auto Layout patterns, semantic naming
- figma-style-binding — Enforces Variable/Style binding + post-write QA verification
- reference-interpreter — Converts screenshots/references → structured Design Brief
Every design operation follows: search DS → create Instances → bind tokens → verify.
Installation
Prerequisites
# 1. Claude Code installed (CLI, Desktop, or VS Code)
# 2. Figma MCP Server installed and authenticated
npm install -g @anthropic-ai/figma-mcp
# 3. A Figma file with a Design System (local or linked library)
Setup
# Clone the repo
git clone https://github.com/senlindesign/claude2figma.git
cd claude2figma
# Copy skills to your project
cp -r .claude/skills/* /path/to/your-project/.claude/skills/
# Copy settings
cp .claude/settings.json /path/to/your-project/.claude/settings.json
# Copy CLAUDE.md template
cp CLAUDE.md.template /path/to/your-project/CLAUDE.md
Configure CLAUDE.md
# Figma Design Project
- **Figma file:** https://www.figma.com/design/YOUR_FILE_KEY/...
- **Fonts:** [leave blank — auto-detected by preflight]
- **Session goal:** Build login page with email/password fields
## Rules
1. Every visual value must bind to a Style or Variable.
2. Always search connected libraries before building any component from scratch.
3. Never start designing before the Design Brief is confirmed.
Key Skills Structure
Your project should have this structure after installation:
your-project/
├── CLAUDE.md # Config: Figma URL, fonts, rules
└── .claude/
├── settings.json # Permissions + QA Hook
└── skills/
├── figma-preflight/ # Skill 1: Parallel check + Token Map
│ └── SKILL.md
├── component-rules/ # Skill 2: Library-first patterns
│ └── SKILL.md
├── figma-style-binding/ # Skill 3: Token binding + QA
│ └── SKILL.md
└── reference-interpreter/ # Skill 4: Reference → Design Brief
└── SKILL.md
Usage Patterns
Pattern 1: Start Every Session with Preflight
// User says: "let's start" or "run preflight"
// Claude executes figma-preflight skill:
// 1. Parse Figma URL from CLAUDE.md
const fileKey = extractFileKey(CLAUDE_MD_CONTENT);
// 2. Parallel preflight checks
const [mcpStatus, fileAccess, dsAssets] = await Promise.all([
checkMCPConnection(),
verifyFilePermissions(fileKey),
loadDesignSystemAssets(fileKey)
]);
// 3. Build Token Map
const tokenMap = {
colors: await figma.getLocalVariableCollectionsAsync('COLOR'),
spacing: await figma.getLocalVariableCollectionsAsync('NUMBER'),
textStyles: await figma.getLocalTextStylesAsync(),
effectStyles: await figma.getLocalEffectStylesAsync()
};
// 4. Build Component Registry
const components = await figma.getLocalComponentsAsync();
const componentRegistry = components.map(c => ({
name: c.name,
id: c.id,
variantProperties: c.componentPropertyDefinitions
}));
// Output: ✓ Preflight complete — 47 tokens, 23 components loaded
Pattern 2: Component-First Design
// User says: "Add a primary button"
// Claude executes component-rules + figma-style-binding skills:
// 1. Search Component Registry first
const button = componentRegistry.find(c =>
c.name.toLowerCase().includes('button') &&
c.variantProperties?.variant?.includes('primary')
);
if (!button) {
throw new Error('No Button/Primary in DS — check library or request custom component');
}
// 2. Create Instance (not from scratch)
const instance = figma.createInstance();
instance.mainComponent = figma.getNodeById(button.id);
// 3. Set variant properties (validated against componentPropertyDefinitions)
instance.setProperties({ variant: 'primary', size: 'medium' });
// 4. Bind any overrides to tokens
if (instance.children[0].fills) {
const primaryColorVar = tokenMap.colors.find(v => v.name === 'primary');
instance.children[0].fills = [{
type: 'SOLID',
color: { r: 0, g: 0, b: 0 }, // placeholder
boundVariables: { color: { id: primaryColorVar.id } }
}];
}
// 5. Auto-verify after write
await verifyTokenBindings(instance);
Pattern 3: Token Binding Enforcement
// figma-style-binding skill enforces this on EVERY visual property:
// ✅ CORRECT: Bound to variable
node.fills = [{
type: 'SOLID',
boundVariables: { color: { id: tokenMap.colors.find(v => v.name === 'surface').id } }
}];
// ❌ WRONG: Hardcoded hex value
node.fills = [{ type: 'SOLID', color: { r: 1, g: 1, b: 1 } }]; // REJECTED by QA
// Post-write QA verification:
async function verifyTokenBindings(node) {
const violations = [];
if (node.fills && !node.fills[0]?.boundVariables) {
violations.push(`${node.name}: fills not bound to token`);
}
if (node.textStyleId === '') {
violations.push(`${node.name}: no text style bound`);
}
if (violations.length > 0) {
throw new Error(`Token binding violations:\n${violations.join('\n')}`);
}
}
Pattern 4: Reference-Driven Design
// User shares screenshot and says: "Build this"
// Claude executes reference-interpreter skill:
// 1. Analyze reference → structured Design Brief
const designBrief = {
layout: 'Two-column grid, 16px gap',
components: [
{ type: 'Header', contains: ['Logo', 'Navigation/Horizontal', 'Button/Primary'] },
{ type: 'Hero Section', contains: ['Heading/H1', 'Body/Large', 'Button Group'] }
],
tokens: {
colors: ['primary', 'surface', 'on-surface'],
spacing: ['space-4', 'space-8', 'space-16'],
typography: ['heading-1', 'body-large']
}
};
// 2. Output Design Brief to user for confirmation
// 3. User says "looks good"
// 4. Claude builds section by section, following component-rules + style-binding
Configuration
settings.json — QA Hook
{
"mcpServers": {
"figma": {
"command": "npx",
"args": ["-y", "@anthropic-ai/figma-mcp"]
}
},
"qaHooks": {
"postWrite": "verifyTokenBindings"
},
"permissions": {
"figma": ["read", "write"]
}
}
CLAUDE.md — Session Rules
# Figma Design Project
- **Figma file:** https://www.figma.com/design/ABC123/...
- **Session goal:** Build dashboard with data table and filters
## Rules
1. Run preflight before starting design work
2. Every component must be an Instance, not built from scratch
3. Every color, font, spacing must bind to a token
4. Take screenshot after each major section for verification
Real-World Workflow
# Terminal in your project
$ claude-code chat
User: "let's start"
Claude:
✓ MCP connection verified
✓ File permissions confirmed
✓ Design System loaded: 47 tokens, 23 components
Ready to design. What are we building?
User: "Build a login form with email, password, and a submit button"
Claude:
[Searches Component Registry]
Found: Form/Vertical, Input/Email, Input/Password, Button/Primary
[Creates Instances + binds tokens]
- Form container: padding bound to space-6
- Input fields: text style bound to body-medium
- Submit button: fills bound to primary color token
[Takes screenshot]
✓ Verification passed — all tokens bound
Screenshot: [shows form in Figma]
User: "Add a forgot password link below the form"
Claude:
[Searches for Link component]
Not found in registry — creating text node with hyperlink style
[Binds text style + color token]
✓ Verification passed
Troubleshooting
Error: "No components found in registry"
// Cause: Working in a new file without linked library
// Fix: Link your DS library in Figma first
// In Figma: Assets → Libraries → Enable your DS library
// Then re-run preflight to rebuild Component Registry
Error: "Invalid variant property value"
// Cause: setProperties() called with invalid variant value
// Fix: Read componentPropertyDefinitions first
const component = figma.getNodeById(componentId);
const validVariants = component.componentPropertyDefinitions.variant.variantOptions;
// Only use values from validVariants array
instance.setProperties({ variant: validVariants[0] });
Error: "Token binding verification failed"
// Cause: A property was set with a raw value instead of binding to token
// Fix: Always use boundVariables
// ❌ WRONG
node.fills = [{ type: 'SOLID', color: { r: 0.2, g: 0.4, b: 0.8 } }];
// ✅ CORRECT
const token = tokenMap.colors.find(v => v.name === 'primary');
node.fills = [{
type: 'SOLID',
boundVariables: { color: { id: token.id } }
}];
Working with Library Variables (Can't See Them Locally)
// Limitation: getLocalVariablesAsync() only returns file-local variables
// Workaround 1: Instances inherit bindings automatically (no action needed)
// Workaround 2: Import library variable for new frames
const libraryVarKey = 'VariableID:123:456'; // from library file
const importedVar = await figma.variables.importVariableByKeyAsync(libraryVarKey);
frame.fills = [{
type: 'SOLID',
boundVariables: { color: { id: importedVar.id } }
}];
Best Practices
- Always run preflight at session start — loads Token Map + Component Registry
- Search before creating — check componentRegistry before building any UI element
- Bind, don't hardcode — every visual property must reference a token
- Verify after write — QA hook catches token binding violations automatically
- Confirm Design Brief — when working from reference, output structured brief before building
API Reference
Key Figma MCP Methods
// File access
const file = await figma.getFileAsync(fileKey);
// Design System assets
const variables = await figma.getLocalVariableCollectionsAsync();
const textStyles = await figma.getLocalTextStylesAsync();
const components = await figma.getLocalComponentsAsync();
// Instance creation
const instance = figma.createInstance();
instance.mainComponent = masterComponent;
instance.setProperties({ variant: 'primary' });
// Token binding
node.fills = [{
type: 'SOLID',
boundVariables: { color: { id: variableId } }
}];
node.textStyleId = textStyle.id;
// Verification
const bindings = node.boundVariables;
const hasColorBinding = bindings?.fills?.[0]?.color !== undefined;
When to Use This
| ✅ Good For | ❌ Not For |
|---|---|
| Building pages from existing DS | Creating a DS from scratch |
| Natural language → Figma design | Pixel-perfect illustration |
| Ensuring 100% token compliance | FigJam / whiteboard work |
| Working in DS file or with linked library | Free-form design without DS |
License: MIT
Repository: https://github.com/senlindesign/claude2figma
Figma MCP Server: https://www.npmjs.com/package/@anthropic-ai/figma-mcp
FAQ
What does the claude2figma-design-system-harness skill do?
Enforce Design System compliance in AI-generated Figma designs with 4 skills that bind components, tokens, and styles
How do I install claude2figma-design-system-harness?
Run npx skills add https://github.com/reason-machines/design-skills --skill claude2figma-design-system-harness in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/claude2figma-design-system-harness/ (personal) or .claude/skills/claude2figma-design-system-harness/ (project).
Which AI agents can use claude2figma-design-system-harness?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is claude2figma-design-system-harness safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains claude2figma-design-system-harness?
It is published by reason-machines in reason-machines/design-skills. It has 123 recorded installs.
More from reason-machines/design-skills
awesome-claude-design
reason-machines/design-skills
Open the skill to read its SKILL.md instructions.
design-md-chrome-extractor
reason-machines/design-skills
Chrome extension that extracts design systems from websites and generates DESIGN.md or SKILL.md files for AI coding agents using TypeUI format
design-md-format
reason-machines/design-skills
Create and validate DESIGN.md files that give AI coding agents structured understanding of design systems through machine-readable tokens and human-readable rationale.
open-codesign-ai-design
reason-machines/design-skills
Use Open CoDesign to generate prototypes, slides, and PDFs from prompts with Claude, GPT, Gemini, or local models
open-design-ai-prototyping
reason-machines/design-skills
Open the skill to read its SKILL.md instructions.
diagram-design-editorial
reason-machines/design-skills
Create editorial-quality diagrams in HTML + SVG matching your brand — architecture, flowcharts, sequences, timelines, quadrants, and 9 more types.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React 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.