flutter-expert
jeffallan/claude-skills
Senior Flutter engineer for cross-platform apps with Riverpod, Bloc, GoRouter, and performance optimization.
What is flutter-expert?
Expert guidance for building high-performance Flutter 3+ applications with Dart. Use this skill when implementing widgets, state management (Riverpod/Bloc), navigation (GoRouter), platform-specific code, and performance tuning across iOS, Android, web, and desktop.
- Build reusable, const-optimized widgets and custom animations
- Implement scalable state management with Riverpod providers or Bloc/Cubit patterns
- Configure navigation and deep linking with GoRouter
- Write widget and integration tests with proper coverage
- Profile and optimize performance using Flutter DevTools
- Handle platform-specific implementations across iOS, Android, web, and desktop
How to install flutter-expert
npx skills add https://github.com/jeffallan/claude-skills --skill flutter-expert- Flutter 3+ SDK installed
- Dart 3+ compatible
- Basic understanding of widget lifecycle and state management concepts
How to use flutter-expert
- 1.Run `flutter pub get` to install dependencies after adding the skill
- 2.Define state management using Riverpod providers or Bloc classes
- 3.Build widgets as ConsumerWidget or ConsumerStatefulWidget, never StatefulWidget with app-wide state
- 4.Run `flutter analyze` and fix all lints before proceeding
- 5.Write tests with `flutter test` after each feature and verify coverage
- 6.Profile with `flutter run --profile` and use DevTools to identify and fix jank
- 7.Apply `const` constructors to all static widgets and use proper keys for lists
Use cases
- Scaffolding a new Flutter project with routing, state management, and testing structure
- Refactoring setState-based widgets to use Riverpod ConsumerWidgets for better performance
- Debugging jank and frame drops by profiling with DevTools and applying const optimization
- Implementing complex navigation flows with GoRouter and deep linking support
- Building custom widgets with proper key management and rebuild optimization
- Mobile engineers building cross-platform applications
- Flutter developers optimizing performance and architecture
- Teams adopting Riverpod or Bloc for state management
- Developers implementing platform-specific native integrations
flutter-expert FAQ
Use Riverpod for simpler, functional state management with providers and notifiers. Use Bloc for event-driven, complex business logic with explicit event/state separation. Both work; choose based on team preference and complexity.
State held in StateNotifier persists across hot reloads. Use hot restart (R in terminal) to fully reset app state and reload all code.
Profile with `flutter run --profile` and DevTools. Check rebuild counts in the Performance overlay, isolate expensive `build()` calls, apply `const` constructors, use `RepaintBoundary`, and move heavy work to `compute()`.
No. Use ConsumerWidget with Riverpod or BlocBuilder with Bloc instead. StatefulWidget causes full subtree rebuilds and is only appropriate for local, scoped state like form input.
Define providers at module level, use StateNotifierProvider for mutable state, and consume with ConsumerWidget or ref.watch(). Never mutate state directly—always create new instances in StateNotifier.
Full instructions (SKILL.md)
Source of truth, from jeffallan/claude-skills.
name: flutter-expert description: Use when building cross-platform applications with Flutter 3+ and Dart. Invoke for widget development, Riverpod/Bloc state management, GoRouter navigation, platform-specific implementations, performance optimization. license: MIT metadata: author: https://github.com/Jeffallan version: "1.1.0" domain: frontend triggers: Flutter, Dart, widget, Riverpod, Bloc, GoRouter, cross-platform role: specialist scope: implementation output-format: code related-skills: react-native-expert, test-master, fullstack-guardian
Flutter Expert
Senior mobile engineer building high-performance cross-platform applications with Flutter 3 and Dart.
When to Use This Skill
- Building cross-platform Flutter applications
- Implementing state management (Riverpod, Bloc)
- Setting up navigation with GoRouter
- Creating custom widgets and animations
- Optimizing Flutter performance
- Platform-specific implementations
Core Workflow
- Setup — Scaffold project, add dependencies (
flutter pub get), configure routing - State — Define Riverpod providers or Bloc/Cubit classes; verify with
flutter analyze- If
flutter analyzereports issues: fix all lints and warnings before proceeding; re-run until clean
- If
- Widgets — Build reusable, const-optimized components; run
flutter testafter each feature- If tests fail: inspect widget tree with Flutter DevTools, fix failing assertions, re-run
flutter test
- If tests fail: inspect widget tree with Flutter DevTools, fix failing assertions, re-run
- Test — Write widget and integration tests; confirm with
flutter test --coverage- If coverage drops or tests fail: identify untested branches, add targeted tests, re-run before merging
- Optimize — Profile with Flutter DevTools (
flutter run --profile), eliminate jank, reduce rebuilds- If jank persists: check rebuild counts in the Performance overlay, isolate expensive
build()calls, applyconstor move state closer to consumers
- If jank persists: check rebuild counts in the Performance overlay, isolate expensive
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Riverpod | references/riverpod-state.md | State management, providers, notifiers |
| Bloc | references/bloc-state.md | Bloc, Cubit, event-driven state, complex business logic |
| GoRouter | references/gorouter-navigation.md | Navigation, routing, deep linking |
| Widgets | references/widget-patterns.md | Building UI components, const optimization |
| Structure | references/project-structure.md | Setting up project, architecture |
| Performance | references/performance.md | Optimization, profiling, jank fixes |
Code Examples
Riverpod Provider + ConsumerWidget (correct pattern)
// provider definition
final counterProvider = StateNotifierProvider<CounterNotifier, int>(
(ref) => CounterNotifier(),
);
class CounterNotifier extends StateNotifier<int> {
CounterNotifier() : super(0);
void increment() => state = state + 1; // new instance, never mutate
}
// consuming widget — use ConsumerWidget, not StatefulWidget
class CounterView extends ConsumerWidget {
const CounterView({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final count = ref.watch(counterProvider);
return Text('$count');
}
}
Before / After — State Management
// ❌ WRONG: app-wide state in setState
class _BadCounterState extends State<BadCounter> {
int _count = 0;
void _inc() => setState(() => _count++); // causes full subtree rebuild
}
// ✅ CORRECT: scoped Riverpod consumer
class GoodCounter extends ConsumerWidget {
const GoodCounter({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final count = ref.watch(counterProvider);
return IconButton(
onPressed: () => ref.read(counterProvider.notifier).increment(),
icon: const Icon(Icons.add), // const on static widgets
);
}
}
Constraints
MUST DO
- Use
constconstructors wherever possible - Implement proper keys for lists
- Use
Consumer/ConsumerWidgetfor state (notStatefulWidget) - Follow Material/Cupertino design guidelines
- Profile with DevTools, fix jank
- Test widgets with
flutter_test
MUST NOT DO
- Build widgets inside
build()method - Mutate state directly (always create new instances)
- Use
setStatefor app-wide state - Skip
conston static widgets - Ignore platform-specific behavior
- Block UI thread with heavy computation (use
compute())
Troubleshooting Common Failures
| Symptom | Likely Cause | Recovery |
|---|---|---|
flutter analyze errors | Unresolved imports, missing const, type mismatches | Fix flagged lines; run flutter pub get if imports are missing |
| Widget test assertion failures | Widget tree mismatch or async state not settled | Use tester.pumpAndSettle() after state changes; verify finder selectors |
| Build fails after adding package | Incompatible dependency version | Run flutter pub upgrade --major-versions; check pub.dev compatibility |
| Jank / dropped frames | Expensive build() calls, uncached widgets, heavy main-thread work | Use RepaintBoundary, move heavy work to compute(), add const |
| Hot reload not reflecting changes | State held in StateNotifier not reset | Use hot restart (R in terminal) to reset full app state |
Output Templates
When implementing Flutter features, provide:
- Widget code with proper
constusage - Provider/Bloc definitions
- Route configuration if needed
- Test file structure
Related skills
More from jeffallan/claude-skills and the wider catalog.
laravel-specialist
Build Laravel 10+ applications with Eloquent models, Sanctum auth, queues, APIs, and Livewire components.
golang-pro
Senior Go developer for concurrent systems, microservices, and production-grade performance optimization.
php-pro
Senior PHP developer for modern PHP 8.3+, Laravel, Symfony with strict typing, PHPStan level 9, and enterprise patterns.
kubernetes-specialist
Deploy and manage Kubernetes workloads with secure manifests, RBAC, networking, and troubleshooting.
devops-engineer
Creates Dockerfiles, configures CI/CD pipelines, writes Kubernetes manifests, and generates Terraform/Pulumi infrastructure templates. Handles deployment automation, GitOps configuration, incident response runbooks, and internal developer platform tooling. Use when setting up CI/CD pipelines, containerizing applications, managing infrastructure as code, deploying to Kubernetes clusters, configuring cloud platforms, automating releases, or responding to production incidents. Invoke for pipelines, Docker, Kubernetes, GitOps, Terraform, GitHub Actions, on-call, or platform engineering.
spring-boot-engineer
Generates Spring Boot 3.x configurations, creates REST controllers, implements Spring Security 6 authentication flows, sets up Spring Data JPA repositories, and configures reactive WebFlux endpoints. Use when building Spring Boot 3.x applications, microservices, or reactive Java applications; invoke for Spring Data JPA, Spring Security 6, WebFlux, Spring Cloud integration, Java REST API design, or Microservices Java architecture.