Verify Code
verify_codeCheck Flutter, SwiftUI, React, or HTML code against a Figma design by rendering it and comparing pixels; returns compiler/runtime errors and a diff image.
Instructions
Check Flutter, SwiftUI or React + Tailwind code against the design and compare the render with Figma's own 2x render of the node: Flutter code is analyzed and rendered with flutter test; SwiftUI code is compiled and rendered in the booted iOS simulator (Xcode needed); React and HTML render in headless Chrome with Tailwind. Returns compiler or analyzer errors, runtime errors (Flutter: overflows, missing assets; React: broken images), the share of differing pixels and a diff image (the design in grey, differing pixels in red). The framework comes from framework, else from the file's language, else from the client and the project like get_design_context.
React and HTML: without file it checks the code get_design_context generates and compares every layer's box too. With file (a .jsx or .tsx under a folder with package.json, or an .html page) it renders that file's default export or page: it must be self-contained apart from React and image imports; images load from the project's public folder. Pass css for the stylesheet with its tokens. React and Tailwind load from a CDN and the fonts from the system or Google Fonts. Needs Chrome and the puppeteer-core package.
Flutter and SwiftUI: with file, it checks that widget or view inside its own project: a Flutter widget with the project's packages and assets, inside a MaterialApp, scaled by flutter_screenutil to the frame size when the project uses it; a SwiftUI view compiled with the project's DesignSystem.swift and asset catalogs, so it must build without the rest of the project. The widget or view needs an init without arguments. Without file, it checks the reference code get_design_context generates and compares every layer's box with the design. Use it after implementing a frame, and fix what it reports. Text in fonts it cannot find is drawn in a fallback font, and emoji have no colour font in the Flutter test, so text after them shifts. The design's status bar and home indicator belong to the phone and are left out of the SwiftUI comparison. A run takes from 20 seconds to a few minutes.
Every result has a coverage block: what the run checked, and for each interactive element (from its role and the states its Figma component defines) the states, keyboard and screen-reader behaviour it did not check, plus screen-wide items (dark mode, other widths and text sizes, right-to-left). React and HTML runs also press Tab through the page: the Tab order, missing focus indicators, controls Enter or Space does not activate, missing accessible names and clickable elements the keyboard cannot reach. Hand the not-checked list back with the implementation.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "verify_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| css | No | React: a CSS file to load with the component, e.g. its global stylesheet with the design tokens. | |
| file | No | Flutter: the .dart file with the widget, under the project's lib/. SwiftUI: the .swift file with the view. React: the .jsx/.tsx component file. HTML: the .html page. Absolute, or relative to the project. | |
| fonts | No | Folders with font files (default: the project's assets/fonts and the system fonts). | |
| device | No | SwiftUI: the simulator to render in, by udid or name (default: a booted iPhone 17 Pro, another booted iPhone, else an iPhone Pro it boots). Renders are 2x and light mode on any device. | |
| nodeId | No | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. | |
| widget | No | The widget class or SwiftUI view struct in `file` (default: its first one). | |
| fileKey | No | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. | |
| flutter | No | Flutter: path of the flutter tool, when it is not on PATH. | |
| interact | No | SwiftUI, generated code: after rendering, tap every button of the screen and report what each did (redrew the screen, asked its owner through the Action enum, did nothing visible, or hung). | |
| tailwind | No | React: the Tailwind major version (default: the project's, else 4). | |
| viewport | No | Flutter: lay the code out on a screen of this size, e.g. "360x780", and report runtime errors (overflows) and layers pushed off screen instead of comparing. | |
| framework | No | What to check (default: from the file's extension, else as get_design_context picks: the client, then the project). | |
| dynamicType | No | SwiftUI: render at this text size to check the layout under Dynamic Type (default large; the pixel comparison stays with the design at the default size). | |
| clientLanguages | No | Comma separated languages of the client, e.g. "dart" or "swift" (picks the framework). | |
| clientFrameworks | No | Comma separated frameworks of the client, e.g. "flutter" or "swiftui" (picks the framework). |