Flutter Test Writer Skill for Antigravity CLI
Write a Flutter widget or unit test for a behavior, including the mounted check after an await. Use when the user asks for Flutter tests. Do not use for a non-Flutter repository or to edit a generated file.
name: "flutter-test-writer" description: "Write a Flutter widget or unit test for a behavior, including the mounted check after an await. Use when the user asks for Flutter tests. Do not use for a non-Flutter repository or to edit a generated file."
Flutter Test Writer
Shared skill flutter-test-writer for Flutter. Codex and Antigravity CLI both read .agents/skills/flutter-test-writer/SKILL.md. Install this one file. Codex calls it with $flutter-test-writer or /skills. Cursor, GitHub Copilot, and Devin also read .agents/skills. A second copy with the same name collides. Do not install another tool's file there.
When to run
Run this when the user wants a Flutter test: a widget test, a unit test, or a regression for a UI bug.
When to leave it
Stop for a non-Flutter repository. Do not add an integration driver the project does not have unless the user asked.
Steps
- Read
pubspec.yamland an existing test so the imports andtestWidgetsstyle match. - Name the behavior. Include the async case: after a future completes, the widget shows the result, and a disposed widget does not call
setState. - Pump the widget. Find by text, key, or type. Tap or enter text.
pumpAndSettleonly when the animation is expected to finish. A fixedFuture.delayedin a test is a smell. - Do not edit generated files to make the test compile. Fix the source.
- Run
flutter teston the new file. Record the output. If the SDK is missing, writenot run.
Output
## Files written
- test/profile_page_test.dart
## Covered
- After `lookup()` completes, the widget pops only if `context.mounted` is true.
## How to run
flutter test test/profile_page_test.dart
## Result
pass, fail, or not run. If the SDK is missing, say so. Do not report a pass you did not see.
## Gaps
- Devices and platforms this run did not exercise.
Example: profile_page.dart pops after await lookup() with no mounted check. The test pumps the widget, completes the future after unmount, and expects no Navigator use. Run flutter test on that file.
Stop
Stop when the user asks you to mark the test passed without running it, or to change the Flutter SDK constraint to satisfy one import.