flutter-architecture

Enforces feature-first layered MVVM architecture for Flutter apps using Riverpod.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/zakariaf/NearlyStop --skill flutter-architecture-zakariaf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flutter-architecture
Source: https://github.com/zakariaf/NearlyStop/tree/main/.claude/skills/flutter-architecture
Command: npx skills add https://github.com/zakariaf/NearlyStop --skill flutter-architecture-zakariaf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Flutter codebases drift into two failure modes: under-structure (widgets touching databases) and over-structure (use-case wrappers around single repository calls). This Skill gives you a right-sized, feature-first layered MVVM architecture with a strict downward-only dependency DAG, so you can always answer "where does this code belong?" in one second. ## Core Features & Use Cases - Layered MVVM rules: Dumb Views over one Notifier/AsyncNotifier ViewModel per feature, repositories as the single source of truth and single write path, and immutable domain values mapped at boundaries. - Right-sizing guidance: Reject over-engineering with concrete criteria — abstract only what cannot run in a test, add a domain layer only when logic spans repositories, and split into packages only when a compile wall is load-bearing. - Riverpod 3.x DI discipline: One context-free DI mechanism with placeholder-override composition roots, keepAlive vs autoDispose rules, and ProviderContainer-based tests — no get_it, injectable, or package:provider containers. - Use Case: When creating a new Flutter feature, deciding folder-vs-package placement, naming a Screen/Notifier/Repository, or reviewing whether a change respects layer boundaries, apply this Skill and run the included architecture check script before opening a PR. ## Quick Start Ask the AI to create a new Flutter feature following the flutter-architecture rules and verify the result with the architecture check script.

Frequently Asked Questions about flutter-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Flutter app with MVVM and Riverpod?

Group code feature-first under lib/features/, with each feature's dumb ConsumerWidget View and one Notifier/AsyncNotifier ViewModel in presentation/. Repositories in lib/data/ are the single source of truth, and Riverpod providers wire all dependencies from a composition root in bootstrap.dart.

When should a Flutter app use a domain or use-case layer?

Add a domain/use-case layer only when logic spans multiple repositories, such as aggregations or multi-step workflows. A use-case that forwards one repository call is a rename, not a boundary — Flutter's own guidance rates the domain layer as conditional.

Should I use get_it or Riverpod for dependency injection in Flutter?

Use Riverpod as the single DI and state mechanism; do not add get_it, injectable, or package:provider as a second container. Riverpod resolves dependencies without a BuildContext, so the same wiring serves screens, callbacks, and background isolates.

When should a Flutter app split into multiple packages?

Split into packages only when a compile-time wall is load-bearing, such as a pure-Dart core you golden-test or a design system shared across apps. A single package with feature folders is the default; multi-package workspaces are an option large apps grow into.

Why should Flutter repositories avoid abstract interfaces over a local database?

A repository over an in-memory database already runs in flutter test, so an interface buys nothing and a Map-backed fake can accept rows the real schema rejects. Abstract only what cannot run in a test, such as platform channels or network clients.