figma-data-handling
Handle Figma API data correctly: comments, versions, user data, and privacy compliance. Use when working with Figma comments API, version history, or ensuring GDPR compliance for Figma user data. Trigger with phrases like "figma data", "figma comments", "figma versions", "figma GDPR", "figma user data".
What this skill does
# Figma Data Handling
## Overview
Work with Figma's data APIs: comments, version history, and user information. Handle sensitive data correctly with redaction and privacy compliance.
## Prerequisites
- `FIGMA_PAT` with appropriate scopes (`file_comments:read/write`, `file_versions:read`)
- Understanding of GDPR/CCPA basics
## Instructions
### Step 1: Comments API
```typescript
const PAT = process.env.FIGMA_PAT!;
const FILE_KEY = process.env.FIGMA_FILE_KEY!;
// GET /v1/files/:key/comments -- requires file_comments:read scope
async function getComments(fileKey: string) {
const res = await fetch(
`https://api.figma.com/v1/files/${fileKey}/comments`,
{ headers: { 'X-Figma-Token': PAT } }
);
const data = await res.json();
// data.comments is an array of:
// { id, message, file_key, parent_id, user, client_meta, resolved_at, created_at, order_id }
return data.comments;
}
// GET with as_md=true to get rich-text comments as markdown
async function getCommentsAsMarkdown(fileKey: string) {
const res = await fetch(
`https://api.figma.com/v1/files/${fileKey}/comments?as_md=true`,
{ headers: { 'X-Figma-Token': PAT } }
);
return (await res.json()).comments;
}
// POST /v1/files/:key/comments -- requires file_comments:write scope
async function postComment(fileKey: string, message: string, nodeId?: string) {
const body: any = { message };
if (nodeId) {
body.client_meta = { node_id: nodeId };
}
const res = await fetch(
`https://api.figma.com/v1/files/${fileKey}/comments`,
{
method: 'POST',
headers: {
'X-Figma-Token': PAT,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
}
);
return res.json();
}
// POST reactions to a comment -- requires file_comments:write
async function reactToComment(fileKey: string, commentId: string, emoji: string) {
return fetch(
`https://api.figma.com/v1/files/${fileKey}/comments/${commentId}/reactions`,
{
method: 'POST',
headers: {
'X-Figma-Token': PAT,
'Content-Type': 'application/json',
},
body: JSON.stringify({ emoji }),
}
).then(r => r.json());
}
```
### Step 2: Version History API
```typescript
// GET /v1/files/:key/versions -- requires file_versions:read scope
async function getVersionHistory(fileKey: string) {
const res = await fetch(
`https://api.figma.com/v1/files/${fileKey}/versions`,
{ headers: { 'X-Figma-Token': PAT } }
);
const data = await res.json();
// data.versions: array of { id, created_at, label, description, user }
// Ordered by created_at (most recent first)
return data.versions;
}
// Paginate through all versions
async function getAllVersions(fileKey: string) {
const versions: any[] = [];
let url: string | null = `https://api.figma.com/v1/files/${fileKey}/versions`;
while (url) {
const res = await fetch(url, { headers: { 'X-Figma-Token': PAT } });
const data = await res.json();
versions.push(...data.versions);
// Pagination uses cursor-based pagination
url = data.pagination?.next_page
? `https://api.figma.com/v1/files/${fileKey}/versions?before=${data.pagination.next_page}`
: null;
}
return versions;
}
```
### Step 3: User Data and Privacy
```typescript
// GET /v1/me -- returns authenticated user
interface FigmaUser {
id: string;
handle: string;
img_url: string;
email: string; // PII -- handle carefully
}
// Redact PII before logging or storing
function redactFigmaUser(user: FigmaUser): Omit<FigmaUser, 'email'> & { email: string } {
return {
...user,
email: '[REDACTED]',
img_url: '[REDACTED]',
};
}
// Data classification for Figma responses
interface DataClassification {
field: string;
sensitivity: 'public' | 'internal' | 'pii';
handling: string;
}
const figmaDataClassification: DataClassification[] = [
{ field: 'user.email', sensitivity: 'pii', handling: 'Encrypt at rest, redact in logs' },
{ field: 'user.handle', sensitivity: 'internal', handling: 'Do not expose to unauthorized users' },
{ field: 'user.img_url', sensitivity: 'pii', handling: 'Do not cache without consent' },
{ field: 'file.name', sensitivity: 'internal', handling: 'Standard handling' },
{ field: 'comment.message', sensitivity: 'internal', handling: 'May contain PII -- scan before storing' },
{ field: 'PAT token', sensitivity: 'pii', handling: 'Never log, never store in code' },
];
```
### Step 4: Data Retention
```typescript
// Figma image export URLs expire after 30 days
// Plan data retention accordingly
interface CachedFigmaData {
data: any;
fetchedAt: Date;
expiresAt: Date;
}
function createCacheEntry(data: any, ttlMs: number): CachedFigmaData {
const now = new Date();
return {
data,
fetchedAt: now,
expiresAt: new Date(now.getTime() + ttlMs),
};
}
// Cleanup expired entries
async function cleanupExpiredData(db: any) {
const now = new Date();
const deleted = await db.figmaCache.deleteMany({
expiresAt: { $lt: now },
});
console.log(`Cleaned up ${deleted.count} expired Figma cache entries`);
}
```
### Step 5: Safe Logging
```typescript
// Never log these fields from Figma responses
const REDACT_FIELDS = ['email', 'img_url', 'access_token', 'refresh_token'];
function safeFigmaLog(label: string, data: any) {
const safe = JSON.parse(JSON.stringify(data));
function redact(obj: any) {
for (const key of Object.keys(obj)) {
if (REDACT_FIELDS.includes(key)) {
obj[key] = '[REDACTED]';
} else if (typeof obj[key] === 'object' && obj[key] !== null) {
redact(obj[key]);
}
}
}
redact(safe);
console.log(`[figma] ${label}:`, JSON.stringify(safe));
}
```
## Output
- Comments fetched and posted via REST API
- Version history retrieved with pagination
- PII redacted before logging and storage
- Data retention policies applied
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| 403 on comments | Missing `file_comments:read` scope | Regenerate PAT with scope |
| Empty version history | New file with no saved versions | Create a named version in Figma first |
| PII in logs | Missing redaction | Apply `safeFigmaLog` wrapper |
| Stale image URLs | URLs older than 30 days | Re-export images; do not cache URLs long-term |
## Resources
- [Figma Comments Endpoints](https://developers.figma.com/docs/rest-api/comments-endpoints/)
- [Figma Version History](https://developers.figma.com/docs/rest-api/version-history-endpoints/)
- GDPR Developer Guide
## Next Steps
For enterprise access control, see `figma-enterprise-rbac`.
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.