figma-sdk-patterns

Featured

Production-ready patterns for the Figma REST API and Plugin API. Use when building reusable Figma client wrappers, extracting design tokens, traversing node trees, or creating typed API helpers. Trigger with phrases like "figma patterns", "figma best practices", "figma client wrapper", "figma typed API".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Figma SDK Patterns ## Overview Production patterns for the Figma REST API (external tools) and Plugin API (in-editor plugins). Figma has no official Node.js SDK -- you call `https://api.figma.com` directly with `fetch`. These patterns give you type safety, error handling, and reusable abstractions. ## Prerequisites - `FIGMA_PAT` environment variable set - TypeScript 5+ project - Understanding of Figma node types ## Instructions ### Step 1: Typed REST API Client ```typescript // src/figma-client.ts export class FigmaClient { private baseUrl = 'https://api.figma.com'; constructor(private token: string) { if (!token) throw new Error('Figma token is required'); } private async request<T>(path: string, init?: RequestInit): Promise<T> { const res = await fetch(`${this.baseUrl}${path}`, { ...init, headers: { 'X-Figma-Token': this.token, 'Content-Type': 'application/json', ...init?.headers, }, }); if (res.status === 429) { const retryAfter = parseInt(res.headers.get('Retry-After') || '60'); throw new FigmaRateLimitError(retryAfter); } if (res.status === 403) throw new FigmaAuthError('Invalid or expired token'); if (res.status === 404) throw new FigmaNotFoundError(path); if (!res.ok) throw new FigmaApiError(res.status, await res.text()); return res.json(); } async getFile(fileKey: string) { return this.request<FigmaFileResponse>(`/v1/files/${fileKey}`); } async get...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category