feature
/feature
Build a new Flutter feature end to end in a feature-first, layered structure (domain, data, presentation) with Riverpod 3, loading/error/empty states and tests. Use when the user asks to add a screen, flow or feature to a Flutter app.
- Author
- ChandraChaan ↗
- Repository
- flutter-agent-skills ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Build a new Flutter feature end to end in a feature-first, layered structure (domain, data, presentation) with Riverpod 3, loading/error/empty states and tests. Use when the user asks to add a screen, flow or feature to a Flutter app.
Original author description
Build a new Flutter feature end to end in a feature-first, layered structure (domain, data, presentation) with Riverpod 3, loading/error/empty states and tests. Use when the user asks to add a screen, flow or feature to a Flutter app.
How it works
- 1. Understand before writing
- 2. Domain first
- 3. Data layer
- 4. Presentation
- 5. Tests
- 6. Verify and report
SKILL.md preview
---
name: feature
description: Build a new Flutter feature end to end in a feature-first, layered structure (domain, data, presentation) with Riverpod 3, loading/error/empty states and tests. Use when the user asks to add a screen, flow or feature to a Flutter app.
---
# Build a Flutter feature
Build the feature in small, verified steps. Follow the project's `AGENTS.md` and existing code first; this skill fills the gaps.
## 1. Understand before writing
1. Read `pubspec.yaml` (state management, routing, codegen), `analysis_options.yaml`, and one existing feature folder end to end. Copy its patterns.
2. Restate the feature in 3–5 bullet points: what the user sees, what data it needs, where it comes from, and what happens offline or on error. Ask the user only if something can't be inferred.
## 2. Domain first
Create `lib/features/<feature>/domain/`:
- **Model:** immutable, `const` constructor, `copyWith`, `==`/`hashCode` (or freezed if the project uses it). Money as `int` minor units, times as UTC `DateTime`.
- **Repository interface:** `abstract interface class <Thing>Repository` with only the methods the screen needs.
No Flutter imports in `domain/`.
## 3. Data layer
Create `lib/features/<feature>/data/`:
- An implementation of the repository (HTTP, database or both). Timeouts on every call; map failures to the project's typed exceptions.
- A provider for it: `final thingRepositoryProvider = Provider<ThingRepository>((ref) => HttpThingRepository(ref.watch(apiClientProvider)));`
- If the backend isn't ready, write an in-memory implementation with realistic delays and data, and say so.
## 4. Presentation
Create `lib/features/<feature>/presentation/`:
- **Controller:** `AsyncNotifier<State>` (or the project's equivalent). Public methods for each user action. After every `await`, check `ref.mounted` before setting `state`.
- **Screen:** `ConsumerWidget` that `switch`es on `AsyncValue`:
```dart
return switch (ref.watch(expensesControllerProvider)) {
AsyncData(:final value) when value.isEmpty => const _EmptyState(),
AsyncData(:final value) => _ExpenseList(expenses: value),
AsyncError(:final error) => ErrorView(error: error, onRetry: controller.refresh),
_ => const Center(child: CircularProgressIndicator()),
};
```
- Small private widgets for each part. Strings from localisations, colours and text styles from the theme, tap targets ≥ 48 dp with labels.
- Register the route with the router the project uses.
## 5. Tests
Add tests next to the existing ones (`test/features/<feature>/...`):
- **Controller unit test** with a fake repository: initial load, each action, and the error path.
- **Widget test** for loading, data, empty and error states, using `ProviderScope(overrides: [...])`.
- An accessibility check on the main screen:
```dart
final handle = tester.ensureSemantics();
await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
```
## 6. Verify and report
Run `dart format .`, `flutter analyze` and `flutter test`, and fix everything. Then report:
- the files you added or changed, grouped by layer
- anything stubbed or assumed (for example, an in-memory repository)
- how to try it (route, test command)
See [checklist.md](checklist.md) for a review checklist to run before reporting.
Files in this package (2)
- SKILL.md 3 KB
- checklist.md 1 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · ChandraChaan/flutter-agent-skills | 100 | MIT |
| A7-studio/jobmigo | 100 | MIT |
| crbnos/carbon | 100 | AGPL-3.0 |
| arxdsilva/ai-loops | 100 | MIT |
| jisuzzzz/haechi | 100 | MIT |
| pawangai/pawang-agents | 100 | MIT |
| andrewBezerra/concordia | 100 | MIT |
| cryndoc/polisade-orchestrator | 100 | Apache-2.0 |
| garagon/nanostack | 100 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 5ecfde6727c4 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100flutter-feature-scaffold
Use when adding a new feature or module to a Flutter app that follows feature-first Clean Architecture (data / domain / presentation) with Riverpod 3 and no code generation for providers, when deciding which layer or folder a file belongs in, or when reviewing dependency… - 100flutter-architecture
Provides Flutter app architecture patterns with feature-first structure, clean architecture, and state management (Bloc, Riverpod, Provider). Use when user asks about Flutter project structure, state management selection, dependency injection, or designing Flutter app architecture. - 95testing-flutter
Testing Flutter 3.47 / BLoC v9 / Riverpod 3 - Stratégie Complète. Use when writing tests, reviewing test coverage, or setting up testing. - 100flutter
Flutter framework guardrails, patterns, and best practices for AI-assisted development. Use when working with Flutter projects, or when the user mentions Flutter. Provides widget patterns, state management (Riverpod), navigation, and cross-platform guidelines. - 100flutter-riverpod-state-management
Implement reactive state management using Riverpod 3.x with code generation in Flutter. Use when defining providers, building AsyncNotifiers, or overriding providers in tests. - 100flutter-init-project
Initialize or reset a Flutter project into a production-ready baseline aligned with this repository's real Flutter projects: manual Riverpod setup, GoRouter routing, Material 3 configuration, shared services, shared widgets, design tokens, and either modular `lib/modules/`…