figma_extract_contract
Extracts a complete design contract JSON from Figma components, covering props, anatomy, variant overrides, resolved tokens, and a11y contrast pairs for design-to-code handoff or component docs.
Instructions
Extract a complete design contract JSON spec from a COMPONENT_SET (or a COMPONENT/INSTANCE inside one). Reads props (componentPropertyDefinitions with boolean-like variant + state normalization), anatomy (default variant tree with token bindings mapped to CSS properties), variantOverrides (token diffs of every variant value vs the default variant), resolvedTokens (per-mode values with alias chains), baseSpecs (raw measurements) and a11y contrast pairs (WCAG AA/AAA per mode). nodeId omitted → current Figma selection. DS-agnostic; no REST API. Returns { success, contract, report } — contract status is 'draft', anchors.code needs manual verification. Use for design-to-code handoff, DS documentation, or as the source of truth for component codegen.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | No | COMPONENT_SET / COMPONENT / INSTANCE node ID. Omit to use the current selection. | |
| fileKey | No | Target a specific connected file. | |
| figmaUrl | No | Figma file URL for routing. | |
| importPathTemplate | No | anchors.code.importPath template; {Name} → PascalCase component name. Default '@ds/components/{Name}'. |