/flutter:run-codegenfrom Flutter Skills
Runs build_runner codegen (drift, freezed, json_serializable, riverpod) with --delete-conflicting-outputs. Use when regenerating generated files or fixing missing-part-file/conflicting-outputs errors.
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, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A deterministic, low-freedom runbook: regenerate all annotation-driven code in
one pass, then analyze. Run the pinned command exactly as written — do not
modify it, add flags, or hand-edit generated files. Applies whenever a source
file carries a codegen annotation (@freezed, @JsonSerializable,
@riverpod, @DriftDatabase, a drift table) and its *.g.dart /
*.freezed.dart / *.drift.dart part is missing or stale.
flutter analyze. A fresh clone, branch switch, or
freshly edited annotated file has no generated part on disk. Analyzing that
tree produces misleading "missing part file" and undefined-class errors that
describe the missing output, not a real code defect — regenerate, then
analyze.--delete-conflicting-outputs.
Without it, build_runner refuses to overwrite an output it did not write this
run and fails with a wall of "conflicting outputs" text. That is a stale-file
collision, not a bug — do not go hunting for one.git add -f a generated file. Whether generated code is committed
or gitignored is one decision owned by codegen-and-toolchain; whichever the
repo chose, never force-add an artifact past the ignore rules or commit one
the current source would not reproduce.watch is a local-dev convenience, never CI or a pre-commit hook. CI and
the pre-analyze step always use the one-shot build.lib/ can block generation of a table or provider — clear those
before blaming codegen.Run from the package root (single-package app) or the workspace root (multi-package repo):
dart run build_runner build --delete-conflicting-outputs
This is the first step in every CI lane and on every fresh clone, before format and analyze.
flutter pub get (resolve dependencies).dart run build_runner build --delete-conflicting-outputs (regenerate).flutter analyze.Skipping step 2 is the single most common cause of a red analyzer on a clone whose code is actually fine.
For an active edit loop on annotated sources, run the watcher instead of a one-shot build; it rebuilds affected outputs on save:
dart run build_runner watch --delete-conflicting-outputs
Stop the watcher before running the one-shot build — two concurrent
build_runner processes over the same tree race on outputs.
build_runner runs per-package: one invocation regenerates the current package
plus its path-dependency packages, not automatically every sibling in the
workspace. So running the single command at the workspace root covers the
root package and its path dependencies in one pass, but a coordinator-style root
that does not itself depend on every member will not regenerate those siblings.
For full multi-package regeneration, use the repo-level fan-out wrapper (e.g.
melos run gen) that runs the command over every workspace member; prefer it
when the workspace is bootstrapped. To deliberately scope one package during
development, run the same command from that package's directory. Builder scoping
(which files each builder reads) lives in each package's build.yaml, owned by
codegen-and-toolchain.
The analyzer reads files on disk; build_runner writes them. A disagreement almost always means the disk is behind, not that the code is wrong.
| Symptom | Do this |
|---|---|
| Analyzer flags an undefined class/getter that codegen should produce | Rerun the pinned build, then restart the analysis server. Do not "fix" the call site. |
Errors reported inside a *.g.dart / *.freezed.dart / *.drift.dart file | The file is stale or the analyzer excludes are wrong. Regenerate first; never hand-edit generated output. |
| build_runner fails with analyzer errors in hand-written source | Fix the hand-written source — the generator cannot resolve an unanalyzable AST. |
| "Conflicting outputs" wall of text | Re-run with --delete-conflicting-outputs; it clears stale outputs from renamed/deleted sources. |
flutter analyze before codegen on a fresh tree — you chase
phantom missing-part errors that regeneration erases.--delete-conflicting-outputs — the first rename or deletion
fails the whole run on a stale-output collision..g.dart / .freezed.dart / .drift.dart by hand — the next
build reverts it; the fix belongs in the annotated source.git add -f on a gitignored generated file — bypasses the repo's
committed-vs-gitignored decision and ships a possibly-stale artifact.build_runner watch in CI or a pre-commit hook — non-deterministic;
CI must use the one-shot build.dart run build_runner build --delete-conflicting-outputs ran
at the package/workspace root without "conflicting outputs" errors.flutter analyze, which is now green.build_runner watch process is wired into CI or hooks.codegen-and-toolchain for the knowledge behind this runbook:
build.yaml builder scoping, the commit-vs-gitignore-generated-code decision,
SDK pinning, and analyzer/coverage excludes for generated files.run-migration for the drift schema-snapshot and migration ritual that
wraps drift_dev make-migrations around this codegen pass.ci-pipeline-and-gates for the CI freshness gate that reruns this command
and diffs the tree.lint-and-style-config for the analyzer excludes that keep generated
files out of lint scope.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub zakariaf/flutter-skills --plugin flutter40 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.Other plugins' skills for the same job