|
| 1 | +--- |
| 2 | +description: Workflow orchestrator for Figma-to-component conversion. Parses your Figma URL and guides your AI assistant through design-to-component conversion. |
| 3 | +--- |
| 4 | + |
| 5 | +# storefront_next_figma_to_component_workflow |
| 6 | + |
| 7 | +Workflow orchestrator for converting Figma designs to Storefront Next components. When you ask your AI assistant to convert a Figma design, it starts with this workflow tool, which parses your URL and guides the assistant through the conversion. |
| 8 | + |
| 9 | +## Overview |
| 10 | + |
| 11 | +When you provide a Figma design URL, your AI assistant uses this tool to extract the file and node identifiers, then follows the workflow to fetch design data, analyze your codebase, and produce recommendations. The assistant will: |
| 12 | + |
| 13 | +- Fetch design context and screenshots from Figma |
| 14 | +- **Ask for your approval before exporting images** — when the design contains image assets (photos, logos, icons), the assistant presents the list and waits for you to confirm before exporting |
| 15 | +- Discover similar components in your project |
| 16 | +- Recommend whether to REUSE, EXTEND, or CREATE a component |
| 17 | +- Map Figma design tokens to your theme variables |
| 18 | + |
| 19 | +You receive a component recommendation with confidence score and a token mapping summary when the workflow completes. |
| 20 | + |
| 21 | +This tool is part of the STOREFRONTNEXT toolset. |
| 22 | + |
| 23 | +## Prerequisites |
| 24 | + |
| 25 | +- **B2C DX MCP** configured with `--project-directory` pointing to your Storefront Next project and `--allow-non-ga-tools` |
| 26 | +- **Figma MCP server** (external) enabled in your MCP client for full workflow execution |
| 27 | +- **Valid Figma URL** with `node-id` query parameter (obtain by right-clicking a frame in Figma → Copy link to selection) |
| 28 | + |
| 29 | +See [Figma-to-Component Tools Setup](../figma-tools-setup) for complete prerequisites and configuration. |
| 30 | + |
| 31 | +## Authentication |
| 32 | + |
| 33 | +No authentication required. This tool operates on local workflow files and URL parsing only. |
| 34 | + |
| 35 | +## Parameters |
| 36 | + |
| 37 | +| Parameter | Type | Required | Description | |
| 38 | +|-----------|------|----------|-------------| |
| 39 | +| `figmaUrl` | string | Yes | The Figma design URL to convert. Must be a valid URL and include the `node-id` query parameter. | |
| 40 | +| `workflowFilePath` | string | No | Optional absolute path to a custom workflow `.md` file. If not provided, uses the default built-in workflow. | |
| 41 | + |
| 42 | +## Supported Figma URL Formats |
| 43 | + |
| 44 | +The parser supports these URL formats: |
| 45 | + |
| 46 | +- `https://figma.com/design/:fileKey/:fileName?node-id=1-2` |
| 47 | +- `https://www.figma.com/design/:fileKey/:fileName?node-id=1-2` |
| 48 | +- `https://figma.com/file/:fileKey/:fileName?node-id=1-2` |
| 49 | + |
| 50 | +The `node-id` parameter accepts hyphen format (`1-2`) or colon format (`1:2`). The parser converts hyphens to colons for Figma MCP compatibility. |
| 51 | + |
| 52 | +## Output |
| 53 | + |
| 54 | +The workflow returns a guide with extracted Figma parameters (`fileKey`, `nodeId`, and original URL). After the full workflow completes, you receive a component recommendation (REUSE/EXTEND/CREATE) with confidence score and a token mapping summary. |
| 55 | + |
| 56 | +**Example prompts:** |
| 57 | +- ✅ "Use the MCP tool to convert this Figma design to a Storefront Next component: [Figma URL with node-id]" |
| 58 | +- ✅ "Use the MCP tool to create this homepage from the Figma design: [Figma URL with node-id]. Create new components or update existing components using the MCP tool if necessary, then update the home page. The expected result should be that the homepage matches as closely as possible to the provided Figma design." |
| 59 | +- ✅ "Use the MCP tool to start the Figma-to-component workflow with a custom workflow file at /path/to/custom-workflow.md" |
| 60 | + |
| 61 | +## Usage Examples |
| 62 | + |
| 63 | +### Basic Workflow Start |
| 64 | + |
| 65 | +``` |
| 66 | +Use the MCP tool to convert this Figma design to a Storefront Next component: [Figma URL with node-id] |
| 67 | +``` |
| 68 | + |
| 69 | +### Custom Workflow File |
| 70 | + |
| 71 | +``` |
| 72 | +Use the MCP tool to start the Figma-to-component workflow with a custom workflow file at /path/to/custom-workflow.md |
| 73 | +``` |
| 74 | + |
| 75 | +### Full Homepage Implementation |
| 76 | + |
| 77 | +Create a homepage from a Figma design, creating or updating components as needed: |
| 78 | + |
| 79 | +``` |
| 80 | +Use the MCP tool to create this homepage from the Figma design: [Figma URL with node-id]. Create new components or update existing components using the MCP tool if necessary, then update the home page. The expected result should be that the homepage matches as closely as possible to the provided Figma design. |
| 81 | +``` |
| 82 | + |
| 83 | +## Requirements |
| 84 | + |
| 85 | +- Valid Figma URL from figma.com |
| 86 | +- URL must include `node-id` query parameter |
| 87 | +- For custom workflow: file must exist at the provided path |
| 88 | + |
| 89 | +## Error Handling |
| 90 | + |
| 91 | +The tool returns formatted error messages if: |
| 92 | + |
| 93 | +- **Invalid URL**: URL is not from figma.com, or `fileKey`/`node-id` cannot be extracted |
| 94 | +- **Workflow file not found**: Custom `workflowFilePath` is provided but the file does not exist |
| 95 | + |
| 96 | +**Example error format:** |
| 97 | + |
| 98 | +``` |
| 99 | +# Error: Invalid Figma URL |
| 100 | +
|
| 101 | +Could not extract node-id from URL. Expected query parameter: ?node-id=1-2 |
| 102 | +
|
| 103 | +Please provide a valid Figma URL in the format: |
| 104 | +https://figma.com/design/:fileKey/:fileName?node-id=1-2 |
| 105 | +``` |
| 106 | + |
| 107 | +## Related Tools |
| 108 | + |
| 109 | +- [`storefront_next_generate_component`](./storefront-next-generate-component) - Analyzes design and discovered components; recommends REUSE/EXTEND/CREATE |
| 110 | +- [`storefront_next_map_tokens_to_theme`](./storefront-next-map-tokens-to-theme) - Maps Figma design tokens to theme variables |
| 111 | +- Part of the [STOREFRONTNEXT](../toolsets#storefrontnext) toolset |
| 112 | +- Auto-enabled for Storefront Next projects |
| 113 | + |
| 114 | +## Figma MCP Tools (External) |
| 115 | + |
| 116 | +The workflow relies on your AI assistant having access to Figma MCP tools to fetch design data: |
| 117 | + |
| 118 | +- **get_design_context** - Generates UI code from the design and returns asset URLs |
| 119 | +- **get_screenshot** - Provides a visual reference image of the design |
| 120 | +- **get_metadata** - Retrieves node hierarchy, layer types, names, positions, and sizes |
| 121 | + |
| 122 | +### Image Export and User Approval |
| 123 | + |
| 124 | +The workflow requires the assistant to **ask for your approval before exporting any image assets**. The assistant will: |
| 125 | + |
| 126 | +1. Call `get_design_context` **without** `dirForAssetWrites` on the initial call (never export on first call) |
| 127 | +2. Identify image-containing nodes (photos, banners, **logos**, **brand assets**, icons) |
| 128 | +3. Present the list of nodes to you |
| 129 | +4. Ask once: "Should I export these N image assets now? (yes/no)" |
| 130 | +5. Wait for your explicit "yes" before calling `get_design_context` with `dirForAssetWrites` to export |
| 131 | + |
| 132 | +You are prompted **once per batch**—not per image. This ensures you control when assets are written to disk. Logo and brand assets are explicitly included in the identification criteria so they are not missed. |
| 133 | + |
| 134 | +Ensure the Figma MCP server is enabled in your MCP client. See [Figma-to-Component Tools Setup](../figma-tools-setup) for configuration and the [Figma MCP Server Documentation](https://developers.figma.com/docs/figma-mcp-server) for official setup and tool details. |
| 135 | + |
| 136 | +## See Also |
| 137 | + |
| 138 | +- [Figma-to-Component Tools Setup](../figma-tools-setup) - Prerequisites and Figma MCP configuration |
| 139 | +- [STOREFRONTNEXT Toolset](../toolsets#storefrontnext) - Overview of Storefront Next development tools |
| 140 | +- [Configuration](../configuration) - Configure project directory |
| 141 | +- [Storefront Next Guide](../../guide/storefront-next) - Storefront Next development guide |
0 commit comments