agentleFS
senlindesignsenlindesign/claude2figma/.claude/skills/figma-preflight/SKILL.md

figma-preflight

Skill194 starsChanged 7 months agoMITView on GitHub

Triggers on 'let's start', 'begin', 'preflight', 'start the session', or when a Figma file URL is first shared. Verifies MCP connection, reads CLAUDE.md, audits connected libraries, and loads a Token Map of all Styles and Variables — required before any design work.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. thiagoxikota/figma-maxxing★ 12same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run at the start of every design session.

    line 9
  2. Distinctive:

    Run these two in parallel:

    line 17
  3. Very specific:

    MCP Connection: Call mcp__figma__whoami. Must return user email and plan.

    line 19
  4. Distinctive:

    CLAUDE.md: Read CLAUDE.md. Extract Figma file URL (required — stop if missing), font families, session goal.

    line 20
  5. Very specific:

    File Access: Call get_metadata with extracted nodeId and fileKey.

    line 28
  6. Very specific:

    Libraries: Call get_libraries with fileKey.

    line 29
  7. Very specific:

    After Step C, derive a semantic index from variables grouped by scopes:

    line 81
  8. Distinctive:

    If any step fails, output ❌ with error and stop.

    line 117

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Figma Preflight

Run at the start of every design session. Do NOT start design work until all steps pass.

Prerequisite: Load figma-use skill before any use_figma call.


Step A — Connection + Config (parallel)

Run these two in parallel:

  1. MCP Connection: Call mcp__figma__whoami. Must return user email and plan. Fail → stop, re-authenticate.
  2. CLAUDE.md: Read CLAUDE.md. Extract Figma file URL (required — stop if missing), font families, session goal. If fonts field is a placeholder, auto-populate after Step C using STRING variables starting with "Family".

Step B — File + Libraries (parallel)

Parse fileKey from the Figma URL, then run in parallel:

  1. File Access: Call get_metadata with extracted nodeId and fileKey. Must return file name and pages.
  2. Libraries: Call get_libraries with fileKey. Store subscribed libraries as Library Registry (name, libraryKey, description). These enable search_design_system to find library styles and components during design work.

Step C — Styles + Variables + Components (single use_figma call)

Combine all three inventories in one script:

const textStyles = await figma.getLocalTextStylesAsync();
const paintStyles = await figma.getLocalPaintStylesAsync();
const collections = await figma.variables.getLocalVariableCollectionsAsync();
const variables = await figma.variables.getLocalVariablesAsync();

const grouped = {};
for (const v of variables) {
  const key = v.resolvedType;
  if (!grouped[key]) grouped[key] = [];
  grouped[key].push({ name: v.name, scopes: v.scopes });
}

const components = {};
for (const page of figma.root.children) {
  await figma.setCurrentPageAsync(page);
  const sets = page.findAll(n => n.type === "COMPONENT_SET");
  const solos = page.findAll(n => n.type === "COMPONENT" && n.parent.type !== "COMPONENT_SET");
  if (sets.length > 0 || solos.length > 0) {
    components[page.name] = {
      sets: sets.map(c => c.name),
      solos: solos.map(c => c.name).slice(0, 15),
    };
  }
}

return {
  textStyles: textStyles.map(s => s.name),
  paintStyles: paintStyles.map(s => s.name),
  collections: collections.map(c => c.name),
  variableCount: variables.length,
  byType: Object.fromEntries(
    Object.entries(grouped).map(([type, vars]) => [type, vars.map(v => v.name)])
  ),
  components
};

Store names only in context. IDs are looked up on-demand during design work. Library styles/variables are discovered via search_design_system.


Token Map

After Step C, derive a semantic index from variables grouped by scopes:

RoleScopeExample names
Background fillFRAME_FILL, SHAPE_FILLbackground/surface, color/neutral-100
Text colorTEXT_FILLtext/primary, color/neutral-900
Border / strokeSTROKE_COLORborder/default, color/neutral-300
GapGAPgap/sm, spacing/xxs
PaddingPADDINGpadding/md, spacing/section-xl
Border radiusCORNER_RADIUSradius/sm, radius/full

Status Report

✅ MCP Connection    — [name] ([email]) · [plan]
✅ CLAUDE.md         — Font: [primary] / [code] · Goal: [goal]
✅ Figma File        — [file name] · [N] pages
✅ Libraries         — [N] connected: [names]
✅ Styles            — [N] text + [N] paint
✅ Variables         — [N] across [N] collections
✅ Components        — [N] sets across [N] pages

── Token Map ──────────────────────────────
Background  : [names]
Text        : [names]
Border      : [names]
Gap         : [names]
Padding     : [names]
Radius      : [names]
────────────────────────────────────────────

Ready to design.

If any step fails, output ❌ with error and stop.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.