agentleFS
rolandtolnayrolandtolnay/flutter-llm-toolkit/skills/flutter-conventions/SKILL.md

flutter-conventions

Skill2 starsChanged 41 days agoMITView on GitHub

Conventions and proven patterns for Flutter apps built with Riverpod, flutter_hooks and auto_route. Use when implementing or changing Flutter code.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. Tenraining/Claude-Skills★ 1same name
    2. techmefr/mentis★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Before creating a widget, look in lib/common/widgets/ and the feature's widgets/.

    line 30
  2. Very specific:

    Use the newest syntax the project's SDK constraint allows (environment: sdk: in pubspec.yaml):

    line 53
  3. Very specific:

    Run code generation after changing providers, routes or serialisable models, then dart analyze (through fvm when the project uses it).

    line 91

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Flutter Conventions

How this family of apps is built. The rules below apply to every change; the references/ files hold the shapes for specific tasks and are read when the task touches them. Project AGENTS.md files add project-specific facts (commands, backend, branding) and override anything here when they conflict.

Stack: Flutter stable, Riverpod 3 with code generation, flutter_hooks, auto_route, easy_localization, Equatable, package:collection, package:logging, Lucide icons. Backends vary (gRPC, REST over Dio, Firebase); the layering does not.

Architecture

Three layers, one direction of dependency:

API (domain/)  →  Provider (provider/)  →  UI (screens, widgets/)
  • The API class talks to the backend and returns domain entities. Transport types (proto messages, JSON maps, Firestore snapshots) are converted in the API class via extension methods colocated with the entity and never leave domain/.
  • Providers own state and orchestrate API calls. Business rules live in entity computed properties (bool get canDelete => isOwner && !isArchived), not in widgets or providers.
  • UI reads providers and triggers notifier methods. It never calls an API or touches storage directly.

These three boundaries are the invariants of the codebase. Everything else in this file is a default to follow unless the project says otherwise.

Project Structure

Feature folders directly under lib/ (lib/account/, lib/payment/), screens at the feature root, and domain/, provider/, widgets/ subfolders created when two or more files justify them. Shared code lives in lib/common/ (widgets/, extensions/, util/, theme/, storage/, data/). No features/ wrapper, no presentation/ layer, no barrel files. Details: references/folder_structure.md.

Before creating a widget, look in lib/common/widgets/ and the feature's widgets/; reuse beats a near-duplicate.

Widgets

  • Screens are HookConsumerWidget; smaller widgets are HookWidget or StatelessWidget. StatefulWidget only when a hook cannot express the lifecycle.
  • Inside build(): providers, then hooks, then derived values, then widget variables in render order. Always-shown subtrees are local variables, conditional ones are _buildX() methods, large or reused or stateful ones are their own widget in their own file. No file-private widget classes.
  • Helpers needing four or more locals (hooks, controllers) are closures inside build(); otherwise class methods. Pass WidgetRef alone when a helper needs both ref and context (ref.context).
  • Styling comes from context.color, context.typography and the spacing constants (kGapItem, kGapSection, kSide, kCorner); icons from LucideIcons. No hex literals or magic numbers in widgets.
  • Shared widgets (AppPrimaryButton, AppBottomSheet, AppTextField, AppChip) are written in lib/common/widgets/ on top of Material widgets and the theme tokens. No third-party component kit; the app owns its design system.

Details: references/widget_style_guide.md, references/hooks.md, references/design_principles.md.

State and Actions

  • Data that outlives a screen lives in a provider; a widget keeps only ephemeral UI state (focus, a local toggle) in hooks.
  • Each user action is an on-demand action provider (FutureOr<T?> build() => null) whose method uses AsyncValue.guard, checks ref.mounted before writing state after an await, and invalidates the providers it made stale. The action's isLoading drives the button; the screen reacts to the outcome through ref.listen / ref.listenOnError.
  • First-load errors render inline with a retry that invalidates the provider. Action errors show a toast via listenOnError and the user retries by tapping again. Refreshes keep existing content visible.
  • Complex state is a sealed type switched exhaustively, never a set of booleans.

Details: references/riverpod.md, references/error_handling.md.

Modern Dart

Use the newest syntax the project's SDK constraint allows (environment: sdk: in pubspec.yaml):

  • Switch expressions, records, patterns and sealed classes (Dart 3.0+).
  • Column(spacing:) / Row(spacing:) (Flutter 3.27+) when every gap is equal; .divide(widget) when the separator is a real widget or the children are inline spans.
  • Dot shorthands (alignment: .center, padding: .all(16)) when the type is inferred (Dart 3.10+).
  • Primary constructors where the SDK and lints accept them.
  • package:collection helpers (sorted, firstWhereOrNull, groupBy) over manual loops and mutation.

Where to Look

Task touchesRead
New feature's API, entity, DTOreferences/rest_api.md (REST and gRPC variant)
Providers, families, lifecycle, mutationsreferences/riverpod.md
Exceptions, error display, crash reportingreferences/error_handling.md
Screen layout, extraction, build orderreferences/widget_style_guide.md
Hooks, controllers, StatefulWidget migrationreferences/hooks.md
State modelling, widget APIs, abstraction decisionsreferences/design_principles.md
Lists, pagination, skeletons, empty and error statesreferences/lists.md
Filters, sorting, filter sheetsreferences/filter_sort.md
Client-side searchreferences/entity_search.md
Forms, validation, submitreferences/forms.md
Bottom sheets, dialogs, confirmationsreferences/sheets_dialogs.md
Multi-step flows, draftsreferences/wizard.md
Routes, tabs, deep-linkable screens, typed resultsreferences/navigation.md
App entry, flavors, containerreferences/app_bootstrap.md
Log levels, what to log where, transport logging, crash reporter routingreferences/logging.md
Splash, startup checks, forced updatereferences/startup_gate.md
Auth state, sign-out, account selectionreferences/auth_session.md
Analytics, support, purchases or push SDK wrappersreferences/sdk_session.md
Preferences, secure storage, cachesreferences/storage.md
Translations and the codegen scriptreferences/localization.md
Colors, typography, dark modereferences/theme.md
Shared extensions and hooks a new app needsreferences/common_kit.md
Lint setup for a new projectreferences/analysis_options.yaml

Finishing

Run code generation after changing providers, routes or serialisable models, then dart analyze (through fvm when the project uses it). Before reporting a Flutter change as done, run the flutter-code-quality check on the changed files and apply its findings.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.