iamantoniodinuzzo/flutter-toolkit/flutter-flavors

Claude Code and agent skill by iamantoniodinuzzo/flutter-toolkit

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Initialize flavors (dev/stg/prod) in a Flutter project, or audit and fix an existing partial/broken flavor setup — Android (build.gradle.kts, AndroidManifest), iOS (xcconfig, xcscheme, Info.plist), Web (--dart-define WEB_FLAVOR workaround), multiple entry points (main_*.dart), IDE config (VSCode launch.json, Android Studio .idea/runConfigurations), and optional multi-project Firebase (flutterfire configure per flavor). Detects project state first and branches into an INIT flow (flutter_flavoriz…

Install

npx vskill@latest install iamantoniodinuzzo/flutter-toolkit/flutter-flavors

SKILL.md

The same SKILL.md was published earlier as iamantoniodinuzzo/flutter-toolkit/flutter-flavors.

Flutter Flavors

Runtime and resources

Use the current agent's native file, search, shell, and question tools; plain-text questions and direct sequential scans are valid fallbacks. Subagents are optional and require host permission. Bundled paths below are relative to this installed skill directory; application paths are relative to the target Flutter project. Resolve sibling skills through the installed skill registry (or sibling directories), never by assuming a skills/ folder in the application. If a required dependency is absent, name it and report the affected step as unavailable; never invent its rules or claim complete coverage.

Adds dev/stg/prod (or custom) flavors to a Flutter project, or audits and repairs an existing flavor setup that is partial or broken. Never runs dart run flutter_flavorizr bare — the bare command overwrites lib/main.dart and silently destroys all app-initialization logic. Every native change goes through targeted processors or hand-written patches, never a full regenerate. Every flavorizr invocation also always carries -f/--force — without it the tool's confirm prompt crashes outright in a non-interactive shell (see references/flavorizr-processors.md); piping input does not help, only -f does.

Rule and reference sources

Rules for the AUDIT branch are bundled in rules/CATALOG.md. Deep how-to context for the INIT branch is bundled in references. This skill does not delegate to ai_toolkit/ — it is self-contained.

Version baselines cited below (flutter_flavorizr: 2.6.0, flutterfire_cli: 1.4.1) are the latest verified on pub.dev at the time this skill was written — verify current versions via context7 or pub.dev before pinning a version in the target project's pubspec.yaml.


Phase 0 — Detect & classify

Goal: know the project's actual flavor state before asking a single question or touching a file.

Read pubspec.yaml and grep the project for, recording found/missing for each:

SignalWhere
flavorizr: blockpubspec.yaml
productFlavors / flavorDimensionsandroid/app/build.gradle.kts
Per-flavor source setsandroid/app/src/<flavor>/
Per-flavor xcconfigios/Flutter/*.xcconfig
Per-flavor schemeios/**/xcshareddata/xcschemes/*.xcscheme
Multiple entry pointslib/main_*.dart
Flavor enum / gettergetFlavor() or enum Flavor anywhere in lib/
VSCode launch config.vscode/launch.json
Android Studio run config.idea/runConfigurations/
Firebasefirebase_core in pubspec.yaml

Monorepo hard gate: if melos.yaml exists at the root, or the root pubspec.yaml has a workspace: key, stop immediately:

✗ This project is a Melos/pub workspace monorepo.
flutter-flavors targets a single Flutter app root and does not yet resolve which
package to flavor. Point it directly at the app package root instead
(e.g. apps/<name>/), or treat this as a separate effort.

Classify the project:

  • NONE — no signal found at all → INIT branch (Phase 1 onward).
  • PARTIAL or COMPLETE — at least one signal found → AUDIT branch (jump to

AUDIT branch below).

Print the detection matrix before proceeding either way — the user should see what was found, not just the resulting branch choice.


Phase 1 — Intake (INIT branch only)

Goal: settle every decision that isn't safely inferable, before writing anything. This is the core of the skill — a wrong answer here (especially on applicationId/bundleId) is expensive to undo once builds have shipped.

Ask, with explicit defaults, using the agent's question tool, or a plain-text question where the options are enumerable:

  1. Flavor names — default dev, stg, prod. Confirm the list and order.
  2. App name per flavor — e.g. Flutter Ship Dev, Flutter Ship Stg, Flutter Ship.
  3. `applicationId` (Android, snake_case, from android/app/build.gradle.kts →

defaultConfig.applicationId) and `bundleId` (iOS, camelCase, from Xcode → Runner → General → Identity, or infer camelCase from the existing applicationId if the user has no Mac) per flavor. Hard rule, state it explicitly and get an explicit yes: if this app is already published, its production applicationId/bundleId must stay byte-for-byte unchanged — app stores use it as the app's permanent identity. Only dev/stg get a suffix (.dev, .stg).

  1. Per-flavor icons — yes/no. If yes, ask where the flavor-specific icon assets already live

(or note they must be added before Phase 3 runs the icon processor).

  1. Entry points — single main.dart with runtime flavor detection, or multiple

main_<flavor>.dart files. State the rule: multiple entry points are required if Firebase is in scope (different firebase_options_<flavor>.dart per flavor cannot be selected at runtime from a single entry point). See references/dart-layer.md.

  1. Web — yes/no. If yes, note that --flavor is Android/iOS/macOS-only; web will use the

--dart-define WEB_FLAVOR=<flavor> workaround. See references/web-flavors.md.

  1. IDE target — VSCode, Android Studio, or both.
  2. Firebase — yes/no (auto-suggested yes if Phase 0 found firebase_core). If yes, this

pulls in Phase 7.

  1. Strategy — flutter_flavorizr with targeted processors (default, faster, handles iOS

pbxproj mechanically) vs fully manual (no external tool, smaller diffs, required if Ruby/Gem/ Xcodeproj aren't available for iOS — see Phase 3 prerequisite check).

Print the full decision table and ask for one final confirmation before Phase 2. Do not proceed on an assumed "yes."


Phase 2 — Safety gate

Goal: guarantee a clean rollback point exists before any operation that can touch 100+ files.

Run git status --porcelain in the target project. If it is not empty, stop:

✗ Working tree is not clean.
flutter_flavorizr (and the manual native patches) touch many files at once.
Without a clean commit, a bad run cannot be safely rolled back with:
git reset --hard HEAD && git clean -fd
Commit or stash your changes, then re-run this skill.

If clean, print the rollback command anyway so the user has it on hand, then proceed.


Phase 3 — Native setup (Android + iOS)

Two branches per the Phase 1 strategy answer. Read the relevant reference file(s) in full before writing anything: references/flavorizr-processors.md for branch A, references/manual-android.md and references/manual-ios.md for branch B.

Branch A — flutter_flavorizr (default)
  1. Add dev:flutter_flavorizr: ^2.6.0 (verify current via context7/pub.dev) to

pubspec.yaml dev_dependencies if missing; flutter pub get.

  1. Write the flavorizr: block at the end of pubspec.yaml from the Phase 1 answers (flavor

names, app names, applicationId/bundleId, icon paths if provided).

  1. iOS prerequisite check: verify Ruby, Gem, and the xcodeproj gem are available. If any is

missing, skip iOS processors below, emit the manual iOS checklist from references/manual-ios.md, and continue with Android only.

  1. Run processors targeted, never bare — see references/flavorizr-processors.md for the

full rationale and the trap (bare run overwrites lib/main.dart): ``bash dart run flutter_flavorizr -f -p android:buildGradle,android:flavorizrGradle,android:androidManifest,android:icons dart run flutter_flavorizr -f -p assets:download,assets:extract,ios:podfile,ios:xcconfig,ios:buildTargets,ios:schema,ios:plist,ios:dummyAssets,ios:icons,assets:clean `` (Skip the second command entirely if the iOS prerequisite check failed.)

  1. AndroidManifest.xml comes out with attributes inlined on one line — reformat it (XML Tools

extension + SHIFT+OPTION+F in VSCode, or an equivalent formatter) so the diff is reviewable.

  1. Confirm lib/main.dart still contains the original main() body untouched — the targeted

processor list above does not include flutter:main, so it should be. State this check explicitly in the phase output; if main.dart was touched, stop and surface it before Phase 4.

Branch B — Manual

Follow references/manual-android.md and references/manual-ios.md step by step:

  • Android: flavorDimensions + productFlavors (each with a per-flavor `resValue(type =

"string", name = "app_name", value = "...")) in android/app/flavors.gradle.kts, included from android/app/build.gradle.kts; android:label="@string/app_name" in AndroidManifest.xml (one attribute, resolves the per-flavor resource); per-flavor source sets under android/app/src/<flavor>/`.

  • iOS: 9 duplicated build configurations and 3 shared schemes created in Xcode (cannot be scripted

— present as a checklist), per-flavor bundle id suffixes, and Info.plist using $(APP_DISPLAY_NAME) (the manual-path variable name — differs from the flavorizr path's BUNDLE_NAME/BUNDLE_DISPLAY_NAME; never mix the two conventions in one project).


Phase 4 — Dart layer

Read references/dart-layer.md first.

  1. In lib/main.dart, rename main() → Future<void> runMainApp(), preserving every line of

existing initialization logic (this is the step most likely to be done carelessly — verify nothing was dropped, not just renamed).

  1. If multiple entry points were chosen in Phase 1, create lib/main_<flavor>.dart for each

flavor: ```dart import 'main.dart';

// * Entry point for the <flavor> flavor void main() async { await runMainApp(); } ```

  1. Create lib/env/flavor.dart (or the project's existing env/config directory) with:

```dart import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart';

enum Flavor { dev, stg, prod }

/// Global function to return the current flavor Flavor getFlavor() { const webFlavor = String.fromEnvironment('WEB_FLAVOR'); const flavor = kIsWeb ? webFlavor : appFlavor; return switch (flavor) { 'prod' => Flavor.prod, 'stg' => Flavor.stg, 'dev' => Flavor.dev, null || '' => Flavor.dev, _ => throw UnsupportedError('Invalid flavor: $flavor'), }; } ``` Adjust the enum values and switch arms to the flavor names chosen in Phase 1.

Mandatory warning to print once entry points exist: from this point on, -t lib/main_<flavor>.dart is required on every flutter run/flutter build. Omitting it defaults to lib/main.dart, which no longer has a main() function, and the app hangs on the splash screen with Could not prepare isolate in the console. Print this warning verbatim so the user recognizes the failure mode if it happens later.


Phase 5 — Web

Only if Phase 1 chose web. Read references/web-flavors.md.

Document, do not silently assume:

  • flutter run --flavor <f> on web only warns (`--flavor is only supported for Android, macOS,

and iOS devices`) and still runs.

  • flutter build web --flavor <f> fails outright (Could not find an option named "flavor").
  • The workaround is always --dart-define WEB_FLAVOR=<f>, which getFlavor() (Phase 4) already

reads via the kIsWeb branch.

Print the full per-platform run matrix so the user has every command in one place:

flutter run --flavor dev -t lib/main_dev.dart # Android/iOS
flutter run -d chrome --dart-define WEB_FLAVOR=dev -t lib/main_dev.dart # Web
flutter run --flavor dev --dart-define WEB_FLAVOR=dev -t lib/main_dev.dart # combined

Phase 6 — IDE config

Read references/ide-config.md.

VSCode

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/iamantoniodinuzzo/flutter-toolkit/flutter-flavors/badge)](https://verified-skill.com/skills/iamantoniodinuzzo/flutter-toolkit/flutter-flavors)

Something wrong with this skill or its page? Tell us.