From ai-agent-kit
Use when modifying Flutter code: widgets, state management (Riverpod / BLoC), navigation (go_router), tests (flutter_test + mocktail), platform channels, build / release flow.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ai-agent-kit:mobile-flutter**/*.dart**/pubspec.yaml**/pubspec.lockThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Predictable Flutter apps with clear state ownership, fast rebuilds, and
Predictable Flutter apps with clear state ownership, fast rebuilds, and
tests that survive refactors. No god-widgets, no setState everywhere,
no business logic in widget files.
lib/
features/ # one folder per feature: screens + state + widgets + tests
shared/
widgets/ # reusable presentational widgets
services/ # API clients, storage, push
theme/ # ThemeData, colors, typography
routing/ # go_router config, route names, guards
main.dart # entry point only
test/ # mirror lib/ structure
Rules:
lib/screens/.shared/ or a separate package — testable without Flutter.final over var. Reach for const whenever the value is compile-time known.sealed class (Dart 3) for closed hierarchies — exhaustive switch checks.(int, String) for ad-hoc tuples; named records ({int id, String name}) for clarity.dynamic. Use generics, or Object? with explicit narrowing.StatelessWidget. Reach for StatefulWidget only when you need lifecycle hooks (controllers, animations) and even then, lift state up if possible.build() cheap — no I/O, no computation that can be done above.const constructors everywhere possible — the framework reuses them.Key on items in ListView.builder when items can reorder.Pick one per project. Don't mix.
| Tool | When to use |
|---|---|
| Riverpod 2.x | Default for new projects. Compile-safe, testable, no BuildContext needed. |
| flutter_bloc | Larger teams that prefer explicit event/state classes. |
| Provider | Legacy; existing projects only. |
Plain setState | Trivial local UI state (toggle, counter). |
For Riverpod:
@riverpod annotated providers (generates code). One provider per concern.ref.watch to rebuild, ref.read for one-shot reads inside callbacks.FutureProvider / StreamProvider — pattern-match on AsyncValue.go_router is the modern default — declarative, deep-link-friendly, supports nested navigators.redirect callback, not in widget initState.dio (rich, MIT) or http (official, simpler). Pick one per project.Success / Failure).shared_preferences for primitives, flutter_secure_storage for tokens, drift / isar for structured data.const constructors prevent unnecessary rebuilds.ListView.builder / SliverList with itemExtent when item height is fixed.cached_network_image (MIT) for remote; preload critical assets.Opacity for hiding — use Visibility or conditional building.--profile mode, not --debug (debug overhead skews results).camera, local_auth, firebase_messaging).permission_handler (MIT). Request at use time, not at app start.Semantics widget around custom-painted UI.label, hint, and excludeSemantics: true on decorative children.MediaQuery.of(context).textScaleFactor — don't hardcode font sizes that break at 200%.package:test (or flutter_test's test()) for pure Dart. Fast, no widget tree.flutter_test with WidgetTester. Pump widgets, find by key/text/semantics, tap, expect.integration_test package. Real device or emulator. Few, slow, critical flows only.mocktail (MIT, no codegen). Avoid mockito for new code (codegen overhead).testWidgets('shows error on empty email', (tester) async {
await tester.pumpWidget(MaterialApp(home: LoginScreen()));
await tester.tap(find.byKey(const Key('signInButton')));
await tester.pump();
expect(find.text('Email is required'), findsOneWidget);
});
flutter_flavorizr or manual flavors for dev / staging / prod.pubspec.yaml version, smoke test both platforms, screenshots, store metadata.build().setState after await without checking mounted.print() in committed code — use developer.log or a logging package.Uri constructors.as casts on parsed JSON — pattern-match or validate explicitly.google-services.json / GoogleService-Info.plist with real keys.Future.delayed for waiting on UI in tests — use tester.pump(Duration(...)) or tester.pumpAndSettle.flutter pub get
dart analyze
dart format --set-exit-if-changed lib test
flutter test
flutter test --coverage
flutter build apk --debug # CI smoke
flutter build ios --no-codesign # CI smoke
Always report:
dart analyze / flutter test / build results.dependencies skill).npx claudepluginhub petrovc/ai-agent-kit --plugin ai-agent-kitFetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Applies a firm's KYC/AML rules grid to parsed onboarding records: assigns risk rating, checks required documents, outputs rule outcomes with citations, and routes for escalation.
Generates daily or weekly digests of activity from connected sources (chat, email, docs, tasks, CRM), highlighting action items, decisions, mentions, and project updates.