Overview
A Claude Code plugin that ships two things:
figma-to-flutter — a model-invoked skill that runs a closed render-and-compare loop on each Figma frame: generate widget, render to PNG, diff against the Figma export, critique the gap, fix the top items, repeat — until an SSIM gate passes or a plateau detector stops the loop.
/figma-to-flutter:setup — a slash command that does the one-time setup in your Flutter repo: copies harness templates, wires fonts and assets, checks Python and Figma access, and reports anything still blocking before the first run.
[!NOTE]
Why a loop? Generation is the easy half. The value is in the harness: a quantitative gate (SSIM + pixel mismatch) decides "are we done", and a multimodal critic decides "what to fix next". The number gates; the critique steers. One won't do the job of the other.
Features
- Render-and-compare loop — golden-style widget tests capture each frame to PNG; diff and critique run outside Flutter.
- Two evaluators, one job each — SSIM + pixel mismatch is the gate; the agent reading reference and render side-by-side is the steerer.
- Bottom-up composition — shared components first, screens last. Tighter loops, cleaner diffs, fewer iterations on layout noise.
- Auto-stop built in — iteration cap (default
8), plateau detection across consecutive attempts, and an explicit "don't pixel-chase" SSIM target around 0.95.
- One install, both artifacts —
/plugin install exposes the skill and the setup command together.
- Figma MCP first, REST fallback — works whether you have the official Figma plugin or just a personal access token.
- Per-task checkpoints — every frame has its own
checkpoint.md, attempt history, scores, and critique log. Sessions resume cold.
Prerequisites
- Claude Code — the CLI that runs the skill.
- Flutter SDK —
flutter test must work; the harness is a headless widget test, no emulator needed.
- Python 3.10+ with
pillow, numpy, scikit-image for the diff script.
- Figma access, one of:
- the official Figma MCP server (
https://mcp.figma.com/mcp, recommended), or
- a Figma personal access token exported as
FIGMA_TOKEN.
Install
In a Claude Code session:
/plugin marketplace add rafa-js/claude-figma-to-flutter
/plugin install figma-to-flutter@flutter-ui-skill
You will then have:
- the skill
figma-to-flutter — auto-triggers on any Figma-to-Flutter request, and
- the command
/figma-to-flutter:setup — run once per Flutter repo.
[!TIP]
To update later: /plugin marketplace update flutter-ui-skill then /plugin update figma-to-flutter@flutter-ui-skill.
Local development install
If you are iterating on the plugin source, point Claude Code at it directly instead of going through the marketplace:
claude --plugin-dir /path/to/claude-figma-to-flutter
Use /reload-plugins after every edit.
Optional: Figma MCP plugin
claude plugin install figma@claude-plugins-official
The MCP plugin gives the agent first-class read tools for Figma code, images, and variable definitions. Without it, the skill falls back to the REST API via FIGMA_TOKEN.
[!IMPORTANT]
If the Figma file uses Code Connect to map components to real Flutter widgets, the MCP output points the agent straight at them — that single lever cuts the most iterations out of the loop. Worth confirming with the design team before the first run.
Diff dependencies
pip install pillow numpy scikit-image
The setup command (next section) checks for these and will offer to install them.
Quickstart
1. Set up your Flutter repo (once)
From the root of your Flutter project, in a Claude Code session:
/figma-to-flutter:setup
The command walks the agent through every prep step interactively — copying harness templates into test/harness/, creating the directory skeleton, proposing pubspec.yaml and .gitignore edits (with diffs, before applying), checking Python deps, confirming Figma access, and verifying the project is ready. It skips work already done, so it is safe to re-run.
It will ask you for: