← ClaudeAtlas

codegen-and-toolchainlisted

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.
zakariaf/CatchLaw · ★ 0 · AI & Automation · score 55
Install: claude install-skill zakariaf/CatchLaw
# 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 `build_runner` or `gen-l10n`. Read the reference for the task at hand: - `references/codegen-scoping.md` — the generator inventory, `generate_for:` 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 1. **Codegen runs FIRST, before `flutter analyze`.** Generated files may be absent on a fresh clone or stale after editing an annotation. Analyzing that tree emits misleading "missing part file" and "undefined class `_$Foo`" errors. Regenerate, then analyze — never chase the symptom at the call site. 2. **Always pass `--delete-conflicting-outputs`.** Without it `build_runner` refuses to overwrite an output from a renamed/deleted source and fails with a wall of "conflicting outputs" text. That is not a bug to investigate. 3. **Never hand-edit a generated file.** The next build silently reverts it and