Skip to content

feat(Chore): Investigate Figma Code Connect in depth WEB-2444#1548

Open
Marcosld wants to merge 1 commit into
masterfrom
WEB-2444
Open

feat(Chore): Investigate Figma Code Connect in depth WEB-2444#1548
Marcosld wants to merge 1 commit into
masterfrom
WEB-2444

Conversation

@Marcosld
Copy link
Copy Markdown
Contributor

@Marcosld Marcosld commented May 18, 2026

Introduction

The objective of this task was investigating whether enabling Figma Code Connect measurably improves the code that Claude generates when implementing a Mistica design from Figma MCP.

We tested a single Figma design (iPhone 14 product detail page) 6 times: 3 runs with Code Connect ENABLED and 3 runs with Code Connect DISABLED (instruction to disableCodeConnect: true on every get_design_context call + unpublished code connect components). All 6 iterations were independent Claude Opus 4.7 (1M ctx) subagent runs of the same prompt — each one read the mistica-react skill, called Figma MCP on the root frame and its sub-sections, then wrote a single React component.

Summary

Across 6 runs on the same design, Code Connect ON did not measurably beat Code Connect OFF. Both groups produced semantically similar Mistica component trees with ≥98% primitive purity, and the variance between iterations within each group was larger than the variance between groups. The differentiator that mattered was how deeply the agent read llms.md (and the rest of the doc) along with randomness not whether Figma had Code Connect mappings.

