HF

hanvietanh/figma-ds-agent

Developer tools
95ย stars ํ’ˆ์งˆ 70 ํŠธ๋ Œ๋“œ 70

- ๐ŸŽจ : Automatically parses Figma files for color palettes, typography scales, spacing, shadows, and component hierarchies. - ๐ŸŒ : Exports standard tokens.

๊ฐœ์š”

- ๐ŸŽจ : 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.json compliant 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:

  1. Figma REST API Parsing: Normalizes complex canvas trees into lightweight Design Token JSON.
  2. Codex Prompting: Converts AST into semantic React code adhering to WCAG accessibility guidelines.
  3. Agentic Context: Exports SKILL.md to 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.

View this README on GitHub

์ถ”์ฒœ ๋„๊ตฌ

๋‹ค๋ฅธ ํ‚ค์›Œ๋“œ๋ฅผ ์ž…๋ ฅํ•˜๊ฑฐ๋‚˜ ํ•„ํ„ฐ๋ฅผ ์ œ๊ฑฐํ•ด ๋ณด์„ธ์š”.

์„ค์น˜

npx skillfish add hanvietanh/figma-ds-agent