figma-context-budget
Skill73 starsChanged 11 days agoMITView on GitHub
Use BEFORE any Figma MCP tool call during design-to-code work — reading, planning, or implementing a Figma design. Complements implement-design by adding context-budget discipline on top of its code-generation workflow. Do not use when writing back to Figma or when generating new Figma files from code — no budget rules apply there.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- GGGODLIN/claude-skillsedited, first seen May 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- GGGODLIN/claude-skills★ 074% same
Wrote their own version · 0
None found.
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 repository42 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- folder-level/CLAUDE.mdCLAUDE.md
- absorb-packSkill
- agent-authoringSkill
- agent-dispatchSkill
- align-intentSkill
- auto-choiceSkill
- brainstormSkill
- cavemanSkill
- check-my-stackSkill
- debuggingSkill
- domain-modelingSkill
- e2e-contractSkill
- e2e-explore-then-batchSkill
- e2e-routeSkill
- find-skillsSkill
- gate-authoringSkill
- github-repo-researchSkill
- grill-meSkill
- grill-with-docsSkill
- handoff-implSkill
- implementSkill
- model-onboardSkill
- mutation-testingSkill
- prototypeSkill
- receiving-code-reviewSkill
- research-before-answerSkill
- resolving-merge-conflictsSkill
- review-implementSkill
- review-methodSkill
- review-zhSkill
- skill-creatorSkill
- strategic-compactSkill
- tddSkill
- to-questionnaireSkill
- to-specSkill
- to-ticketsSkill
- wayfinderSkill
- wizardSkill
- workflow-hardeningSkill
- write-pr-descriptionSkill
- zoom-outSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 7 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Does not apply when writing back to Figma (use_figma) or when building new Figma files from code — no budget rules needed there.
- Distinctive: line 50
Check that repo's existing design-token convention first (theme / tokens file).
- Very specific: line 54
Before calling get_variable_defs, check whether the repo's token cache file (see Cache location above) exists and is non-empty.
- Distinctive: line 55
If it exists: read that file instead of calling MCP.
- Very specific: line 56
If it does NOT exist: call get_variable_defs once (a single extraction is enough — the cache file becomes source of truth), then write the …
- Distinctive: line 57
Never re-extract tokens mid-implementation.
- Very specific: line 75
When get_metadata reveals an instance of a mapped component, note its mainComponent name.
- Very specific: line 76
Check components/, features/*/components/, or proj-app/libs/*/components/ for the mapped React component.
- Very specific: line 77
If found: emit <LocalComponent {...propsFromFigma} /> directly.
- Very specific: line 78
Only call get_design_context when the component is net-new or intentionally being redesigned.
- Very specific: line 92
Before any get_design_context call, confirm what is selected.
- Distinctive: line 93
If the selection is a Frame / Page / Section, instruct the user to narrow selection in Figma to a single component or the smallest …
- Very specific: line 94
Do not proceed with get_design_context until selection is component-level.
- Very specific: line 114
After EVERY get_design_context call, immediately scan for data-(link-)?annotations in the response.
- Distinctive: line 115
Treat each annotation as a hard requirement equal in weight to layout and text content.
- Distinctive: line 116
When summarizing a component's spec for a plan or implementation, list extracted annotations alongside layout and copy.
- Very specific: line 140
After Plan phase completes, write the task list to docs/ or a plan file.
- Very specific: line 142
Never keep get_design_context output from a previous component in context while working on the next one.
- Distinctive: line 158
If the project has a workflow-side companion skill, invoke both:
- Very specific: line 161
Other projects: check .claude/skills/ for figma-* workflow skills.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Figma Context Budget
Purpose
get_design_context on a full Frame can return 50k+ tokens of raw node JSON and blow the context window. This skill enforces four rules that keep Figma MCP usage context-efficient.
This skill complements implement-design — it adds context discipline on top of the code-generation workflow. Do not skip the code-gen skill; run this one alongside it.
Skill Boundaries
- Triggers when the user asks to read, plan, or implement Figma designs using any Figma MCP tool that返回 design context (
get_design_context/get_metadata/get_screenshot等——不釘 server namespace,因為mcp__figma-desktop__*與mcp__claude_ai_Figma__*兩個 connector 都可能命中). - Does not apply when writing back to Figma (
use_figma) or when building new Figma files from code — no budget rules needed there.
Rule 1 — Phase Separation (hard rule)
Plan phase is lightweight. Implement phase is per-component. Never mix.
| Phase | Goal | Allowed tools | Forbidden |
| Plan | Understand overall structure, slice into tasks | get_screenshot, get_metadata | get_design_context |
| Implement | Build a single component/section | get_design_context on the selected component only (full-Frame JSON blows the window, see Purpose) | Calling on a whole Frame or Page |
Required flow
- Plan phase: screenshot + metadata → produce a task list (save to a markdown file if non-trivial).
- Between phases: prompt the user to
/clearor open a new session. Main session should not hold plan artifacts during implementation. - Implement phase: per component, repeat
get_design_context→ generate code → validate. After everyget_design_context, immediately scan annotations (Rule 5).
Red flags (stop and re-check)
- About to call
get_design_contextbut no plan exists yet → go to Plan phase first. - About to call
get_design_contexton a selection that is a Frame, Page, or Section → narrow to a single component or the smallest meaningful sub-tree. - About to call
get_design_contexton a complex multi-section page → split into multiple calls, one per section, ideally across sessions.
Rule 2 — Design Tokens Cache (one-time extraction, then read from disk)
Never call get_variable_defs if a cached tokens file exists in the project.
Cache location (per repo)
- Check that repo's existing design-token convention first (theme / tokens file); if none, write the first extraction to a sensible location in that repo and treat it as the cache from then on.
Protocol
- Before calling
get_variable_defs, check whether the repo's token cache file (see Cache location above) exists and is non-empty. - If it exists: read that file instead of calling MCP. Treat it as source of truth for colors, spacing, typography.
- If it does NOT exist: call
get_variable_defsonce (a single extraction is enough — the cache file becomes source of truth), then write the output to the cache file as typed constants. Do this before writing any component code. - Never re-extract tokens mid-implementation. If a new token is genuinely missing, add it to the cache file in a dedicated call.
Shape
export const color = { primary: '#1890FF', /* ... */ } as const
export const spacing = { xs: 4, sm: 8, md: 16, lg: 24 } as const
export const typography = { /* ... */ } as constRule 3 — Code Connect Short-Circuit
If a Figma component has an existing Code Connect mapping to a local React component, skip Figma MCP entirely for that component.
Protocol
- When
get_metadatareveals an instance of a mapped component, note itsmainComponentname. - Check
components/,features/*/components/, orproj-app/libs/*/components/for the mapped React component. - If found: emit
<LocalComponent {...propsFromFigma} />directly. Do NOT callget_design_contexton the instance — the component's own implementation is the source of truth, not Figma's node data. - Only call
get_design_contextwhen the component is net-new or intentionally being redesigned.
Why
A mapped component's visual spec is already captured in code. Re-fetching its Figma node data duplicates information and inflates context for no gain.
Rule 4 — Selection Granularity (figma-desktop MCP only)
The user's Figma selection determines context size. Coach the user on selection before calling.
Protocol
- Before any
get_design_contextcall, confirm what is selected. If unknown, callget_metadatafirst — its output reveals the current selection scope. - If the selection is a Frame / Page / Section, instruct the user to narrow selection in Figma to a single component or the smallest meaningful sub-tree.
- Do not proceed with
get_design_contextuntil selection is component-level.
Example dialogue
"Your current Figma selection looks like the entire
HomepageFrame. Please select just theProductCardcomponent and confirm — I'll then fetch its design context."
Rule 5 — Annotation Extraction (hard rule)
get_design_context returns annotations as data-annotations="..." and data-link-annotations="..." attributes. These are part of the spec, not optional decoration. Skipping them ships visually-correct but behaviorally-wrong code.
What annotations encode
data-annotations="Zendesk"/"GTM"/"關閉後當天不再顯示"→ behavioral spec: which integration wires up, dismissal persistence, trigger events, accessibility hintsdata-link-annotations="[text](url)"→ designer-specified URL: button targets, form endpoints, external link destinations- Other free-text annotations → constraints, edge-case behavior, designer notes
Protocol
- After EVERY
get_design_contextcall, immediately scan fordata-(link-)?annotationsin the response. Run it as the first action, before reading layout/copy. - Treat each annotation as a hard requirement equal in weight to layout and text content.
- When summarizing a component's spec for a plan or implementation, list extracted annotations alongside layout and copy. Do not silently drop them.
- Annotation conflicts with Asana / Google Doc / Slack thread → annotation wins (consistent with Figma-source-of-truth rule).
- Component has annotations but implementation ignores them → STOP. The spec is incomplete; do not write code yet.
Why
Annotations encode the things that aren't visually obvious: which trigger behavior wires up to which UI control, what URL a button goes to, dismissal persistence, accessibility hints. Visual layout alone cannot communicate these.
Pre-flight Checklist (before ANY Figma MCP call)
- Am I in Plan or Implement phase? (if unclear, default to Plan)
- If Plan: am I only using
get_screenshot/get_metadata? - If Implement: is the user's selection a single component (not a Frame)?
- Does the repo's design-token cache file already exist? (avoid
get_variable_defsif so) - Is the target component already Code-Connect-mapped? (skip MCP if so)
- Does the main session already hold prior Figma context? (suggest
/clearor sub-agent isolation if so) - After each
get_design_context, did I scan fordata-(link-)?annotationsand treat them as spec? (Rule 5 — non-negotiable)
Session Hygiene
- After Plan phase completes, write the task list to
docs/or a plan file. For the/clearbetween phases, see Required flow Step 2. - For multi-component implementation, prefer the Task tool (sub-agent) per component so main-session context stays small. Sub-agent returns only the file paths and a short summary.
- Never keep
get_design_contextoutput from a previous component in context while working on the next one.
When This Skill Does Not Apply
- User explicitly asks to ignore context budget for a quick one-off.
- Single tiny component where full-Frame fetch is still under ~5k tokens (rare; do not assume, check with
get_metadatafirst). - Reading
get_screenshotalone (no node JSON is returned).
Cross-skill: Workflow companion
This skill enforces HOW to talk to Figma MCP efficiently (context engineering). It does NOT cover WHAT Figma-driven feature work produces (spec / plan / QA artifacts, 5-stage workflow, retro discipline).
If the project has a workflow-side companion skill, invoke both:
- oldco-shop repo:
.claude/skills/figma-to-production/SKILL.md— 5-stage process (figma-scan → spec/plan → implement → QA → ship), artifact templates, retrospective references. Invoke at first Figma MCP call alongside this skill. - Other projects: check
.claude/skills/forfigma-*workflow skills. If none, this skill alone is sufficient.
Phase split discipline (resolves the figma-to-production Phase 1 "三欄 raw 屬性" requirement vs this skill's get_design_context-forbidden Plan phase):
- Plan phase (this skill's tool restriction):
get_metadata+get_screenshot→ produce structure / node-ID map / component breakdown in figma-spec.md, leave raw-attr columns as TODO - Implement phase: per-component sub-agent runs
get_design_context→ fills raw fills/dimensions/typography + scans annotations into the same figma-spec.md (Rule 5 applies)
This hybrid is the canonical split; do not try to satisfy "raw 屬性 in Plan phase" by full-frame get_design_context — that violates Rule 1.
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
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.

