codegen-and-toolchain
Enforces a deterministic build_runner codegen discipline: run one pinned `dart run build_runner build --delete-conflicting-outputs` pass BEFORE `flutter analyze` (never after), fence every builder with `generate_for:` globs in a per-package `build.yaml`, make one deliberate commit-vs-gitignore decision for `*.g.dart`/`*.freezed.dart`/`*.drift.dart` and back it with the matching CI gate (freshness diff if committed, codegen-first if gitignored), mirror the generated-file globs into the analyzer AND coverage excludes, pin the SDK, and never hand-edit generated output. Use when editing build.yaml, analysis_options.yaml, pubspec.yaml, .gitignore, .gitattributes, or CI workflows; wiring drift_dev/freezed/json_serializable/riverpod_generator/ gen-l10n/mockito codegen; fixing "missing part file", "undefined class _$Foo", or "conflicting outputs" errors; deciding whether to commit generated code; or scoping builders so one edit does not regenerate everything.
Install
With your agent
Install OMGSkills skill "zakariaf/flutter-skills:skills/codegen-and-toolchain" into this agent's normal skills directory: call the OMGSkills MCP get_install_plan tool for your agent and run the script it returns (it installs only the pinned commit and verifies SKILL.md), and stop if MCP or the pin is unavailable. Do not overwrite or change existing skills without asking me.
Manual command
git clone https://github.com/zakariaf/Flutter-Skills /tmp/Flutter-Skills && ln -s /tmp/Flutter-Skills/skills/codegen-and-toolchain ~/.claude/skills/codegen-and-toolchain
From README
Codegen and toolchain One deterministic codegen pass is the source of truth for every generated file; run it first, scope it tightly, and decide once whether its output lives in git. Applies whenever a project uses buildrunner or gen-l10n. Read the reference for the task at hand: references/codegen-scoping.md — the generator inventory, generatefor: scoping tables, error-to-fix recovery map. references/commit-vs-gitignore.md — the two committed/gitignored strategies, their tradeoffs, and the exact CI gate each one requires. references/toolchain-and-workspace.md — SDK pinning, analyzer/coverage excludes, and the multi-package workspace layering (fenced, opt-in). Run scripts/regen.sh (codegen → format → analyze) before a PR, and scripts/check-codegen-hygiene.sh to verify excludes and commit-policy parity. Non-negotiable rules Codegen runs FIRST, before flutter analyze. Generated files may be absent on a fresh clone or stale after editing an annotation.
More from this repo
accessibility-as-code
Enforces accessibility as a correctness property authored into each widget — Semantics(button/label) or...
adaptive-layout
Enforces adapting layout by available CONSTRAINTS/size, never device or platform checks — LayoutBuilder +...
ads-and-iap-monetization
Enforces opt-in, rewarded-first monetization over the service seam — a rewarded view grants exactly one benefit and...
