All skills
simota avatar

/frame

@35ffd55
by shingo imotasimota/agent-skills85 stars
15

Extracting and structuring design context from Figma via MCP Server for downstream implementation agents. Use for Figma-to-code bridging or Code Connect management.

Use this Skill: https://skilld.dev/gh/simota/agent-skills/frame

This session only. Nothing lands on disk.

referencevariant-extraction.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Variant Extraction

Reference for Frame's variants recipe. Extract Component Set variants from Figma into structured prop/state matrices, identify defaults, and detect missing combinations.


1. Discovery Workflow

search_design_system  → find Component Sets in connected libraries
get_design_context    → fetch variant property + value matrix
get_metadata          → identify Variant property names and types

Key concepts:

  • Component Set: parent node containing all variants
  • Variant: child component with property=value combination (e.g., state=hover, size=md)
  • Variant Property: typed dimension (e.g., state, size, disabled)
  • Property Value: enum value or boolean

2. Property Type Classification

Boolean properties

  • Property name contains binary semantics: disabled, loading, selected, checked
  • Two values typically True / False
  • Output: TS interface as disabled?: boolean

Enum properties

  • Multiple discrete values: size: sm | md | lg | xl, state: default | hover | active, variant: primary | secondary | ghost
  • Output: TS interface as size?: 'sm' | 'md' | 'lg' | 'xl'

Naming convention

Figma convention: kebab-case for property names + kebab-case or Sentence Case for values TS convention: camelCase for prop names + value-as-string-literal

Figma TypeScript
Button, state=hover, size=md, disabled=False Button({ state: 'hover', size: 'md', disabled: false })

3. Default Variant Identification

Figma marks default via:

  • First variant in Component Set (top-left position)
  • Component Description marking "Default"
  • Heuristic: variant matching all-default values (state=default, size=md, disabled=False)

Output: spread defaults in TS:

const defaultProps: Partial<ButtonProps> = {
  state: 'default',
  size: 'md',
  disabled: false,
};

4. Missing State Detection

Construct Cartesian product of all property values.

  • Total possible combinations = product of value counts
  • Actual variants in file = N
  • Missing = combinations not present
size: sm | md | lg          (3 values)
state: default | hover | active | disabled  (4 values)
variant: primary | secondary  (2 values)

Total possible: 3 × 4 × 2 = 24
Actual: 18 (e.g., missing all `disabled` combinations for `secondary`)
Missing: 6

Output format

component: Button
total_possible: 24
actual_variants: 18
missing:
  - { size: sm,  state: disabled, variant: secondary }
  - { size: md,  state: disabled, variant: secondary }
  - { size: lg,  state: disabled, variant: secondary }
  - { size: sm,  state: hover,    variant: secondary }
  - { size: md,  state: hover,    variant: secondary }
  - { size: lg,  state: hover,    variant: secondary }

handoff_recommendation: "Designer review — disabled+secondary, hover+secondary states absent"

5. TypeScript Output

// Generated by Frame from Component Set: Button
export interface ButtonProps {
  state?: 'default' | 'hover' | 'active' | 'disabled';
  size?: 'sm' | 'md' | 'lg';
  variant?: 'primary' | 'secondary';
  disabled?: boolean;
  children?: React.ReactNode;
}

export const ButtonDefaults: Required<Pick<ButtonProps, 'state' | 'size' | 'variant'>> = {
  state: 'default',
  size: 'md',
  variant: 'primary',
};

6. Common Pitfalls

Pitfall Avoidance
Treating boolean property as enum Detect via value count (2) + semantic name (is*, has*, disabled, loading)
Inconsistent naming across variants Normalize to kebab-case at extraction
Missing default detection Cross-reference with Component Description
Ignoring disabled=True × all sizes combination Run full Cartesian product; report missing
State name collisions (state=default vs variant=default) Namespace: state-default vs variant-default
Variants split across multiple Component Sets Merge logically related sets in handoff
Breaking changes from variant addition Version-tag the extraction; diff against previous

7. Decision Walkthrough Template

Component Set: ____________
Properties:
  - ____ (boolean / enum, values: ____)
  - ____ (boolean / enum, values: ____)
  - ____ (boolean / enum, values: ____)

Total possible combinations: ____
Actual variants in file:     ____
Missing combinations:        ____

Default variant: { ____ }

Output:
  □ TypeScript prop interface
  □ Default props object
  □ Missing-state report
  □ Designer review recommendation (if missing > 0)

Handoff:
  □ Artisan (production component impl)
  □ Vitrine (Storybook stories per variant)

8. References

  • Figma Variant property guide
  • Figma MCP get_design_context schema
  • Code Connect template authoring (frame components)
  • Frame's code-connect recipe (reverse direction: code → Figma mapping)

Source: SKILL.md on GitHub

1 alert13d5 checks · Risk SAFE
  • Gen Agent Trust Hub13d

    The skill is a professional and well-documented bridge for extracting Figma design context into structured handoff packages for development agents. It adheres to official Figma MCP standards and incorporates robust safety guardrails, including rate-limit management and mandatory user confirmation for canvas write operations.

  • Socket13d

    No alerts

  • Snyk13d

    Risk: LOW · No issues

  • Runlayer6mo

    2/8 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 35ffd55. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 2 weeks ago

README badge

README badge for simota/agent-skills/frame