/flutter:lint-and-style-configfrom Flutter Skills
Enforces a strict Dart analysis_options.yaml built on very_good_analysis with promoted error rules, dart format authority, and suppression discipline. Use when editing lint config, adding/removing rules, or debugging analyzer behavior.
Ships in Flutter Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Style is not taste; it is toolchain-enforced. dart format owns whitespace, the
analyzer owns correctness, and a small set of silence-producing bug classes
are promoted to build-failing errors. This skill governs the
analysis_options.yaml itself and the mechanics that decide whether it actually
does anything. Applies whenever you edit that file, add or silence a lint, or
bump the SDK/ruleset.
Read the reference for the task at hand:
references/rule-catalog.md — every promoted rule and its bug class, the
deliberate downgrades, the contested public_member_api_docs call, and the
complexity-limit table.references/config-mechanics.md — the include-pin trap, errors:-re-ranks
vs linter:-enables, sealed-switch analyze-vs-compile, coverage mirroring,
the riverpod_lint plugin, and suppression discipline.Copy examples/analysis_options.yaml into the package root as the starting
config. Run scripts/verify-include-pin.sh and scripts/lint-gates.sh before a
PR.
dart format is the only whitespace authority. Never hand-format, never
argue with it, never // dart format off except around a hand-laid table
with a justifying comment. CI runs dart format --set-exit-if-changed ..very_good_analysis, pinned to the version-numbered include.
Never the bare analysis_options.yaml — a pub upgrade must not silently
change what counts as an error. VGA already sets strict-casts,
strict-inference, strict-raw-types; do not restate them in a
language: block (redundant config drifts and contradicts).dart analyze --fatal-infos --fatal-warnings. Unaddressed infos accumulate into noise that hides real
issues.print. Not style preferences.errors: only works if the base ruleset already enables
the rule. errors: re-ranks existing diagnostics; it cannot turn on an off
rule. To enable a rule VGA omits, add it under linter: rules: first.linter: rules:. - rule items and
rule: true entries in one block is a parse error — a broken analyzer, which
is a green build. To disable a base rule, use errors: <rule>: ignore.errors: override cannot be trusted to silence
it, and any code path that reaches dart compile still fails there — an
analyze-only gate can go green over code that will not build.// ignore_for_file: on a promoted rule; never any suppression on an
architecture/import gate. Prefer fixing the code.custom_lint. riverpod_lint 3.x runs on the first-party
plugin system; its diagnostics fire on a plain flutter analyze.include: package:very_good_analysis/analysis_options.10.3.0.yaml
If that filename does not exist in the resolved package, you get one
warning • include_file_not_found and analysis runs with zero rules. A
build that checks nothing is green.
Bump the include filename in the same commit as the SDK/VGA bump, verify the
file exists (ls ~/.pub-cache/hosted/pub.dev/very_good_analysis-*/lib/), and
after any bump confirm a known violation still errors — never trust green.
scripts/verify-include-pin.sh automates the existence check.
analyzer:
errors:
unawaited_futures: error
discarded_futures: error
empty_catches: error
avoid_catches_without_on_clauses: error
only_throw_errors: error
throw_in_finally: error
use_build_context_synchronously: error
cancel_subscriptions: error
close_sinks: error # VGA ships this at `ignore`; re-promoted
avoid_dynamic_calls: error
always_declare_return_types: error
cast_nullable_to_non_nullable: error
exhaustive_cases: error
avoid_print: error
avoid_slow_async_io: error
Each turns an info-level squiggle a solo dev scrolls past into a build failure.
See references/rule-catalog.md for the per-rule bug class and the rules held
deliberately at warning/ignore (deprecated_member_use,
invalid_annotation_target, lines_longer_than_80_chars).
errors: re-ranks; linter: rules: enables# Promoting works ONLY because VGA already enables these rules (close_sinks even
# at severity `ignore` counts as enabled — the override resurrects it).
analyzer:
errors:
close_sinks: error
# To enable a rule VGA does NOT ship, add it here FIRST, then optionally promote.
linter:
rules:
some_rule_vga_omits: true
Verify with a real violation — never assume a promotion took. The shipped config
needs no linter: rules: block because every rule it promotes is VGA-enabled.
sealed class SaveResult {}
class Saved extends SaveResult {}
class SaveFailed extends SaveResult {}
// Missing a case is `non_exhaustive_switch_statement` — a COMPILE error.
// (A switch *expression* raises `non_exhaustive_switch_expression` instead.)
String describe(SaveResult r) {
switch (r) {
case Saved():
return 'saved';
case SaveFailed():
return 'failed';
}
}
exhaustive_cases only covers enum / static-const sets. Model failure and mode
types as sealed so a new case breaks the build at every call site instead of
falling through a default into silence. An errors: override cannot be
trusted to suppress an exhaustiveness diagnostic, and even where dart analyze
is coaxed green dart compile still fails — so CI must build, never merely
analyze. See dart3-idioms-and-coding-standards.
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
- "**/*.drift.dart"
- "**/generated_plugin_registrant.dart"
- "test/drift/generated/**" # drift schema snapshots — never reformat/fix
The identical globs must also feed coverage filtering (lcov --remove or your
reporter's excludes). Excludes and coverage filters that drift apart lie the
number upward. See testing-strategy and codegen-and-toolchain.
// WRONG — flagged by NOTHING. The arrow returns the Future (so discarded_futures
// is satisfied), but the target is VoidCallback, so Dart drops it silently.
onPressed: () => repository.save(note),
// RIGHT — a void-returning intent method the callback holds safely.
class NoteController {
void saveNow(Note note) => unawaited(_repo.save(note).catchError(_report));
}
// onPressed: () => controller.saveNow(note),
The mitigation is structural, never disciplinary. A green analyzer is not proof
an operation ran; the highest-severity failures are invisible to every rule and
need a manual pass. See examples/callback_future_hole.dart and async-safety.
include: package:very_good_analysis/analysis_options.yaml — a pub
upgrade silently changes the ruleset; a missing pinned file silently disables
it. Pin and verify.strict-casts/strict-raw-types in a language: block — VGA
sets them; the copy drifts and eventually contradicts.errors: cannot resurrect an off
rule, so the promotion silently does nothing.- rule and rule: false in one linter: rules: block — parse
error, broken analyzer, green build.dart compile when a sealed
switch is non-exhaustive.// ignore_for_file: on a promoted rule, or any suppression on an import
gate — the next edit is unprotected; a silenced correctness gate is a
blocker.custom_lint — legacy plugin system; riverpod_lint 3.x needs none.dart format --set-exit-if-changed . clean; dart analyze --fatal-infos --fatal-warnings passes; CI builds (not analyze-only).scripts/verify-include-pin.sh passes).language: block; strict modes come from VGA.error; every promoted rule is
one VGA actually enables.linter: rules:.// ignore_for_file: on a promoted rule.version: key; no custom_lint.dartdoc-conventions — backs public_member_api_docs: error and the seams to
document.async-safety — the Future-dropped-in-a-callback hole this config cannot see.error-handling-typed-results — the sealed Failure/Result spine that
makes exhaustiveness a compile-time guarantee.dart3-idioms-and-coding-standards — sealed types and the exhaustive-switch
discipline behind rule 7.naming-conventions — the role suffixes and Effective-Dart naming the analyzer
does not enforce.state-management-riverpod — the Riverpod patterns riverpod_lint guards.codegen-and-toolchain / run-codegen — the generated files these excludes
cover.ci-pipeline-and-gates — where these gates and the build-not-analyze rule run.testing-strategy — coverage mirroring and what a green analyzer cannot prove.dependency-hygiene — the version-pinned lint include as a dependency concern.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
40 skills in this plugin
/accessibility-as-codeEnforces accessibility as a correctness property authored into each widget — Semantics(button/label) or ExcludeSemantics on every node, a11y state read from MediaQuery not app state, never MediaQuery.withClampedTextScaling / textScaleFactor / FittedBox / TextOverflow.ellipsis to fit a label, non-color redundant channels (icon+label+shape+text) for every state, contrast against composited backgrounds (4.5:1 body / 3:1 large), 44px single-tap targets, OrdinalSortKey traversal, and honoring boldText / reduce-motion. Use when adding a GestureDetector/InkWell or any tap target, adding an Icon or Image, reaching for withClampedTextScaling/FittedBox/ellipsis/textScaleFactor to make text fit, encoding state via color, sizing type, ordering focus traversal, or reviewing any View for screen-reader/switch/low-vision support./adaptive-layoutEnforces adapting layout by available CONSTRAINTS/size, never device or platform checks — LayoutBuilder + MediaQuery.sizeOf/paddingOf/viewInsetsOf (not .of) for narrow rebuilds, Material 3 window size classes (compact <600, medium 600-840, expanded 840-1200, large >1200) as the breakpoint vocabulary, navigation affordance chosen by width (NavigationBar → NavigationRail → NavigationDrawer), list-detail single-pane-vs-two-pane, readable max-width via ConstrainedBox, Flexible/Expanded/FractionallySizedBox over fixed widths, SafeArea + display cutouts + keyboard insets, never lock orientation, foldable/hinge awareness via MediaQuery.displayFeatures, and golden-matrix verification across sizes. Use when building responsive or adaptive UI, tablet/desktop/foldable support, master-detail or two-pane screens, a NavigationRail-vs-BottomNav shell, breakpoints, LayoutBuilder, MediaQuery sizing, SafeArea/cutouts, or fixing overflow at large widths./ads-and-iap-monetizationEnforces opt-in, rewarded-first monetization over the service seam — a rewarded view grants exactly one benefit and only on a genuine reward outcome (a sealed Rewarded/Dismissed/NoFill), earn loops capped per day against an injected Clock, the earn control preloaded and hidden unless an ad is loaded so a fresh account never dead-ends on "no ads available" (a Guideline 2.1 risk), interstitials only at a natural break under a count-and-elapsed cap owned by the service so callers stay dumb, no banner on the primary work surface, one non-consumable unlock plus Restore re-checked each launch and committed through the single write path before the UI reacts, one derived isEntitled provider as the only gate, and the entitlement restored BEFORE the ad SDK initializes so a paying user never starts it, resolves consent, or sees a tracking prompt. Use when adding ads, wiring a rewarded earn loop, placing an interstitial, building a paywall, gating an entitlement, or setting up ad units./app-startup-and-bootstrapEnforces a fixed main() cold-launch order — crash-log sink + FlutterError.onError + PlatformDispatcher.onError installed BEFORE any code that can throw, settings/theme read before runApp so the first frame paints correct, real infra constructed in a composition-root bootstrap() and injected via ProviderScope overrideWithValue over throwing placeholder providers, non-blocking warm-up deferred to addPostFrameCallback, exactly two error handlers with NO runZonedGuarded, ProviderException unwrapped before logging, and a WidgetsBindingObserver that flushes durable state on background/resume. Use when editing lib/main.dart, main_<flavor>.dart, bootstrap.dart or app.dart, reordering anything in main(), adding a splash/onboarding/permission gate, restoring theme before first paint, wiring a DB or service into ProviderScope, handling app-lifecycle background/resume flushes, or chasing cold-start latency, ANRs, or first-frame jank./async-safetyEnforces no-silent-failure async discipline in Flutter/Dart — the arrow-callback Future-drop hole no lint catches (`onTap: () => vm.save(x)`), void-returning event handlers, a mounted/ref.mounted guard after EVERY await before touching BuildContext, capturing Navigator/ScaffoldMessenger before the gap, honest `unawaited()` that always ends in catchError, no empty/bare catches, `rethrow` over `throw e`, and disposing every StreamSubscription/StreamController/Timer/sink. Use when writing or reviewing async/await, wiring onTap/onPressed/onSubmitted or any VoidCallback, touching BuildContext after an await, writing initState/dispose/addPostFrameCallback, adding a Timer or Future.delayed, writing a try/catch, or seeing use_build_context_synchronously, cancel_subscriptions, close_sinks, unawaited_futures, or discarded_futures./ci-pipeline-and-gatesEnforces a lean GitHub Actions Flutter CI where every gate maps to one named release-blocking contract — pinned runner + subosito/flutter-action@v2 toolchain, dart format --set-exit-if-changed, flutter analyze --fatal-infos, build_runner and drift schema freshness (git diff --exit-code), flutter test --test-randomize-ordering-seed random, static import/banned-string greps that catch what runtime can't, coverage-as-report-never-a-gate with the upward-lie fixed, verify-never-bless goldens (no --update-goldens in CI), and an honest statement of what CI cannot prove (audio, real fonts, on-device behaviour). Use when editing .github/workflows/*.yml, adding or removing a job or step, wiring a codegen/schema/format/analyze/coverage gate, writing a grep-based policy test or gate script under test/policy or tool/, pinning action versions, or claiming CI proves something it can't.npx claudepluginhub zakariaf/flutter-skills --plugin flutterOther plugins' skills for the same job