CommunityProgramación y desarrollogithub.com

figma-to-framer-template

Build an agent-ready Framer template from a Figma design: audit Figma, create styles and components, assemble pages per breakpoint, compare against Figma, then hand off to framer-agent-template.

¿Qué es figma-to-framer-template?

figma-to-framer-template is a Claude Code agent skill that build an agent-ready Framer template from a Figma design: audit Figma, create styles and components, assemble pages per breakpoint, compare against Figma, then hand off to framer-agent-template.

Compatible con~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/peterdraw/peterdraw-agent/tree/HEAD/plugins/figma-to-framer-template/skills/figma-to-framer-template

Installed? Explore more Programación y desarrollo skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación


name: figma-to-framer-template description: Build an agent-ready Framer template from a Figma design: audit Figma, create styles and components, assemble pages per breakpoint, compare against Figma, then hand off to framer-agent-template.

Figma design to Framer template

Goal: turn a Figma website design into a Framer template that matches the design and is already built the way an Agent Template needs (styles that mirror Figma, components, consistent spacing, layout templates). When the build is done, continue with the framer-agent-template workflow so the result ships with a Design System page and a design-system skill.

Requirements:

  • Official Figma MCP server connected (read tools such as get_metadata, get_design_context, get_variable_defs, get_screenshot; call create_session first if the server asks for it).
  • Official Framer MCP server connected (open_project, exec, read_docs).
  • A Figma file or frame link, and a Framer project to build into. If no Framer project is given and the Framer MCP offers create_project, create one named after the template; otherwise ask for a blank project link. This is the only thing worth asking up front.

Talk to the user in the language they write in (Peterdraw: usually Indonesian). Never use em dashes in messages; use commas or parentheses.

Run end to end without stopping to ask. Decide open questions from the Figma data, record each in an Assumptions log, and report it at the end. Stop only if an MCP is missing, a link cannot be opened, or the user asked for review mode ("tanya dulu", "review mode"); in review mode, send the readiness report and Assumptions log after step 1 and wait.

Non-negotiable build rules

These come from failed test runs. Check every one before reporting done:

  1. One layer tree per page. Build every section once, in the Desktop (primary) breakpoint. Tablet and Phone are replicas that inherit it; adapt them only with overrides on the same layers (direction, wrap, gap, padding, width, alignment, grid to stack, component variant). Never duplicate a section per breakpoint and toggle visible between the copies. visible: false on a replica is allowed only for a single element that truly does not exist on that breakpoint (for example a decorative image Figma removes on mobile), never for whole sections.
  2. Section spacing is padding. Never insert spacer frames ("Section spacing", empty frames, fixed-height dividers) between sections. Read each section's padding from Figma and set it on the section frame; set page breakpoint gap to 0. Per-breakpoint spacing is a padding override on the same section.
  3. Assets live in real folders. Slashes in names do not create folders in Framer. Create folders with VirtualFolderNode under the Assets root and place each style or component there with a VirtualReferenceNode (see step 3).
  4. Repeated things are components. Every card, item or section that appears 2 or more times (in one grid, across sections or across pages) is one component with controls, used as instances. Never leave copies of the same card as plain frames.
  5. Images keep their proportions. Every image frame with flexible width uses aspectRatio from its Figma size (width / height). Never combine a flexible width with a fixed height on a photo; that stretches or crops portraits.
  6. Every section has a Container. Structure is Section (full width, background, top and bottom padding only) > Container (width: "1fr", maxWidth: "1440px", side padding 64 / 32 / 16 on Desktop / Tablet / Phone, holds the layout direction, gap and alignment) > content. Full-bleed sections (background image, video, banner) keep the media edge to edge on the section or banner frame, but their content (cards, text, tabs, hotspots) sits inside a Container. Navbar, footer and section components (page header, CTA, form) follow the same rule inside the component. Desktop breakpoint is 1200px; the 1440px max width is what keeps content consistent on wide screens.
  7. Figma is the source of truth. Layout, spacing, sizes, styles and details must match Figma, not approximate it: icon style (filled vs outline: use the Figma SVG when the icon set has no filled version), image sizes, which element is bottom-aligned (a price row at the bottom of a card, a button at the bottom of a column), top padding of the footer, gaps between groups. When a column must align its last child with the bottom of a neighbor (Figma self-stretch + justify-between), give the column the neighbor's height on Desktop with stackDistribution: "space-between" and reset it to auto / start on stacked breakpoints. Log any difference you cannot reproduce.

