flutter-feature-implementation
Feature Implementation Skill
Checklist
Code Structure
- Files in data/domain/view (DTOs → data, Models → domain)
- @JsonSerializable on DTOs, Equatable on Models
- Repository interface in domain, implementation in data
- Bloc (complex) or Cubit (simple) in view
Design System
- ColorPalette (no hardcoded colors)
- Spacing (no magic numbers)
- Project's Design System Text Widgets (typography)
- Project's Design System Assets (images/icons)
- Core widgets (
lib/core/widgets/)
State Management
- Bloc for complex (multiple events), Cubit for simple
- @injectable on classes (auto-registration)
- BlocProvider at page level
- BlocBuilder scoped to minimal subtree
Error Handling
- Try-catch in repositories
- Map DioException → custom exceptions (NetworkException, NotFoundException)
- Error states in Bloc/Cubit
- User-friendly messages
Testing
- Unit tests for Bloc/Cubit (90%+ target)
- Mock with mocktail
- Test structure mirrors source
- Use fixtures for mock data
Quality
-
flutter analyzepasses (zero errors) - Run
./build_runner.shafter changes - Commit *.g.dart files
Patterns
// ✅ Clear naming
class FeatureRepository {}
// ✅ Null safety
final name = user?.name ?? 'Guest';
// ✅ const
const Text('Static');
// ✅ Async/await
try {
final data = await repository.fetch();
emit(LoadedState(data));
} catch (e) {
emit(ErrorState(e.toString()));
}
// ✅ Bloc test
blocTest<MyBloc, MyState>(
'emits [Loading, Loaded]',
build: () {
when(() => repository.fetch()).thenAnswer((_) async => data);
return bloc;
},
act: (bloc) => bloc.add(LoadRequested()),
expect: () => [LoadingState(), LoadedState(data)],
);
Resources
- Extensions →
lib/core/utils/extensions/ - Helpers →
lib/core/utils/helpers/ - Validators →
lib/core/utils/validators/
More from desquared/agents-rules-skills
shared-bug-investigation
Scientific method expert for systematic bug investigation and root cause analysis. Use when users report bugs, crashes, unexpected behavior, or debugging requests. Applies hypothesis-driven investigation, controlled experiments, and rigorous validation across any programming language or platform.
23android-performance-profiler
Identifies potential performance bottlenecks in Jetpack Compose code including expensive recompositions, unnecessary redraws, and memory issues. Use when code involves lists, animations, complex UI, or when the user asks about performance optimization.
19ios-swiftui-architecture-review
Analyze SwiftUI view hierarchies and suggest MVVM or other architectural improvements. Use when **reviewing existing SwiftUI code**, creating new SwiftUI components, analyzing view structure, or when the user asks about SwiftUI architecture patterns. Best for code review and refactoring guidance.
13android-compose-architecture-review
Analyze Jetpack Compose UI hierarchies and suggest MVVM/MVI or other architectural improvements. Use when reviewing existing Compose code, creating new Compose components, analyzing composable structure, or when the user asks about Compose architecture patterns. Best for code review and refactoring guidance.
13android-accessibility-validator
Checks and suggests accessibility improvements for Jetpack Compose and Android Views including TalkBack labels, dynamic text support, and color contrast. Use when creating or modifying UI components, screens, or when the user asks about accessibility.
12android-kotlin-api-design-reviewer
Review function and class interfaces for Kotlin Coding Conventions compliance. Use when creating public APIs, reusable components, library interfaces, or when the user asks for API design review or Kotlin naming conventions.
11