Task: Audit Figma Code Connect Mapping
Audit the specified Figma Code Connect mapping file.
Before starting, load the figma.connect-best-practices SKILL — it contains the canonical rules for every property mapping type (figma.boolean, figma.enum, figma.string, figma.textContent, figma.instance, figma.children, figma.nestedProps) and common pitfalls. Do not duplicate that guidance here; refer to it.
Inputs
You will be provided with a name or path to a Figma Code Connect mapping file.
Code Connect files (.figma.tsx) are colocated with their corresponding components in this repo, typically within the component's local __figma__ directory.
Search for the mapping file and end your task if you cannot find it.
Within the current mapping file:
- Study all the property mappings defined in
props: { ... }of eachfigma.connect()call - Note which Figma variants are covered (indicated by
variant: { ... }) - Note the Figma URL(s) used — you will need these to call the MCP tools
Steps
-
Retrieve Figma component data
Call the Figma MCP
get_context_for_code_connecttool with the fileKey and nodeId from the Figma URL in the mapping file. This is the primary tool for Code Connect authoring. It returns:- Every component property with its exact name, type (
BOOLEAN,VARIANT,TEXT), and key - All variant option values for
VARIANTproperties - The full descendant tree showing which layers reference which properties, and which variants each descendant appears in
This output is the ground truth for your audit. Use it to understand:
- What the exact Figma property names are (they often contain spaces and ordinal words like "show 3rd step")
- Which properties are direct vs. exposed from child layers (the
↳prefix indicates nested/exposed properties) - Which component set variants exist and what their option values are
- Which descendant layers are text nodes vs. instance nodes
- Every component property with its exact name, type (
-
Optional:
get_design_contextfor visual contextIf you need to visually inspect what the component looks like (e.g. to understand a variant you're unsure about), call
get_design_contextwithdisableCodeConnect: true. This returns a screenshot and reference code. It is not a substitute forget_context_for_code_connect— it does not return structured property metadata — but it can help when the property names alone aren't enough to understand the design intent. -
Secondary checks with
get_metadataUse
get_metadataonly as a targeted follow-up for specific layer-type verification — not as a general overview tool. The specific case where it's needed:For every
figma.textContent('LayerName')in the mapping file: callget_metadataon that layer's node ID (found in thedescendantsof theget_context_for_code_connectoutput). Confirm the response shows<text ...>. If it shows<instance>,<frame>,<symbol>, or any other non-text type,figma.textContent()will fail silently at runtime — flag this as an error and suggest a hardcoded placeholder string instead. -
Read the React component source
- Find and read the component's TypeScript source file and any relevant sub-component source files
- Study the available React props
-
Analyze Property Coverage
Using the
get_context_for_code_connectoutput as your source of truth, create a mapping analysis table where each row is a Figma property:Figma Property Type Related React Prop(s) Mapped? Mapping Method Notes For each Figma property, indicate:
- ✅ Fully mapped
- ⚠️ Partially mapped (explain gap)
- ❌ Not mapped (explain why it should or shouldn't be)
Also check variant coverage: does the mapping file have a
figma.connect()call for every combination ofVARIANTproperties? Missing variant connects will cause Figma to show the wrong snippet for some design states. -
Check for common mistakes (reference
figma.connect-best-practicesfor full detail)figma.string('propName')used on a TEXT property that doesn't appear in the component's formal variant names — this passes TypeScript but fails publish with "property does not exist"figma.textContent('LayerName')used on a layer that is an<instance>not a<text>nodefigma.children('LayerName')where the layer name differs across variants — needs splitfigma.connect()calls withvariant: { ... }filters- Properties with the
↳prefix mapped directly withfigma.string()instead offigma.nestedProps() - Boolean props using
figma.boolean('disabled')whendisabledis actually a value of astateenum, not its own property - Intermediate props that aren't real component props — e.g.
show3rd: figma.boolean('show 3rd step')whereshow3rdis not a React prop. These should be assembled into a real prop value usingfigma.boolean()branching instead examplefunction with a body — anexamplethat builds intermediate variables before returning JSX is a sign that the props design needs refactoring. Theexampleshould almost always be a direct JSX return. Note:figma.boolean()returns an opaque descriptor, not a JS boolean —figma.boolean('x') ? a : balways evaluates as truthy and cannot be used for conditional logic outsidefigma.boolean()'s owntrue/falsebranches
-
Generate Report
Provide a summary with:
- Coverage: X/Y Figma properties mapped
- Missing Mappings: Unmapped properties that should be mapped, with suggested mapping method
- Missing Variants: Component variant combinations not covered by the current
figma.connect()calls - Incorrect Mappings: Mappings whose type or method doesn't match the actual Figma property type
- Unnecessary Mappings: Mappings that don't correspond to any Figma property
- Recommended Changes: Prioritized list of improvements with concrete code snippets