Never invent Framer API calls. Follow the instructions open_project returns. At the start, load Framer's own project skills with api.skills.load in one program: style, breakpoint, component, project-organization, plus cms when the design has CMS content. They describe the exact APIs for styles, breakpoint overrides, components and folders, and agree with the rules above.

1. Read and audit the Figma file

  • get_metadata on the file or page: list pages and top-level frames. Identify website pages and their breakpoint frames by name and width (around 1440 or 1200 Desktop, 810 to 1024 Tablet, 390 or less Phone). Pair frames of the same page across breakpoints.
  • get_variable_defs and styles: color variables or styles (with modes if any), text styles, effect styles, spacing or radius variables. Record the full group path of every style (for example Desktop/Heading/H1, Mobile/Body Text/Body M, Primary/500) and its exact values (family, weight, size, line height, letter spacing, case, decoration).
  • Detect breakpoint groups in text styles: top-level groups named like Desktop, Tablet, Mobile, Phone, or styles with a breakpoint prefix or suffix. Pair styles across those groups by the rest of the path (Desktop/Heading/H1 with Mobile/Heading/H1).
  • Components and component sets: names, variants, properties.
  • get_screenshot of every page frame at every breakpoint; keep them as the visual reference.
  • Pair Desktop and Mobile (and Tablet) frames section by section, by layer name first and order second. For each pair, record the layout differences: direction, wrap, gaps, padding, widths, column counts, alignment, hidden elements, font sizes (these come from text style breakpoints), image sizes. This difference list is what becomes breakpoint overrides in step 5; Mobile frames are a source of values, not a second page to build.
  • get_design_context per top-level section of each Desktop page: layout (auto layout direction, gap, padding, alignment, sizing), fills, text styles used, component instances, images.

Readiness check. Score each item ok / partial / missing, with examples:

  • Colors as variables or styles (not raw hex on layers)
  • Typography as text styles
  • Repeated elements as components with variants (buttons, cards, nav, footer, headers)
  • Auto layout on sections and containers (not absolute positioning)
  • Breakpoint frames per page (Desktop required; Tablet and Phone preferred)
  • Consistent section spacing and container width
  • Final images (not placeholders), fonts available on Google Fonts or supplied as files
  • Clear layer names for sections

Do not stop on partial or missing items; plan around them and log the decision:

  • Raw colors: cluster them into a palette (merge near-duplicates within a small delta) and treat each cluster as a style.
  • Missing text styles: cluster text by family, size, weight, line height.
  • Missing components: treat any element repeated 2 or more times with the same structure as a component.
  • No auto layout: infer stacks from positions (consistent gaps, alignment) when rebuilding.
  • Missing Tablet or Phone frames: derive them in step 5 from the Desktop structure using standard rules.
  • Missing fonts: use the closest Google Font for the build and flag it for the designer to upload.

Send one short progress message (not a question): pages and breakpoints found, readiness score, main assumptions, "continuing".

2. Classify and plan

  • Template type (single page, multi-page, CMS-driven) and category (SaaS, agency, portfolio, shop, wellness, event, personal).
  • Page list with routes. Which pages share a layout (navbar, footer): these become layout templates (for example Main for home, Inner for the rest; decide by comparing navbar and footer variants across pages).
  • Header pattern on inner pages and section heading pattern, to become components.
  • Spacing pattern between sections (one-sided or symmetric, exact values) and container rules (max width, side padding per breakpoint). Standardize on the majority value when Figma is inconsistent; log it.
  • CMS candidates: repeated cards that represent content lists (blog posts, products, case studies, team, jobs) with a detail page design.

3. Foundations in Framer

  • open_project on the Framer project.

Follow the Figma file's styles exactly: same names, same groups, same values. Do not rename to generic role names and do not invent styles Figma does not have. Only fall back to role names (Text Primary, Surface, Heading 1, Body...) when Figma has no styles and you clustered raw values in step 1.

