figma-generate-library

Builds Figma design systems with variables, components, and variants from codebase tokens.

Updated May 5, 2026
One-click install
npx skills add https://github.com/UlaYuga/promo-preflight --skill figma-generate-library-ulayuga
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: figma-generate-library
Source: https://github.com/UlaYuga/promo-preflight/tree/main/.agents/skills/figma-generate-library
Command: npx skills add https://github.com/UlaYuga/promo-preflight --skill figma-generate-library-ulayuga

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Translating a codebase's design tokens and components into a structured Figma design system is a long, error-prone process involving dozens of Plugin API calls, and one-shot attempts produce broken or incomplete results. ## Core Features & Use Cases - Phased Workflow Orchestration: Enforces a five-phase build (Discovery, Foundations, File Structure, Components, Integration/QA) with mandatory user checkpoints between phases. - Token Architecture: Creates variable collections with modes (Light/Dark), primitive-to-semantic aliasing, scopes, and code syntax for Dev Mode round-tripping. - Component Generation: Builds components with auto-layout, full variable bindings, variant matrices via combineAsVariants, and TEXT/BOOLEAN/INSTANCE_SWAP properties. - State Management & Recovery: Maintains a persistent state ledger on disk with sharedPluginData tagging for idempotent, resumable long-running builds. - Use Case: Given a React codebase with CSS custom properties and a Button component, the skill extracts tokens, creates Figma variable collections, then builds a Button component set with Size × Style × State variants bound to those tokens. ## Quick Start Ask the AI to build a Figma design system from your codebase using the figma-generate-library skill, starting with a discovery phase and plan approval.

Frequently Asked Questions about figma-generate-library

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Figma design system from my codebase?▼

Start with a discovery phase that extracts tokens from CSS variables, Tailwind config, or theme objects, then inspect the Figma file for existing conventions. Lock scope with the user before creating variable collections, then components, in phased order.

How do I create Figma variables with light and dark modes?▼

Create a variable collection, rename the default mode to Light, and add a Dark mode with addMode. Set per-mode values with setValueForMode, aliasing semantic variables to primitives via VARIABLE_ALIAS references.

Why do Figma variants stack at position 0,0 after combineAsVariants?▼

combineAsVariants places all children at the origin by default. You must manually position each variant in a grid layout and call resizeWithoutConstraints on the component set to fit its contents.

Can I use this skill without the figma-use skill?▼

No, the figma-use skill must also be loaded for every use_figma call. It provides Plugin API syntax rules like the return pattern, page reset, font loading, and color ranges, while this skill provides design system domain knowledge.

What is the maximum number of variants per Figma component set?▼

The skill caps variant matrices at 30 combinations to avoid variant explosion. Larger matrices should be split by a primary axis, use INSTANCE_SWAP properties for icons, or extract sub-elements into Building Block components.

How do I recover when a Figma design system build fails mid-way?▼

Re-read the state ledger file from disk and run a read-only scan to reconstruct the key-to-ID map. Use the cleanup script to remove nodes tagged with the run ID via plugin data, never name-prefix matching.