- ๐จ : Automatically parses Figma files for color palettes, typography scales, spacing, shadows, and component hierarchies. - ๐ : Exports standard tokens.
Overview
- ๐จ : Automatically parses Figma files for color palettes, typography scales, spacing, shadows, and component hierarchies. - ๐ : Exports standard tokens.
README
๐จ figma-ds-agent
Extract Design Systems & Tokens from Figma into React Components and AI Agent Skills using OpenAI Codex.
๐ Features
- ๐จ Figma Token Extraction: Automatically parses Figma files for color palettes, typography scales, spacing, shadows, and component hierarchies.
- ๐ W3C Design Tokens Standard Format: Exports standard
tokens.jsoncompliant with W3C Design Tokens Community Group specification. - ๐ค AI-Powered Code Generation: Uses OpenAI Codex / GPT models to convert raw Figma AST into production-ready React components with Tailwind CSS.
- โก AI Agent Skill Output (
SKILL.md): Exports structured design system rules directly consumable by AI coding assistants (Antigravity, Cursor, GitHub Copilot). - ๐ ๏ธ CLI Integration: Easy-to-use command line interface for CI/CD pipelines or local development.
๐ฆ Installation
npm install -g figma-ds-agent
Or run directly via npx:
npx figma-ds-agent extract --url "https://www.figma.com/file/YOUR_FIGMA_FILE_KEY"
๐ Quick Start
1. Set Environment Variables
Create a .env file or export your tokens:
export FIGMA_ACCESS_TOKEN="figd_your_figma_personal_access_token"
export OPENAI_API_KEY="sk-proj-your_openai_api_key"
2. Extract Design System
Run the CLI command:
figma-ds-agent extract --url "https://www.figma.com/file/aBc123Xyz/Design-System" --output ./my-design-system
Output Files:
ast.json: Raw normalized Design System JSON AST.tokens.css: CSS Variables and Tailwind configuration tokens.Components.tsx: Auto-generated React components with accessibility standards.SKILL.md: Design System rulebook formatted for AI Coding Agents.
๐ก OpenAI Codex Integration Showcase
figma-ds-agent uses OpenAI Codex APIs to bridge the gap between design specs and code:
- Figma REST API Parsing: Normalizes complex canvas trees into lightweight Design Token JSON.
- Codex Prompting: Converts AST into semantic React code adhering to WCAG accessibility guidelines.
- Agentic Context: Exports
SKILL.mdto ensure AI Coding Agents produce pixel-perfect UI according to design tokens.
๐ค Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
๐ License
This project is licensed under the MIT License.
Recommended Tools
Try a different keyword or remove a filter.
Install
npx skillfish add hanvietanh/figma-ds-agent