Asset grouping. Organize Framer assets in real folders, by type, mirroring Figma's groups inside each type:

  • Find the Assets root folder (a VirtualFolderNode named "Assets", id usually assetsEntityRoot). Inspect existing folders first and reuse them.
  • Create top-level folders under it with tree.insert("VirtualFolderNode", id, { parent: <assets root>, name }): Color, Text Style, Link Style, Components, plus Effects only if Framer offers a reusable effect asset. Inside each, create subfolders for Figma's groups (for example Text Style > Heading, Body Text, Label; Color > Primary, Neutral; Components > Buttons, Cards, Headers).
  • Put each asset in its folder with tree.insert("VirtualReferenceNode", id, { parent: <folder>, reference: <style or component id> }). If the asset already has a reference, move that reference with tree.move instead of adding a second one.
  • Name each asset with its Figma leaf name (H1, T2, Cashmere Sand), because the folders now carry the group. Keep the group in the name only if two assets would otherwise share a name.
  • Move only primary text styles; their breakpoint slots follow automatically.
  • Colors: one color style per Figma color variable or style. Include dark mode values if Figma has modes.
  • Effects: Framer has no reusable shadow or blur style node. Apply Figma effect values directly on the components that use them, keep them identical everywhere, and list them on the Design System page.

Text styles with breakpoints. One Framer text style per text role, not one per breakpoint:

  • Merge across breakpoint groups: Desktop/Heading/H1 and Mobile/Heading/H1 become one style named H1 inside the Text Style > Heading folder.

  • The Desktop values are the base (default slot). Add breakpoint slots with tree.patch(style, { breakpoint: { medium: {...}, small: {...} } }): with Tablet and Phone page breakpoints the slots are medium (Tablet) and small (Phone). Use Figma Tablet values for medium if Figma has a Tablet group, otherwise keep the Desktop values or interpolate and log it; Mobile values go in small. Slots accept fontSize, lineHeight, letterSpacing, paragraphSpacing; set only values that differ.

  • Copy every value exactly per breakpoint: family, weight, size, line height (Figma 48/120 means 48px size, 120% line height), letter spacing, paragraph spacing, case, decoration.

  • If a style exists in only one breakpoint group, create it as a single style without breakpoints and log it.

  • Tags: headings (H1 to H6 in Figma naming) get the matching h1 to h6 tag; Body, Label, Caption and similar get p.

  • Never create separate Desktop and Mobile styles in Framer.

  • Link styles for text links on light and dark backgrounds.

  • Fonts: set the Figma fonts if available in Framer; otherwise the closest Google Font, logged.

  • Images, see the Images section below.

