flavors
Skill2 starsChanged 9 months agoMITView on GitHub
Configure environment flavors (dev, staging, prod) for Flutter apps. Sets up compile-time variables via --dart-define-from-file, Gradle productFlavors, Xcode schemes, and per-environment configuration. Use when adding multi-environment support or separating dev/staging/prod builds.
- Reads credentials
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 1 is distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
If your project uses /init's approach (await dotenv.load()), running /flavors will:
- Very specific: line 32
Create FlavorConfig class using String.fromEnvironment()
- Very specific: line 46
Keep feature flags in DebugConstants, flavor config in FlavorConfig.
- Very specific: line 80
Create .env.{flavor} files.
- Very specific: line 84
Update android/app/build.gradle.
- Distinctive: line 88
Create xcconfig files and Xcode schemes.
- Very specific: line 96
Remove flutter_dotenv, use FlavorConfig.
- Very specific: line 100
Add .env.dev, .env.staging, .env.prod.
- Very specific: line 163
Ensure flavor names match exactly in build.gradle, iOS schemes, and .env.{flavor} files.
- Very specific: line 171
Ensure you're passing --dart-define-from-file=.env.{flavor} flag.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flavors - Environment Configuration
Configure dev, staging, and production environments with separate configurations, bundle IDs, and app names.
When to Use This Skill
- Setting up multiple environments (dev, staging, prod)
- Separating API endpoints per environment
- Using different bundle IDs for each environment
- Configuring environment-specific Firebase/Supabase projects
- User asks "add flavors", "setup environments", "separate dev/prod"
When NOT to Use This Skill
- Single environment projects - Use
/initwith single.env - CI/CD setup - Use
/ci-cdafter flavors are configured - Basic Firebase setup - Use
/analyticsfirst, then add per-flavor config
Important: Migration from flutter_dotenv
This skill REPLACES flutter_dotenv runtime loading with compile-time variables.
If your project uses /init's approach (await dotenv.load()), running /flavors will:
- Remove
flutter_dotenvdependency - Replace
.envruntime loading with--dart-define-from-filebuild flags - Create
FlavorConfigclass usingString.fromEnvironment()
Why compile-time? Secrets are not bundled in the app binary - they're injected at build time.
Integration with /core
FlavorConfig handles:
- Flavor identification (
isDev,isProd,isStaging) - Per-flavor API URLs and service credentials
DebugConstants (from /core) handles:
- Debug/mock flags (
useMockAuth,useMockApi) - Logging and UI debug options
Keep feature flags in DebugConstants, flavor config in FlavorConfig.
Questions to Ask
- Flavor count: How many environments? (dev + prod, dev + staging + prod)
- Bundle ID pattern: How should bundle IDs differ? (suffix: .dev)
- App name pattern: How should app names differ? (suffix: " (Dev)")
- Firebase: Separate Firebase projects per flavor? (yes/no)
- Supabase: Separate Supabase projects per flavor? (yes/no)
Quick Reference
| Flavor | Bundle ID Suffix | App Name Suffix | Purpose |
| dev | .dev | (Dev) | Local development |
| staging | .staging | (Staging) | QA/testing |
| prod | (none) | (none) | Production release |
Key Commands
flutter run --flavor dev --dart-define-from-file=.env.dev
flutter run --flavor prod --dart-define-from-file=.env.prod
dart run .claude/skills/flavors/scripts/check.dartWorkflow
Phase 1: Gather Requirements
Confirm: flavor count, base bundle ID, base app name, Firebase/Supabase per flavor.
Phase 2: Create Environment Files
Create .env.{flavor} files. See templates/env-files/.
Phase 3: Configure Android
Update android/app/build.gradle. See android-guide.md.
Phase 4: Configure iOS
Create xcconfig files and Xcode schemes. See ios-guide.md.
Phase 5: Create FlavorConfig
Generate lib/core/config/flavor_config.dart from reference/flavor_config.dart.
Phase 6: Migrate main.dart
Remove flutter_dotenv, use FlavorConfig. See reference/main_flavored.dart.
Phase 7: Update .gitignore
Add .env.dev, .env.staging, .env.prod.
Phase 8: Verify Setup
dart run .claude/skills/flavors/scripts/check.dart
flutter build apk --flavor dev --dart-define-from-file=.env.devGuides
| Guide | Content |
| android-guide.md | Gradle productFlavors, signing configs |
| ios-guide.md | Xcode schemes, xcconfig files |
| firebase-guide.md | Per-flavor Firebase setup (see /analytics for basic setup) |
| checklist.md | Verification checklist |
Templates
| Template | Purpose |
templates/env-files/ | .env.dev, .env.staging, .env.prod |
templates/android/ | build.gradle flavor config |
templates/ios/ | xcconfig files |
templates/vscode/ | launch.json configurations |
Checklist
Environment Files:
.env.devand.env.prodexist- All
.env.*files in.gitignore flutter_dotenvremoved from pubspec.yaml (if migrating)
Android:
build.gradlehasflavorDimensionsandproductFlavors- Each flavor has
applicationIdSuffixandresValueapp name
iOS:
Dev.xcconfigandProd.xcconfigexist- Xcode schemes created for each flavor
Dart:
lib/core/config/flavor_config.dartexistsmain.dartdoes NOT usedotenv.load()main.dartusesFlavorConfig
Build:
flutter build apk --flavor devsucceedsflutter build apk --flavor prodsucceeds
Related Skills
/init- Creates project with single.env(flavors replaces this approach)/core- DebugConstants for mock/debug flags (complementary to FlavorConfig)/ci-cd- Add flavor-aware CI/CD pipelines after this skill/analytics- Basic Firebase setup; use before per-flavor config/release- Prepare production flavor for app stores
Common Issues
"Flavor not found" Error
Ensure flavor names match exactly in build.gradle, iOS schemes, and .env.{flavor} files.
Environment Variables Empty
Using dotenv.env['KEY']? Switch to String.fromEnvironment('KEY').
Build works but wrong config
Ensure you're passing --dart-define-from-file=.env.{flavor} flag.
Next Steps
/ci-cd- Update GitHub Actions for multi-flavor builds/analytics- Configure per-flavor Firebase Analytics/release- Prepare production signing
In this repository27 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- a11ySkill
- account-deletionSkill
- analyticsSkill
- authSkill
- ci-cdSkill
- coreSkill
- dataSkill
- deep-linkingSkill
- designSkill
- domainSkill
- feature-initSkill
- force-updateSkill
- i18nSkill
- in-app-purchasesSkill
- initSkill
- local-authSkill
- network-connectivitySkill
- offlineSkill
- phone-authSkill
- planSkill
- presentationSkill
- push-notificationsSkill
- releaseSkill
- skill-createSkill
- social-loginSkill
- testingSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

