Run Codegen logo

Run Codegen

Community
zakariaf
run-codegen

Runs the deterministic build_runner codegen pass (drift_dev, freezed, json_serializable, riverpod_generator) as one pinned command with --delete-conflicting-outputs, always before flutter analyze, never hand-editing or force-committing generated *.g.dart / *.freezed.dart / *.drift.dart output, watch only in local dev. Use when regenerating codegen, fixing "missing part file" / "conflicting outputs" / undefined generated-class analyzer errors, after editing a drift table or DAO, a freezed value object, a riverpod Notifier or provider, or a json_serializable model, or after a fresh git clone, branch switch, or pull.

Overview

Publisherzakariaf
RepositoryFlutter-Skills
Skill namerun-codegen
Stars
64
Forks
15
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by zakariaf on GitHub. Read the source before you install it.

Installation

Install the Run Codegen AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/zakariaf/Flutter-Skills/tree/main/skills/run-codegen
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zakariaf/Flutter-Skills.git /tmp/Flutter-Skills
mkdir -p .claude/skills
cp -r /tmp/Flutter-Skills/skills/run-codegen .claude/skills/run-codegen
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Run Codegen in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Run Codegen on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Run Codegen is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Run codegen (build_runner)

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.

Non-negotiable rules

  1. Run codegen BEFORE 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.
  2. Use the pinned command verbatim, always with --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.
  3. Never hand-edit a generated file. The next build silently reverts it and takes your edit with it. Change the annotated source — the drift table, the freezed class, the Notifier, the ARB — and rerun.
  4. Never 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.
  5. 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.
  6. Fix hand-written source first. The generator reads a resolved AST; it cannot generate from source that does not analyze. An unrelated error anywhere in lib/ can block generation of a table or provider — clear those before blaming codegen.

The canonical command

Run from the package root (single-package app) or the workspace root (multi-package repo):

bash
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.

Standard sequence on a fresh clone, pull, or branch switch

  1. flutter pub get (resolve dependencies).
  2. dart run build_runner build --delete-conflicting-outputs (regenerate).
  3. Only then flutter analyze.

Skipping step 2 is the single most common cause of a red analyzer on a clone whose code is actually fine.

Dev iteration (optional watch)

For an active edit loop on annotated sources, run the watcher instead of a one-shot build; it rebuilds affected outputs on save:

bash
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.

When multi-package (workspace)

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.

When codegen and the analyzer disagree

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.

SymptomDo this
Analyzer flags an undefined class/getter that codegen should produceRerun the pinned build, then restart the analysis server. Do not "fix" the call site.
Errors reported inside a *.g.dart / *.freezed.dart / *.drift.dart fileThe 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 sourceFix the hand-written source — the generator cannot resolve an unanalyzable AST.
"Conflicting outputs" wall of textRe-run with --delete-conflicting-outputs; it clears stale outputs from renamed/deleted sources.

Anti-patterns

  • Running flutter analyze before codegen on a fresh tree — you chase phantom missing-part errors that regeneration erases.
  • Dropping --delete-conflicting-outputs — the first rename or deletion fails the whole run on a stale-output collision.
  • Editing a .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.

Definition of done

  • The pinned dart run build_runner build --delete-conflicting-outputs ran at the package/workspace root without "conflicting outputs" errors.
  • It ran before flutter analyze, which is now green.
  • No generated file was hand-edited or force-added.
  • No build_runner watch process is wired into CI or hooks.

Related skills

  • See 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.
  • See run-migration for the drift schema-snapshot and migration ritual that wraps drift_dev make-migrations around this codegen pass.
  • See ci-pipeline-and-gates for the CI freshness gate that reruns this command and diffs the tree.
  • See lint-and-style-config for the analyzer excludes that keep generated files out of lint scope.

References

Frequently asked questions

What does the Run Codegen AI skill do?

Runs the deterministic build_runner codegen pass (drift_dev, freezed, json_serializable, riverpod_generator) as one pinned command with --delete-conflicting-outputs, always before flutter analyze, never hand-editing or force-committing generated *.g.dart / *.freezed.dart / *.drift.dart output, watch only in local dev. Use when regenerating codegen, fixing "missing part file" / "conflicting outputs" / undefined generated-class analyzer errors, after editing a drift table or DAO, a freezed value object, a riverpod Notifier or provider, or a json_serializable model, or after a fresh git clone,...

Why use Run Codegen on TypingMind?

Because you install it once and use it with any model. Run Codegen is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Run Codegen in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/zakariaf/Flutter-Skills/tree/main/skills/run-codegen. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Run Codegen?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Run Codegen?

As many as you like. As long as a model supports skills, you can use Run Codegen with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Run Codegen AI skill free?

Yes. It is published on GitHub by zakariaf under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