Images

  • Resolution: export every raster image from Figma at least 1.5x its largest displayed size across all breakpoints (prefer 2x). Use the Figma MCP export or download tools with a scale of 2 (minimum 1.5). If the source image in Figma is smaller than 1.5x its displayed size, export at the source size and flag it in the report instead of upscaling.
  • Vectors: icons, illustrations and logos that are vectors in Figma export as SVG.
  • Proportions: set aspectRatio (Figma width / height) on every image frame whose width is flexible (1fr, 100%, fill), with height left to the ratio. This matters most for team photos, portraits, product shots and card images. Keep fill image fitting as cover with a sensible focal point.
  • Logos: client or partner logos come from Figma as separate images (this overrides Framer's default advice to use its Logos vector set). In a logo row, client logo grid or "trusted by" section, export each logo as its own image (one file per logo), never the whole row as one image. Place them as separate image layers inside a stack or grid so they reflow per breakpoint, and keep their original order.
  • Alt text: every image gets a descriptive alt text of 5 to 10 words describing what the photo actually shows (subject, action, setting), for example "Woman stretching on a yoga mat at sunrise". Look at the image (screenshot) to write it; never use file names, "image" or "photo of". Logos use the company name plus "logo" (for example "Acme logo"). Purely decorative shapes may use empty alt text; log which ones.
  • If assets cannot be transferred automatically, use the closest available placeholder, list every missing asset with its Figma node, and continue.

4. Components

Build in this order, each from its Figma component (variants, properties, auto layout values, styles):

  1. Atoms: buttons (all variants), labels or tags, form inputs, icons if needed.
  2. Navigation: navbar (with Phone menu variant), footer.
  3. Header components: Page Header for inner pages, Section Heading for section title blocks.
  4. Cards and repeated blocks: feature, pricing, testimonial, team, blog or product card, FAQ item, CTA band.

Componentize by repetition, not only by Figma components:

  • Any card or item repeated in a grid or list (product, article, testimonial, team member, service, FAQ item, stat) is a component with controls for its text, images and links, even if Figma drew it as plain frames.
  • Any section that appears on 2 or more pages (CTA, newsletter, page header, contact block) is a component.
  • When you have already built the layers, convert them with tree.createComponentFromFrame(frame, name) and then replace the other copies with instances; do not rebuild them.
  • Put every component in the Components folder (step 3).

Rules:

  • Use color, text and effect styles only, never raw values.
  • Every content piece is a variable (text, image, link) so instances can be filled.
  • Breakpoint variants (Desktop, Tablet, Phone) for components that change across breakpoints, using the Figma breakpoint frames when present.
  • Set text alignment explicitly on every text node.
  • Never separate two columns with a large fixed gap; use space-between with a max width on the secondary column and a min width at least the width of its fixed children. space-between ignores gap; variants that need a gap use distribution start.
  • Stress test each component with longer and shorter content at every breakpoint before using it in pages.
  • Compare each component with its Figma screenshot; fix visible differences in spacing, size, radius, color and type.

5. Pages

  • Create layout templates for the shared navbar and footer, and assign them to pages.
  • Each page has Desktop as primary breakpoint, and Tablet (810) and Phone (390) as replicas. Create the replicas once with tree.createVariant and never insert content into them.
  • Build each page section by section from get_design_context, top to bottom, only in the Desktop breakpoint:
    • Section frame: full width, fill from the matching color style, padding taken from the Figma section (top, right, bottom, left). If Figma separates sections with spacer frames instead of padding, convert the spacer height into padding on the section above (bottom) and log it. Page breakpoint gap 0.
    • Inside it a Container with the max width and side padding from step 2.
    • Insert components wherever Figma uses an instance or a repeated pattern; never rebuild a component from frames.
    • Inner pages start with the Page Header component.
  • Then adapt Tablet and Phone with overrides on the replica layers, using the difference list from step 1:
    • Find replica layers by walking the replica breakpoint and matching $originalId to the primary layer id; patch those nodes. Do not build compound ids by hand.
    • Typical overrides: section padding, stack direction (horizontal to vertical), wrap, gap, widths (1fr), alignment, grid column count or grid to vertical stack, image aspectRatio, component instance variant (Desktop / Tablet / Phone).
    • Font sizes never need overrides on layers; they come from the text style breakpoint slots.
    • If no Mobile or Tablet frame exists in Figma, derive the overrides: side padding about 32px on Tablet and 16 to 20px on Phone; multi-column rows become 2 columns on Tablet and 1 on Phone; horizontal hero or header layouts stack on Phone; section padding about two thirds on Tablet and half on Phone. Log that they were derived.
    • Prefer fixing a layout on Desktop in a way that also works narrower (wrap, flexible widths) over adding overrides; fewer overrides keep the page editable.
  • CMS: for each CMS candidate, create the collection with fields matching the card and detail design, fill it with the Figma content, bind a collection list of the card component, and build the detail page.
  • 404 page if Figma has one; otherwise a simple one from the Page Header and a button.

5b. Structural self-check (run before the visual check)

Run one read-only program per page and fix every hit before continuing:

  • Sibling sections with the same name, or sections that are visible on only one breakpoint: rebuild as one section with overrides.
  • Frames named like spacing or spacer, or empty fixed-height frames between sections: remove them and move the space into section padding.
  • Text styles, color styles, link styles or components without a reference inside the Assets folders: file them.
  • Cards or items that repeat with the same structure but are not component instances: componentize them.
  • Image frames with flexible width and fixed height and no aspectRatio: set the ratio.
  • Component primary variants with an unintended #FFFFFF fill: set fill: null.
  • Inner pages missing Tablet or Phone breakpoints: create them before overrides.

6. Visual check against Figma

For every page and breakpoint, screenshot the Framer page section by section and compare with the Figma screenshot of the same section. Check: overall layout, section spacing (no doubled or missing gaps), alignment, type sizes and styles (including the Mobile sizes from text style breakpoints), colors, image sharpness and crops, logos as separate images, alt text present on every image, component variants, nothing overflowing or clipped. Fix differences and re-check until each section matches closely. Accept only differences caused by logged assumptions (missing fonts, missing assets, derived breakpoints).

7. Hand off to framer-agent-template

Continue with the framer-agent-template workflow on the same Framer project (load that skill if available; otherwise follow these steps): audit (most checks should already pass), build the Design System design page, write the design-system SkillNode, and run the agent tests. Reuse the Assumptions log from this build rather than re-deciding. Keep the style names, groups and breakpoints that came from Figma; do not rename them to generic role names during that workflow. In the design-system skill, describe each style's role next to its Figma name (for example "H1 (Text Style > Heading): page title").

8. Report

Send the designer:

  • Figma readiness score and what to improve in future Figma files.
  • Assumptions log (decision, evidence, how to change it).
  • What was built: styles, components, pages, layout templates, CMS.
  • Manual items left: custom font upload, missing assets (with Figma node names), animations and interactions, hover effects, any section that still differs from Figma, final visual review, walkthrough video, submission.
  • Screenshots of key pages at Desktop and Phone.

What to leave to the designer

Animations, scroll and appear effects, complex interactions, custom code components, final polish, and publishing. Never publish.

Framer MCP API notes

  • tree.insert(type, id, { parent, index, ...attrs }); the id may be renamed, read renamedIds.
  • Component instance: tree.insert("ComponentInstanceNode", id, { parent, index, component: <componentId>, width: "1fr", height: "auto", position: "relative", "$control__variant": <variantId>, "$control__<varId>": value }).
  • Image controls take "data:framer/asset-reference,<asset>?width=..&height=.." strings.
  • Replica layers (breakpoints, component variants) are patched through their own ids: find them by walking the replica and matching $originalId, or use the ids returned by tree.createVariant. Never insert into a replica and never build compound ids by hand.
  • tree.move(id, parentId, index); tree.duplicate(sourceId, newId) places the copy next to the source; tree.replaceText(id, search, replacement); tree.remove(id); tree.screenshot(id); tree.walk(rootId, fn); tree.createComponentFromFrame exists.
  • A thrown error or timeout does not undo writes made earlier in the same program; re-read affected nodes before retrying. Keep programs focused and verify with screenshots.
  • tree.assetReference(url) is async: always await it (Figma MCP asset URLs work and upload the original). Upload all images of a section in one Promise.all before inserting.
  • Image frames: fill: <assetReference> plus altText (5 to 10 words); image variables: { src: <assetReference>, alt }.
  • New ComponentNode: insert the primary variant FrameNode first, then call tree.var. Calling tree.var on an empty component auto-creates a 200x200 "Variant" primary with fill #FFFFFF that cannot be removed.
  • Primary variants created by the API get fill #FFFFFF; set fill: null on transparent components (sections, cards without a surface) or the white shows on the page.
  • Give every component variant its own left/top on the canvas (for example +60px past the previous variant's width), otherwise the linter reports overlapping ground nodes.
  • Icon swaps: use an enum variable and one IconNode per case with visible: { from: tree.ref(enumVar, comp), transforms: [{ name: "equals", value: caseId }] }. Read the case ids back with tree.serialize(comp) after creating the variable.
  • Interactive components: onTap: [{ action: "SET_VARIANT", controls: { variant: "cycle" } }] for 2-variant toggles (FAQ open or closed); hover states via tree.createVariant(primary, id, { gesture: "hover" }).
  • Page breakpoints: tree.createVariant(desktopBreakpointId, id, { gesture: null, name: "Tablet", width: "810px" }) (and "Phone", "390px") sets the media queries automatically. On pages using a layout template, layout, gap, padding, overflow belong to the template; only height is set on the page breakpoint.
  • Reordering for a breakpoint (for example card below images on Phone) works on replicas: tree.move(${bpId}${nodeId}, ${bpId}${parentId}, index).
  • Repeated sections across pages (Page Header, contact form, social gallery) are components whose primary is the section itself, with Desktop, Tablet and Phone variants; pages set $control__variant on the Tablet and Phone replicas.
  • Forms: FrameNode htmlTag: "form", inputs FormPlainTextInputNode / FormSelectNode wrapped in htmlTag: "label" frames, submit button must be a ComponentInstanceNode whose primary has htmlTag: "button", then formSubmitButtonId. Inputs do not accept textStylePreset; use fontSize and textColor.
  • Link controls with a hash need the page path: "/contact#faq", not "#faq".
  • Restructuring a section that already has Tablet / Phone overrides (for example adding a Container): read every replica's values with tree.serialize(bpId + nodeId) BEFORE patching the primary. After the primary changes, inherited replica values change too and can no longer be told apart from real overrides.
  • Replica ids inside components: the replica of a variant's root frame is the variant id itself; its descendants are variantId + nodeId.
  • tree.getRect only returns real sizes for nodes in a rendered breakpoint (it returns 200x200 otherwise); render with tree.screenshot first and do not trust 200 values.
  • Page heights: tree.screenshot(breakpointId) renders the full page; its image height is the content height. Set each page breakpoint height to that value at the end of the build.

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

Skills relacionados