iamantoniodinuzzo/claude-flutter/flutter-flavors
Claude Code and agent skill by iamantoniodinuzzo/claude-flutter
- community
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_flavorizr with targeted processors, or manual fallback) or an AUDIT+FIX flow against a bundled rule catalog. Use proactively when the user says \"aggiungi flavor a questa app\", \"inizializza flavors\", \"setup dev/stg/prod\", \"flutter_flavorizr\", \"audit flavors\", \"i miei flavor sono rotti\", \"add flavors to this Flutter app\", \"set up flavors\", \"fix my flavor setup\", \"flavor configuration is broken\", or asks to distinguish flavors from dart-defines.
Install
npx vskill@latest install iamantoniodinuzzo/claude-flutter/flutter-flavorsSKILL.md
The same SKILL.md was published earlier as iamantoniodinuzzo/claude-flutter/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:
| Signal | Where | |
|---|---|---|
flavorizr: block | pubspec.yaml | |
productFlavors / flavorDimensions | android/app/build.gradle.kts | |
| Per-flavor source sets | android/app/src/<flavor>/ | |
| Per-flavor xcconfig | ios/Flutter/*.xcconfig | |
| Per-flavor scheme | ios/**/xcshareddata/xcschemes/*.xcscheme | |
| Multiple entry points | lib/main_*.dart | |
| Flavor enum / getter | getFlavor() or enum Flavor anywhere in lib/ | |
| VSCode launch config | .vscode/launch.json | |
| Android Studio run config | .idea/runConfigurations/ | |
| Firebase | firebase_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:
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:
- Flavor names — default
dev,stg,prod. Confirm the list and order. - App name per flavor — e.g.
Flutter Ship Dev,Flutter Ship Stg,Flutter Ship. - `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).
- 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).
- Entry points — single
main.dartwith 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.
- Web — yes/no. If yes, note that
--flavoris Android/iOS/macOS-only; web will use the
--dart-define WEB_FLAVOR=<flavor> workaround. See references/web-flavors.md.
- IDE target — VSCode, Android Studio, or both.
- Firebase — yes/no (auto-suggested
yesif Phase 0 foundfirebase_core). If yes, this
pulls in Phase 7.
- Strategy —
flutter_flavorizrwith 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:
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)
- Add
dev:flutter_flavorizr: ^2.6.0(verify current via context7/pub.dev) to
pubspec.yaml dev_dependencies if missing; flutter pub get.
- Write the
flavorizr:block at the end ofpubspec.yamlfrom the Phase 1 answers (flavor
names, app names, applicationId/bundleId, icon paths if provided).
- iOS prerequisite check: verify Ruby, Gem, and the
xcodeprojgem 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.
- Run processors targeted, never bare — see
references/flavorizr-processors.mdfor 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.)
AndroidManifest.xmlcomes 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.
- Confirm
lib/main.dartstill contains the originalmain()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.
- In
lib/main.dart, renamemain()→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).
- If multiple entry points were chosen in Phase 1, create
lib/main_<flavor>.dartfor each
flavor: ```dart import 'main.dart';
// * Entry point for the <flavor> flavor void main() async { await runMainApp(); } ```
- 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>, whichgetFlavor()(Phase 4) already
reads via the kIsWeb branch.
Print the full per-platform run matrix so the user has every command in one place:
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, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/flutter-flavors/SKILL.md
Popularity
- 7-day trend score
- 5
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
[](https://verified-skill.com/skills/iamantoniodinuzzo/claude-flutter/flutter-flavors)