Realign the genkit_flutter_gemma / genkit_hybrid packages when flutter_gemma's core API changes — discover changes, fix compilation, support new features, update fakes/tests, bump version. Monorepo-aware.
Upgrade Genkit packages to the current flutter_gemma API
The Genkit integration packages (packages/genkit_flutter_gemma, packages/genkit_hybrid)
wrap flutter_gemma's public API. When that API changes, they must be realigned or
they break. In the monorepo they consume flutter_gemma as an in-workspace
path dependency, so a core change can break them in the same commit — run this
whenever a PR changes the public InferenceModel / InferenceChat /
EmbeddingModel / Message / ModelResponse / enum surface.
Follow these 5 phases sequentially. Ask the user before deciding which new
features to support (Phase 3).
Paths below are relative to the repo root. Core package =
packages/flutter_gemma; genkit package = packages/genkit_flutter_gemma
(mirror for genkit_hybrid). REPO_ROOT = monorepo root,
PKG_DIR=packages/genkit_flutter_gemma, EXAMPLE_DIR=$PKG_DIR/example.
Phase 1: Reconnaissance
Identify what changed in the core public API. In the monorepo flutter_gemma
is a path dep (not pub), so don't rely on dart pub outdated — instead read
the diff / CHANGELOG of packages/flutter_gemma:
The release itself goes through the release skill (genkit packages release in lockstep with the monorepo) — do not publish standalone.
1---2name: upgrade-genkit3description: Realign the genkit_flutter_gemma / genkit_hybrid packages when flutter_gemma's core API changes — discover changes, fix compilation, support new features, update fakes/tests, bump version. Monorepo-aware.4---56# Upgrade Genkit packages to the current flutter_gemma API78The Genkit integration packages (`packages/genkit_flutter_gemma`, `packages/genkit_hybrid`)9wrap flutter_gemma's public API. When that API changes, they must be realigned or10they break. In the **monorepo** they consume flutter_gemma as an in-workspace11path dependency, so a core change can break them in the same commit — run this12whenever a PR changes the public `InferenceModel` / `InferenceChat` /13`EmbeddingModel` / `Message` / `ModelResponse` / enum surface.1415Follow these 5 phases sequentially. Ask the user before deciding which new16features to support (Phase 3).1718> Paths below are relative to the repo root. Core package =19> `packages/flutter_gemma`; genkit package = `packages/genkit_flutter_gemma`20> (mirror for `genkit_hybrid`). `REPO_ROOT` = monorepo root,21> `PKG_DIR=packages/genkit_flutter_gemma`, `EXAMPLE_DIR=$PKG_DIR/example`.2223## Phase 1: Reconnaissance24251. Identify what changed in the core public API. In the monorepo flutter_gemma26 is a path dep (not pub), so don't rely on `dart pub outdated` — instead read27 the diff / CHANGELOG of `packages/flutter_gemma`:28 - `git log --oneline -- packages/flutter_gemma/lib/flutter_gemma_interface.dart packages/flutter_gemma/lib/core`29 - `packages/flutter_gemma/CHANGELOG.md` (top entry)302. Summarize for the user:31 - **Breaking changes** (removed/renamed APIs, changed signatures)32 - **New APIs** (new parameters, methods, enums, classes)33 - **Bug fixes** / **Deprecations**343. `melos bootstrap` (or `dart pub get` in `PKG_DIR` + `EXAMPLE_DIR`).3536## Phase 2: Fix Compilation37381. `cd packages/genkit_flutter_gemma && dart analyze` (repeat for `genkit_hybrid`).392. Fix all compilation errors. Files that depend on flutter_gemma's API:40 - [ ] `lib/src/flutter_gemma_runtime.dart` — `FlutterGemma.getActiveModel()`, `getActiveEmbedder()` signatures41 - [ ] `lib/src/flutter_gemma_model.dart` — `InferenceModel.createChat()` signature, `ModelResponse` pattern matching, `InferenceChat` methods42 - [ ] `lib/src/flutter_gemma_embedder.dart` — `EmbeddingModel.generateEmbeddings()`, `PreferredBackend` enum43 - [ ] `lib/src/converters/request_converter.dart` — `Message` constructors (`.withImage`, `.withAudio`, `.toolCall`, `.toolResponse`)44 - [ ] `lib/src/converters/response_converter.dart` — `ModelResponse` subtypes (`TextResponse`, `FunctionCallResponse`, `ParallelFunctionCallResponse`, `ThinkingResponse`)45 - [ ] `lib/src/converters/tool_converter.dart` — `Tool` constructor46 - [ ] `lib/src/flutter_gemma_plugin.dart` — `ModelType`, `ModelFileType` enums47 - [ ] `test/src/fake_runtime.dart` — `FakeInferenceModel`, `FakeInferenceChat`, `FakeEmbeddingModel` **must** match upstream abstract-class signatures (see genkit `CLAUDE.md`)483. Repeat `dart analyze` until clean (0 issues).4950## Phase 3: Support New Features5152Based on Phase 1, decide with the user which new APIs to support. Typical integration points:5354### New parameter in `createChat()` / `createSession()`551. Add field to `$FlutterGemmaModelOptions` in `lib/src/flutter_gemma_options.dart`562. **Manually** update `lib/src/flutter_gemma_options.g.dart` (constructor param, field with `@override`, `fromJson`, `toJson`, `jsonSchema()` entry)573. Extract from config + pass in `lib/src/flutter_gemma_model.dart` (`_executeGeneration`)584. Update `FakeInferenceModel.createChat()` in `test/src/fake_runtime.dart` (add param, store in `last*` field for assertions)5960### New enum value (e.g. `ModelFileType`)61- Update comments in `lib/src/flutter_gemma_plugin.dart` (`FlutterGemmaModelConfig.fileType`)6263### New method on `InferenceChat` / `InferenceModel`64- Add override in `FakeInferenceChat` / `FakeInferenceModel` in `test/src/fake_runtime.dart`6566### Changed model capabilities67- Update `supports` map in `lib/src/flutter_gemma_plugin.dart` (`list()` method)6869### Changed message handling70- Update converters in `lib/src/converters/`; update `extractSystemInstruction()` if system-message handling changed7172**IMPORTANT:** `*.g.dart` here is **manually maintained** (build_runner not used by default). Always hand-update it when changing the schema.7374## Phase 4: Tests and Review75761. Update existing tests that verify changed behavior.772. Add tests for each new feature from Phase 3.783. `flutter test` (in `PKG_DIR`) — all must pass.794. Run `/review-pr` for comprehensive review; fix what it surfaces.8081## Phase 5: Finalize82831. **Bump version** in `PKG_DIR/pubspec.yaml` (minor for breaking behavior, patch for fixes/non-breaking additions).842. **Update `PKG_DIR/CHANGELOG.md`** (new section at top: breaking `**Breaking**:` / new features / fixes).853. **Update `PKG_DIR/README.md`** (options table, known limitations, quick-start if usage changed).864. Verify: `dart analyze && flutter test && dart pub publish --dry-run` (all clean).875. The release itself goes through the **`release` skill** (genkit packages release in lockstep with the monorepo) — do not publish standalone.
Run npx skillmds@latest add denisovav/upgrade-genkit in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Realign the genkit_flutter_gemma / genkit_hybrid packages when flutter_gemma's core API changes — discover changes, fix compilation, support new features, update fakes/tests, bump version. Monorepo-aware. It is listed under Integrations & APIs on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
denisovav (@denisovav) published this skill. Their other Agent Skills are listed on their SkillMD profile.