RULES FOR APP TO DESKTOP CONVERSION
Constraints
- Desktop frames have a fixed width of 1440px
- Mobile frames have a fixed width of 375px
- All layouts are designed to fit these boundaries.
- Maximize parallel operations: Batch independent Figma tool calls into a single round. For example, creating 3 card frames, their child elements, and setting their properties should be done in as few rounds as possible — not one call at a time. If operations don't depend on each other's output, run them in parallel.
- Child element coordinates are relative to the parent: When using
create_frame, create_text, or any creation tool with a parentId, the x and y values are relative to the parent frame, not absolute canvas coordinates. For example, to place a child 64px from the left edge of its parent, use x=64 — not the parent's absolute canvas x plus 64.
Catalog Structure
figma-catalog-app-index.json // Slim index — load this first (18KB, ~4K tokens)
figma-catalog-app.json // Full App/Mobile catalog (92KB — only when needed)
figma-catalog-web.json // Web/Desktop component library
Two-file lookup strategy
- Load the index first (
figma-catalog-app-index.json) — it has one entry per component with defaultKey, defaultSize, subTypes, and notes.
- Only open the full catalog when you need a specific non-default variant or size.
The index entry for each component:
{
"Normal Button": {
"description": "...",
"defaultKey": "da7d8e43...",
"defaultSize": { "w": 86, "h": 40 },
"availableSizes": ["Small", "Medium", "Large"],
"subTypes": ["Default"],
"notes": null
}
}
Key import fallback
If importComponentByKeyAsync(key) throws or returns null:
- Try the next variant key from the full catalog for the same component
- Last resort:
search_design_system by component name to find the current published key
Component notes — read before placing
The notes field flags composition gotchas:
- Top Nav: iOS Normal title (h=132) has status bar built in — do NOT add a separate status bar
- Chat input: Default state includes suggestion chips row — use
Filled/Single line if you want input only
- Always read
notes before placing a component
Two Focuses
This system handles two distinct use cases:
Focus 1: Component / Section Conversion (App → Desktop)
Designing a suitable desktop version of an app component or section (a group of elements smaller than a full frame). This is not just mechanical swapping — use UX knowledge and industry practices to create something that works well on desktop.
Focus 2: Frame Conversion (App Frame → Web Frame)
Converting an entire app frame (screen) into a desktop web frame.
Focus 1: Component / Section Conversion
Workflow
- Read the node tree using
get_node_info for precise properties (positions, colors, sizes, text content). Skip any layers where visible: false — these are toggled off in Figma and should be ignored.
- Understand the purpose — what does this component/section do? (e.g., category browsing card, action bar, product info section). Use this to inform your desktop design.
- Check the web catalog for a matching component. If a match exists, use it.
- If no catalog match, design a desktop-appropriate version using UX knowledge and industry practices. Consider:
- How this type of component typically appears on desktop websites
- Appropriate sizing, proportions, and spacing for desktop
- Desktop interaction patterns (hover states, wider layouts, etc.)
- Preserve ALL visible elements — text, shapes, images, icons. Nothing gets silently skipped. Only skip layers with
visible: false.
- Preserve spatial relationships — if a shape is behind text (background), it must remain as a background. Use z-order from the node tree to understand layering intent.
- Verify the result — after building the desktop version, use
export_node_as_image only once at the end to visually verify the output looks correct.
Using the Web Catalog
When a catalog match exists:
Parse the component type from the instance name
- Extract the key identifier:
"Chip", "Button", "Top Nav", etc.
- Strip suffixes like
"- app/2. Component" or "- dWeb/2. Component"
Search the web catalog for a matching component name
- Example:
"Chip" → found in INPUT.Chip
Determine the variant based on visual properties and instance name hints
Create the instance and transfer all properties (text content, states, colors)
When No Catalog Match Exists
Design a desktop version informed by UX knowledge:
- Understand the component's purpose and how similar components work on desktop
- Clone images and icons from the source using
clone_node — do not recreate them
- Recreate text with appropriate desktop sizing
- Recreate shapes (backgrounds, overlays) with correct spatial relationships
- NEVER silently skip elements — every visible part must be accounted for
Focus 2: Frame Conversion
Workflow
- Analyze the source app frame using
get_node_info to map the layer hierarchy.
- Build a low-fidelity wireframe in Figma showing the proposed desktop layout using simple rectangles and text labels. This is fast and gives the user a spatial preview.
- Confirm with the user that the wireframe layout is correct.
- Build the real frame after approval — replace wireframe elements with actual web components from the catalog.
Step 1: Analyze
Step 2: Low-Fidelity Wireframe
Build a quick wireframe frame in Figma (1440px wide) using:
- Rectangles with light gray fill (
#E0E0E0) to represent content areas and components
- Text labels inside or above rectangles to identify what each area represents (e.g., "Top Nav", "Product Image", "Add to Cart Button", "Chips Row")
- Approximate sizing and positioning to show the intended desktop layout
- Place the wireframe next to the source frame for easy comparison
The wireframe does NOT need to be pixel-perfect. Its purpose is to communicate layout intent quickly so the user can approve or adjust before real components are built.
Step 3: Confirm
Ask the user to review the wireframe. Wait for approval before proceeding.
Step 4: Build the Real Frame
After approval, build the actual desktop frame:
- Replace wireframe rectangles with real web components from the catalog.
- Images: Just duplicate/clone from the source frame and place them in the desktop frame. Do not analyze or recreate images.
- Icons: Clone the exact icon instance from the source frame using
clone_node. NEVER create custom icons.
- Text: Recreate with appropriate desktop sizing.
- Components: Instantiate from the web catalog using
create_component_instance.
Frame Building Rules
Instance Handling
- When converting instances to desktop, if the instance cannot be edited directly (e.g., resizing internal elements, changing nested text styles), clone it using
clone_node (with parentId to place it directly into the desktop frame), detach it using detach_instance, then edit the detached frame freely for desktop fit.
Container Structure
- Replicate the Figma layer hierarchy from the source. Do not "flat-map" components.
- Maintain parent-child relationships.
- IMPORTANT: Never flat-map components directly into the root frame.
Navigation
When creating a Desktop view, check the NAVIGATION category in the catalog and include relevant components (Navbar, Breadcrumb, Footer, Tabs, etc.) to complete the standard web page structure based on the page context.
Layout Specifications
- Side margins: 64px on left and right sides of desktop content.
- Chip spacing: Mobile = 8px, Desktop = 12px between chips.
- Containers and rows should be adjusted for desktop proportions.
- Never copy height/padding pixels directly from Mobile to Desktop. Parent containers must expand to accommodate Desktop component dimensions.
- Buttons and interactive elements should maintain natural sizing — do not stretch them to fill desktop width. Only containers and layout frames should expand.
Component Sizing
- Container-Child Fit: Before inserting components, verify the component width fits within the parent container.
- Input/Picker Width: Input fields and pickers should typically span the full width of their form container (minus any internal padding).
- Overflow Check: After inserting components, verify no overflow occurs that would clip content.
Auto Layout
- CRITICAL: If the mobile frame uses auto layout, the desktop frame MUST also use auto layout.
- When creating desktop containers, check if the corresponding mobile container has auto layout enabled using
get_node_info.
- Apply auto layout to desktop containers using
set_auto_layout with adapted settings:
- Increase
itemSpacing according to spacing rules (e.g., 8px → 12px for chips)
- Adjust padding for desktop proportions
- Match
layoutMode (HORIZONTAL/VERTICAL) from the mobile frame, unless horizontal expansion applies
- Match alignment settings (
primaryAxisAlignItems, counterAxisAlignItems)
Horizontal Expansion
- Desktop has 1312px usable content width (1440px - 64px margins on each side).
- When mobile displays items in multiple rows due to width constraints, evaluate if desktop width allows a single-row layout.
- Prefer horizontal layouts on desktop when all items fit within the content width.
Images
- Just duplicate — clone images from the source frame using
clone_node and place them in the desktop frame.
- Do not analyze, recreate, or reconstruct images.
- Maintain aspect ratio for: Images, Media Placeholders, Illustrations, Square/Circular components (Avatars, Square Ads).
- Image scale mode: When resizing image containers for desktop, ensure image fills use
FILL scale mode (not STRETCH) so the image crops to fit while preserving its natural aspect ratio. If the source image uses STRETCH, change it to FILL after resizing to prevent distortion. You may adjust the container's width and height freely, but the image content itself must never appear compressed or stretched.
- On overflow: If maintaining aspect ratio causes overflow beyond 1440px, stop and ask the user.
Icon Handling
- NEVER create custom icons or use substitutes. Always clone the exact icon instance from the source frame using
clone_node.
- Scale cloned icons proportionally based on container size changes.
Typography
- Always use text styles from
figma-catalog-web.json when creating or recreating text in desktop frames.
- Look up the appropriate style name (e.g.,
Desktop/H2 - Callout - 30, Desktop/Small - Reg - 14) in the textStyles section of the catalog and apply it using set_text_style_id with the corresponding style ID.
- Match the text style to the text's role: headings use heading styles, body text uses body styles, captions use small styles, etc.
- Do not manually set font family, size, or weight when a matching text style exists in the catalog — always prefer applying the text style ID.
Creative Liberty
By default, do faithful conversion (Focus 1 or Focus 2 workflows above). If the user explicitly asks for a redesign or reimagining (e.g., "reimagine this", "give me ideas", "creative insight", "draft a desktop version"), apply desktop-optimized layout patterns and offer multiple wireframe options in Figma for the user to choose from.
Handling Ambiguity
When encountering any of the following, stop and ask the user:
- Aspect ratio causes overflow or excessive whitespace
- Component has no catalog equivalent and reconstruction approach is unclear
- Unclear whether footer should be included
- Any design decision with multiple valid interpretations
Catalog Refresh
Both figma-catalog-web.json and figma-catalog-app.json can be regenerated on demand using generate-catalog.js.
How to refresh the app catalog
- Ensure the Figma desktop app has the App Components file (
NmeAXg5CGWRbBtIqxVcf96) open
- Re-run the extraction batches via
use_figma (see batch groupings in figma-create-screen SKILL.md)
- Write extracted data to
/tmp/figma_batch_*.json temp files
- Run:
/usr/local/bin/node /Users/thanhhapham/Skills/app-to-desktop-conversion/generate-catalog.js
- Both
figma-catalog-app.json and figma-catalog-app-index.json are regenerated together
When to refresh
- When new components are added to the Figma design system
- When component variants are renamed or reorganized
- When component keys change (e.g., after a library restructure)
1---2name: app-to-desktop-conversion3description: Rules for converting mobile app designs into desktop layouts in Figma. Use when adapting a mobile/app frame to desktop (1440px) or vice versa.4---56# RULES FOR APP TO DESKTOP CONVERSION78## Constraints9- Desktop frames have a fixed width of 1440px10- Mobile frames have a fixed width of 375px11- All layouts are designed to fit these boundaries.12- **Maximize parallel operations**: Batch independent Figma tool calls into a single round. For example, creating 3 card frames, their child elements, and setting their properties should be done in as few rounds as possible — not one call at a time. If operations don't depend on each other's output, run them in parallel.13- **Child element coordinates are relative to the parent**: When using `create_frame`, `create_text`, or any creation tool with a `parentId`, the `x` and `y` values are **relative to the parent frame**, not absolute canvas coordinates. For example, to place a child 64px from the left edge of its parent, use `x=64` — not the parent's absolute canvas x plus 64.1415---1617## Catalog Structure1819```20figma-catalog-app-index.json // Slim index — load this first (18KB, ~4K tokens)21figma-catalog-app.json // Full App/Mobile catalog (92KB — only when needed)22figma-catalog-web.json // Web/Desktop component library23```2425### Two-file lookup strategy26271. **Load the index first** (`figma-catalog-app-index.json`) — it has one entry per component with `defaultKey`, `defaultSize`, `subTypes`, and `notes`.282. **Only open the full catalog** when you need a specific non-default variant or size.2930The index entry for each component:31```json32{33 "Normal Button": {34 "description": "...",35 "defaultKey": "da7d8e43...",36 "defaultSize": { "w": 86, "h": 40 },37 "availableSizes": ["Small", "Medium", "Large"],38 "subTypes": ["Default"],39 "notes": null40 }41}42```4344### Key import fallback4546If `importComponentByKeyAsync(key)` throws or returns null:471. Try the next variant key from the full catalog for the same component482. Last resort: `search_design_system` by component name to find the current published key4950### Component notes — read before placing5152The `notes` field flags composition gotchas:53- **Top Nav**: iOS Normal title (h=132) has status bar built in — do NOT add a separate status bar54- **Chat input**: Default state includes suggestion chips row — use `Filled/Single line` if you want input only55- Always read `notes` before placing a component5657---5859## Two Focuses6061This system handles two distinct use cases:6263### Focus 1: Component / Section Conversion (App → Desktop)6465Designing a suitable desktop version of an app component or section (a group of elements smaller than a full frame). This is not just mechanical swapping — use UX knowledge and industry practices to create something that works well on desktop.6667### Focus 2: Frame Conversion (App Frame → Web Frame)6869Converting an entire app frame (screen) into a desktop web frame.7071---7273## Focus 1: Component / Section Conversion7475### Workflow76771. **Read the node tree** using `get_node_info` for precise properties (positions, colors, sizes, text content). Skip any layers where `visible: false` — these are toggled off in Figma and should be ignored.782. **Understand the purpose** — what does this component/section do? (e.g., category browsing card, action bar, product info section). Use this to inform your desktop design.793. **Check the web catalog** for a matching component. If a match exists, use it.804. **If no catalog match**, design a desktop-appropriate version using UX knowledge and industry practices. Consider:81 - How this type of component typically appears on desktop websites82 - Appropriate sizing, proportions, and spacing for desktop83 - Desktop interaction patterns (hover states, wider layouts, etc.)845. **Preserve ALL visible elements** — text, shapes, images, icons. Nothing gets silently skipped. Only skip layers with `visible: false`.856. **Preserve spatial relationships** — if a shape is behind text (background), it must remain as a background. Use z-order from the node tree to understand layering intent.867. **Verify the result** — after building the desktop version, use `export_node_as_image` only once at the end to visually verify the output looks correct.8788### Using the Web Catalog8990When a catalog match exists:91921. **Parse the component type** from the instance name93 - Extract the key identifier: `"Chip"`, `"Button"`, `"Top Nav"`, etc.94 - Strip suffixes like `"- app/2. Component"` or `"- dWeb/2. Component"`95962. **Search the web catalog** for a matching component name97 - Example: `"Chip"` → found in `INPUT.Chip`98993. **Determine the variant** based on visual properties and instance name hints1001014. **Create the instance** and transfer all properties (text content, states, colors)102103### When No Catalog Match Exists104105Design a desktop version informed by UX knowledge:106107- **Understand the component's purpose** and how similar components work on desktop108- **Clone images and icons** from the source using `clone_node` — do not recreate them109- **Recreate text** with appropriate desktop sizing110- **Recreate shapes** (backgrounds, overlays) with correct spatial relationships111- **NEVER silently skip elements** — every visible part must be accounted for112113---114115## Focus 2: Frame Conversion116117### Workflow1181191. **Analyze** the source app frame using `get_node_info` to map the layer hierarchy.1202. **Build a low-fidelity wireframe in Figma** showing the proposed desktop layout using simple rectangles and text labels. This is fast and gives the user a spatial preview.1213. **Confirm with the user** that the wireframe layout is correct.1224. **Build the real frame** after approval — replace wireframe elements with actual web components from the catalog.123124### Step 1: Analyze125126- Recursively scan ALL children using `get_node_info`, not just components.127- Record the full tree structure including FRAME containers.128- Example structure:129 ```130 Small Test (FRAME)131 └── Frame 633498 (FRAME)132 ├── Header container (FRAME)133 │ └── Header (FRAME)134 │ └── Top Nav (INSTANCE)135 └── Tags container (FRAME)136 └── Tags row content (FRAME)137 ├── Add tag icon (INSTANCE)138 └── Chips... (INSTANCE)139 ```140141### Step 2: Low-Fidelity Wireframe142143Build a quick wireframe frame in Figma (1440px wide) using:144- **Rectangles** with light gray fill (`#E0E0E0`) to represent content areas and components145- **Text labels** inside or above rectangles to identify what each area represents (e.g., "Top Nav", "Product Image", "Add to Cart Button", "Chips Row")146- **Approximate sizing and positioning** to show the intended desktop layout147- Place the wireframe next to the source frame for easy comparison148149The wireframe does NOT need to be pixel-perfect. Its purpose is to communicate layout intent quickly so the user can approve or adjust before real components are built.150151### Step 3: Confirm152153Ask the user to review the wireframe. Wait for approval before proceeding.154155### Step 4: Build the Real Frame156157After approval, build the actual desktop frame:158159- **Replace wireframe rectangles** with real web components from the catalog.160- **Images**: Just duplicate/clone from the source frame and place them in the desktop frame. Do not analyze or recreate images.161- **Icons**: Clone the exact icon instance from the source frame using `clone_node`. NEVER create custom icons.162- **Text**: Recreate with appropriate desktop sizing.163- **Components**: Instantiate from the web catalog using `create_component_instance`.164165### Frame Building Rules166167#### Instance Handling168- When converting instances to desktop, if the instance cannot be edited directly (e.g., resizing internal elements, changing nested text styles), clone it using `clone_node` (with `parentId` to place it directly into the desktop frame), detach it using `detach_instance`, then edit the detached frame freely for desktop fit.169170#### Container Structure171- Replicate the Figma layer hierarchy from the source. Do not "flat-map" components.172- Maintain parent-child relationships.173- **IMPORTANT**: Never flat-map components directly into the root frame.174175#### Navigation176When creating a Desktop view, check the **NAVIGATION category** in the catalog and include relevant components (Navbar, Breadcrumb, Footer, Tabs, etc.) to complete the standard web page structure based on the page context.177178#### Layout Specifications179- **Side margins**: 64px on left and right sides of desktop content.180- **Chip spacing**: Mobile = 8px, Desktop = 12px between chips.181- Containers and rows should be adjusted for desktop proportions.182- Never copy height/padding pixels directly from Mobile to Desktop. Parent containers must expand to accommodate Desktop component dimensions.183- **Buttons and interactive elements** should maintain natural sizing — do not stretch them to fill desktop width. Only containers and layout frames should expand.184185#### Component Sizing186- **Container-Child Fit**: Before inserting components, verify the component width fits within the parent container.187- **Input/Picker Width**: Input fields and pickers should typically span the full width of their form container (minus any internal padding).188- **Overflow Check**: After inserting components, verify no overflow occurs that would clip content.189190#### Auto Layout191- **CRITICAL**: If the mobile frame uses auto layout, the desktop frame MUST also use auto layout.192- When creating desktop containers, check if the corresponding mobile container has auto layout enabled using `get_node_info`.193- Apply auto layout to desktop containers using `set_auto_layout` with adapted settings:194 - Increase `itemSpacing` according to spacing rules (e.g., 8px → 12px for chips)195 - Adjust padding for desktop proportions196 - Match `layoutMode` (HORIZONTAL/VERTICAL) from the mobile frame, unless horizontal expansion applies197 - Match alignment settings (`primaryAxisAlignItems`, `counterAxisAlignItems`)198199#### Horizontal Expansion200- **Desktop has 1312px usable content width** (1440px - 64px margins on each side).201- When mobile displays items in multiple rows due to width constraints, evaluate if desktop width allows a single-row layout.202- **Prefer horizontal layouts on desktop** when all items fit within the content width.203204#### Images205- **Just duplicate** — clone images from the source frame using `clone_node` and place them in the desktop frame.206- Do not analyze, recreate, or reconstruct images.207- Maintain aspect ratio for: Images, Media Placeholders, Illustrations, Square/Circular components (Avatars, Square Ads).208- **Image scale mode**: When resizing image containers for desktop, ensure image fills use `FILL` scale mode (not `STRETCH`) so the image crops to fit while preserving its natural aspect ratio. If the source image uses `STRETCH`, change it to `FILL` after resizing to prevent distortion. You may adjust the container's width and height freely, but the image content itself must never appear compressed or stretched.209- **On overflow**: If maintaining aspect ratio causes overflow beyond 1440px, stop and ask the user.210211#### Icon Handling212- **NEVER create custom icons or use substitutes.** Always clone the exact icon instance from the source frame using `clone_node`.213- Scale cloned icons proportionally based on container size changes.214215#### Typography216- **Always use text styles from `figma-catalog-web.json`** when creating or recreating text in desktop frames.217- Look up the appropriate style name (e.g., `Desktop/H2 - Callout - 30`, `Desktop/Small - Reg - 14`) in the `textStyles` section of the catalog and apply it using `set_text_style_id` with the corresponding style ID.218- Match the text style to the text's role: headings use heading styles, body text uses body styles, captions use small styles, etc.219- **Do not manually set font family, size, or weight** when a matching text style exists in the catalog — always prefer applying the text style ID.220221---222223## Creative Liberty224225By default, do faithful conversion (Focus 1 or Focus 2 workflows above). If the user explicitly asks for a redesign or reimagining (e.g., "reimagine this", "give me ideas", "creative insight", "draft a desktop version"), apply desktop-optimized layout patterns and offer multiple wireframe options in Figma for the user to choose from.226227---228229## Handling Ambiguity230231When encountering any of the following, stop and ask the user:232- Aspect ratio causes overflow or excessive whitespace233- Component has no catalog equivalent and reconstruction approach is unclear234- Unclear whether footer should be included235- Any design decision with multiple valid interpretations236237---238239## Catalog Refresh240241Both `figma-catalog-web.json` and `figma-catalog-app.json` can be regenerated on demand using `generate-catalog.js`.242243### How to refresh the app catalog2442451. Ensure the Figma desktop app has the **App Components** file (`NmeAXg5CGWRbBtIqxVcf96`) open2462. Re-run the extraction batches via `use_figma` (see batch groupings in `figma-create-screen` SKILL.md)2473. Write extracted data to `/tmp/figma_batch_*.json` temp files2484. Run: `/usr/local/bin/node /Users/thanhhapham/Skills/app-to-desktop-conversion/generate-catalog.js`2495. Both `figma-catalog-app.json` and `figma-catalog-app-index.json` are regenerated together250251### When to refresh252253- When new components are added to the Figma design system254- When component variants are renamed or reorganized255- When component keys change (e.g., after a library restructure)