Patterns

  • Both groups are ≥98% Mistica primitives. Every <div> / inline style={{...}} was counted across the 6 files. 5 of the 6 iterations emitted exactly one style={{...}} block — and in every case it was for the ACABADO color swatches, because Mistica has no clickable color-swatch primitive and the swatch fills are physical product paint colors (not theme tokens). This is a Mistica gap, not a model gap. The iteration that didn't emit a style block used mistica Circle primitive for the swatches, but it didn't add interactability to it(there's no way using mistica).
  • Same idiomatic Mistica components in every run. All 6 iterations independently picked up MainNavigationBar, NavigationBreadcrumbs, ResponsiveLayout, GridLayout, Slideshow, Image, Tag, Title1/4, Text2/3/7, InfoRating, RadioGroup, BoxedRow/BoxedRowList, Chip, ButtonPrimary, TextLink, MediaCard, Tabs, Accordion/AccordionItem, ProgressBar, Box, Stack, Inline, skinVars, plus the same set of icons.

Random failures

Despite identical prompts and identical context, the iterations fail in different places:

  • "Comprados juntos" 3-card row is the most randomized section: 3/6 iterations got 3 evenly-sized cards; the other 3 produced uneven widths (CC_1), a Ferrari-image placeholder (NCC_1), or vertical narrow strips because the agent reached for Inline + Box width="32%" instead of Grid columns={3} (NCC_3). This makes clear that creating layouts is what has the highest variability.
  • Color picker swatches rendered as stretched ellipses in CC_2 — a width/height/border-radius mismatch the agent didn't catch despite using style={{...}} directly.
  • Hero gallery: only NCC_2 produced the 2-phones-in-hand visual that matches Figma; the other 5 produced a single phone + 3 thumbnails (also valid, but less faithful), despite having instructions to download the assets from figma.
  • Nav bar: CC_2 missed the navbar completly, despite having it defined with code connect.
  • Table component: It is very curious that all the iterations without code connect used the Table component for the bottom "Características", but two of the iteractions with code connect missed it and used Inline + Divider components despite having all the info available and the component connected.
  • Slideshow thumbnails: Only 2 iterations (with code connect enabled) used a grid layout for this. The others tried to use Inline components producing thumbnails that are not visible.

Methodology

  1. Spawned 3 parallel subagents with Code Connect ENABLED (Figma desktop setting on, no disableCodeConnect override). Each independently:
    • Read mistica-react skill and use figma MCP.
    • Wrote a single React component.
  2. User disabled Code Connect in Figma desktop. Repeated with 3 fresh subagents that passed disableCodeConnect: true to every get_design_context call.
  3. Each generated file was mounted in App.tsx (wrapped in Movistar ThemeContextProvider) and rendered against Vite dev server. Playwright captured a 1368-wide full-page screenshot after clicking every [aria-expanded="false"] so the accordion content is visible.

Iterations

The reference Figma is the same for all 6 runs:


Pair 1 — CC_1 vs NCC_1

Code Connect ON (CC_1) Code Connect OFF (NCC_1)
CC_1 NCC_1
Top nav bar ✓ full bar ✓ full bar
Hero (slideshow + thumbs) ✓ 1 phone + 3 thumbs ✓ 1 phone + 3 thumbs (invisible)
Color picker ✓ circles (mistica primite but not interactive) ✓ circles
"Comprados juntos" 3-card row ✗ uneven widths; ✓ boken image but right layout
Specs / ratings / reviews accordions ✓ all 3 sections render ✓ all 3 sections render
Raw <div> count 0 1 (<div style={{flex:1}}> for rating histogram row — agent unaware Mistica Inline has no per-child grow)
Inline style={{...}} count 0 (CC_1 added a global <style> block per llms.md Quick Start instead) 2 (color swatches + flex:1 wrapper)
Score 4 / 5 5 / 5

Net. Tie on visual fidelity (both miss the accessory card row). CC_1 is the cleanest of all 6 at the file level — 0 raw <div>, 0 inline styles. Nevertheless it didn't add interactivity to the color swatches. It did just use a plain Circle. NCC_1's only Mistica-API knowledge gap (flex:1 wrapper) is unrelated to Code Connect and makes ratings render right.


Pair 2 — CC_2 vs NCC_2

Code Connect ON (CC_2) Code Connect OFF (NCC_2)
CC_2 NCC_2
Top nav bar ✗ missed it ✓ simpler bar
Hero (slideshow + thumbs) ✓ 1 phone + 3 thumbs 2 phones in hand (matches Figma) + thumbs (invisible)
Color picker ✓ small circles ✓ small circles
"Comprados juntos" 3-card row ✗ 3 uneven cards ✓ 3 even cards with credible product images
Specs / ratings / reviews accordions ✓ all 3 ✓ all 3 (Información also includes a "Don't detach" placeholder slide from Figma)
Raw <div> count 0 0
Inline style={{...}} count 1 (color swatches only) 1 (color swatches only)
Score 3 / 5 5 / 5

Net. CC_2 did make several mistakes and hallucinations in the layout, including misplaced media cards, centered bottom characteristics. It missed the main image and used a random figma one that is just the color swatches.


Pair 3 — CC_3 vs NCC_3

Code Connect ON (CC_3) Code Connect OFF (NCC_3)
CC_3 NCC_3
Top nav bar ✓ full bar ✗ full bar but 2 trailing labels mis-rendered
Hero (slideshow + thumbs) ✓ 1 phone + 3 thumbs ✓ 1 phone + 3 thumbs
Color picker ✓ circles ✓ circles
"Comprados juntos" 3-card row ✓ 3 even cards ✗✗ cards collapsed into vertical narrow strips (Inline + Box width="32%" workaround failed — should have been Grid columns={3})
Specs / ratings / reviews accordions ✓ all 3 ✓ all 3
Raw <div> count 0 0
Inline style={{...}} count 1 (color swatches only) 1 (color swatches only)
Score 5 / 5 3 / 5

Net. CC_3 is the best Code-Connect run — most balanced overall (proper grid, correct circle swatches, complete nav, real asset positioning). It did make a common mistake consisting on rendering too many stars in the inforating component. NCC_3 is the worst run of all 6 — the 3-card row collapsed to ~32px narrow strips because the agent reached for Inline + Box width="32%" instead of Grid columns={3}.

Results

Primitive purity at a glance

<div> count and inline style={{...}} count across the 6 runs:

Iteration <div> style={{...}} Notes
CC_1 0 0 Cleanest; agent added a global <style> block (per llms.md Quick Start) but no inline styles.
CC_2 0 1 Only the color-swatch buttons.
CC_3 0 1 Only the color-swatch buttons.
NCC_1 1 2 Color swatches + <div style={{flex:1}}> wrapper for rating histogram (Mistica-API gap).
NCC_2 0 1 Only the color-swatch buttons.
NCC_3 0 1 Only the color-swatch buttons.

Both groups are ≥98% Mistica. The one consistent leak across all 6 runs is the color picker (no Mistica primitive exists for clickable physical-paint swatches).

Visual fidelity at a glance

Best/worst across the 6 runs:

  • Best overall: CC_3 and NCC_1.

Code Connect comparative score

CC group NCC group
Pair 1 4/5 5/5
Pair 2 3/5 5/5
Pair 3 5/5 3/5
Total 12/15 13/15

The total is essentially a tie, with the within-group spread (CC: 3-5; NCC: 3-5) larger than the between-group spread.

Conclusions

  • Code Connect did not measurably reduce raw HTML or improve visual fidelity in this experiment. Both groups produced semantically similar Mistica component trees with ≥98% primitive purity. The CC group had two iterations (CC_1, CC_3) that found Grid columns={3} for the accessory row — but so did NCC_2. The CC group also had failures (CC_2's ellipse swatches) on par with the NCC group (NCC_3's collapsed grid).
  • The variance between iterations within each group was larger than the variance between groups. Suggests the differentiator is how deeply the agent reads llms.md in conjunction with randomness, not whether Figma has Code Connect mappings.
  • Possible reasons Code Connect didn't dominate: LLMs can already guess components intuitively. Also mistica react skill helps an agent reading it get the same result either way.
  • Shared failure modes across all 6 runs (Mistica-side gaps, not model gaps):
    • No clickable color-swatch primitive exists — every run emits inline style={{...}} for it.
    • No primitive to stretch inline children (There's a PR to add it, we should recheck when its merged wether agents not pick it).
  • Big tasks remain inconsistent. Even on a single page with identical context, the same prompt produces broken color pickers (CC_2), collapsed grids (NCC_3), uneven cards (CC_1), or near-perfect output (CC_3, NCC_2). Smaller, more bounded tasks with verification steps would likely produce more consistent results.

ref: WEB-2444

@Marcosld Marcosld self-assigned this May 18, 2026
@github-actions
Copy link
Copy Markdown

Size stats

master this branch diff
Total JS 16.1 MB 16.1 MB 0 B
JS without icons 2.02 MB 2.02 MB 0 B
Lib overhead 92.5 kB 92.5 kB 0 B
Lib overhead (gzip) 19.9 kB 19.9 kB 0 B

@github-actions
Copy link
Copy Markdown

Deploy preview for mistica-web ready!

Project:mistica-web
Status: ✅  Deploy successful!
Preview URL:https://mistica-izxghml24-flows-projects-65bb050e.vercel.app
Latest Commit:089ab96

Deployed with vercel-action

@github-actions
Copy link
Copy Markdown

Accessibility report
✔️ No issues found

ℹ️ You can run this locally by executing yarn audit-accessibility.

@Marcosld Marcosld marked this pull request as ready for review May 19, 2026 09:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the developer-facing doc/llms.md documentation.

Changes:

  • Adjusts the “Next.js optimization” subsection heading formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread doc/llms.md
The `theme` object should be constant (outside the component) or memoized with `React.useMemo`.

### Next.js optimization
### Next.js optimization.
Comment thread doc/llms.md
Comment on lines 165 to +167
The `theme` object should be constant (outside the component) or memoized with `React.useMemo`.

### Next.js optimization
### Next.js optimization.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants