/flutter-design-fidelity:golden-testsfrom flutter-design-fidelity
Adds or reviews Flutter visual regression (golden) tests for stable UI states and investigates golden mismatches. Covers device, theme, text scale, and locale/direction variants.
Ships in flutter-design-fidelity. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Profile first. Read
.agents/flutter-profile.yamlin the project root, falling back to legacy.claude/flutter-profile.yaml.localesdetermines the matrix below — generate an RTL variant when the project ships an RTL locale, and skip it when it does not, rather than generating a variant nobody will ever look at. Field list:../design-tokens/references/flutter-profile.md, relative to this skill directory.
Visual verification proves a screen matches today. Goldens are what stop it drifting tomorrow. Add coverage for stable shared components and significant screen states, using the existing test framework. Small edits usually need the affected existing test, not a new golden suite. If the project has no goldens, justify setup against the task.
test/goldens/
├── flutter_test_config.dart # font loading, once, for all golden tests
├── components/
│ ├── primary_button_test.dart
│ └── goldens/ # generated PNGs, committed
└── screens/
├── login_screen_test.dart
└── goldens/
Each golden test covers the axes that actually break layouts:
Full cross-product is too many images to review. Cover 1.0/light/LTR on every device, then relevant variants for supported dark mode, 2.0 text scale, and RTL. That catches the real failures without generating sixty files nobody looks at.
The example below uses golden_toolkit APIs. Use it only when that package already
exists and its resolved version supports them. Otherwise prefer Flutter’s built-in
matchesGoldenFile and the project’s existing wrappers; do not add a dependency just
to follow this example. Cover loading, error, and empty states where visually meaningful.
void main() {
testGoldens('PrimaryButton renders across states', (tester) async {
final builder = DeviceBuilder()
..overrideDevicesForAllScenarios(devices: [Device.phone, Device.tabletPortrait])
..addScenario(widget: const PrimaryButton(label: 'Continue'), name: 'default')
..addScenario(widget: const PrimaryButton(label: 'Continue', isLoading: true), name: 'loading')
..addScenario(widget: const PrimaryButton(label: 'Continue', onPressed: null), name: 'disabled');
await tester.pumpDeviceBuilder(builder, wrapper: materialAppWrapper(theme: AppTheme.light));
await screenMatchesGolden(tester, 'primary_button_light');
});
}
Load real fonts in flutter_test_config.dart. Without it every golden renders in
Ahem — solid black boxes — and the test verifies layout while proving nothing about
typography.
flutter test --update-goldens
This command is how design drift enters a codebase. It always makes the tests pass, which means a failing golden is only useful if someone looks at what changed.
Never run it as a reflex when a test fails. First determine whether the change was intended. If it was, regenerate, then open the changed PNGs and look at them before committing. If a golden changed and nobody can say why, that is a bug being committed, not a test being updated.
In review, treat changed golden files as changed code.
MaterialApp with an ad-hoc theme instead of a
shared wrapper. The goldens then test the wrapper, not the widget.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
4 skills in this plugin
/design-tokensResolve Flutter visual values through the project’s existing theme, constants, or token extension. Honor projects with no token layer./figma-to-widgetImplement Flutter UI from a Figma frame or supplied design image, preserving layout intent and reusing project components. Not for unrelated mentions of Figma./visual-verificationCapture and compare Flutter UI against a supplied reference after substantial visual changes or an explicit fidelity check. Report missing capture inputs honestly.npx claudepluginhub draz26648/flutter_craft_skills --plugin flutter-design-fidelityOther plugins' skills for the same job