agentleFS
ariaraminariaramin/flutter-skills/skills/flutter-firebase-core-engineering/SKILL.md

flutter-firebase-core-engineering

Skill8 starsChanged 48 days agoMITView on GitHub

Design, implement, review, debug, secure, test, migrate, and optimize Firebase Core foundations in Flutter applications. Use when a task involves firebase_core, Firebase.initializeApp, FirebaseApp/FirebaseOptions, Firebase.app or Firebase.apps, the default or secondary Firebase app, flutterfire configure/reconfigure, generated firebase_options.dart, google-services.json, GoogleService-Info.plist, Web Firebase options, dev/staging/production projects, flavors/build configurations, wrong-project or core/no-app/core/not-initialized/core/duplicate-app failures, Firebase startup ownership/performance, background entry-point initialization, emulator bootstrap, or migration of old FlutterFire setup. Do not use for product-specific Auth, Firestore, Messaging, Analytics, Crashlytics, Storage, Functions, Remote Config, or Performance behavior beyond their dependency on Core.

The file

Show its rules and text

We split this skill into the rules it gives an agent

30 rules. About 0 are common, 22 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈22

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Treat Firebase Core as app-instance and configuration infrastructure.

    line 8
  2. Distinctive:

    Before changing code or configuration:

    line 13
  3. Distinctive:

    Verify the platform matrix of every downstream plugin.

    line 26
  4. Very specific:

    Use one [DEFAULT] app for the normal application case.

    line 36
  5. Very specific:

    Call WidgetsFlutterBinding.ensureInitialized() when plugin access precedes runApp, and keep binding initialization and runApp in the same …

    line 39
  6. Distinctive:

    Do not eagerly initialize every Firebase product merely because Core exists.

    line 44
  7. Very specific:

    Prefer flutterfire configure and generated platform-aware firebase_options.dart.

    line 45
  8. Distinctive:

    Treat Firebase client options and API keys as client configuration, not Admin authorization.

    line 47
  9. Distinctive:

    Never ship service-account JSON, Admin SDK credentials, private keys, signing secrets, database credentials, or privileged server tokens in …

    line 50
  10. Distinctive:

    Prefer separate Firebase projects for isolated environments.

    line 54
  11. Very specific:

    Do not use kDebugMode as the complete environment-selection model.

    line 55
  12. Distinctive:

    Do not dynamically delete/recreate or switch the default app for ordinary user tenancy or logout.

    line 56
  13. Distinctive:

    Create secondary apps only for genuine simultaneous multi-project needs, then verify every downstream plugin supports the named app.

    line 58
  14. Very specific:

    Do not use Firebase.apps.isEmpty as a scattered lifecycle guard.

    line 60
  15. Very specific:

    Treat core/duplicate-app and configuration mismatch as deterministic defects, not transient failures to retry blindly.

    line 61
  16. Distinctive:

    Do not use production Firebase projects for automated tests.

    line 65
  17. Distinctive:

    Do not assume Core configures each product's emulator automatically.

    line 66
  18. Distinctive:

    Do not claim Linux support when no platform implementation is registered.

    line 67
  19. Distinctive:

    Treat Windows Firebase support as development-oriented unless current official guidance explicitly establishes production support.

    line 68
  20. Distinctive:

    Use this decision order:

    line 75
  21. Very specific:

    If root state requires Firebase, await Core before runApp and fail with a bounded, actionable startup state.

    line 79
  22. Distinctive:

    If the first screen is Firebase-independent, render it first and initialize optional Firebase-dependent features behind an explicit …

    line 81
  23. Distinctive:

    Add a named secondary app only when two projects must be active simultaneously and all consumers support it.

    line 85
  24. Distinctive:

    Do not introduce a bootstrap abstraction unless it centralizes real environment, readiness, error, testing, or multi-app policy.

    line 88
  25. Very specific:

    Read only the relevant sections of references/production-guide.md.

    line 93
  26. Distinctive:

    Use these search headings:

    line 100
  27. Distinctive:

    Keep product-specific emulator, permissions, listeners, and remote fetching in the owning product layer.

    line 126
  28. Distinctive:

    Keep Firebase Core readiness explicit where startup can proceed without it.

    line 130
  29. Distinctive:

    Run the narrowest relevant Dart/Flutter and configuration checks, then test release-like builds.

    line 134
  30. Distinctive:

    Never claim Firebase production readiness from Core initialization alone.

    line 148

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Flutter Firebase Core Engineering

Treat Firebase Core as app-instance and configuration infrastructure. Keep its lifecycle distinct from every downstream FlutterFire product.

Start with evidence

Before changing code or configuration:

  1. Inspect pubspec.yaml, pubspec.lock, Flutter/Dart constraints, target platforms, flavors/build configurations, and downstream FlutterFire plugins.
  2. Identify the locked firebase_core and platform implementation versions, plus the installed flutterfire CLI version.
  3. Find every Firebase.initializeApp, Firebase.app, Firebase.apps, secondary-app creation/deletion, and background entry point.
  4. Inspect firebase_options.dart, Android service files/Gradle wiring, Apple plist/bundle wiring, Web configuration, and Windows development setup.
  5. Map each build flavor/configuration to its exact Firebase project and app registration; compare project IDs, app IDs, package names, and bundle IDs.
  6. Audit privileged credentials and all Firebase/product work before runApp.
  7. Verify the platform matrix of every downstream plugin; Core support alone is not sufficient.

The bundled guide was validated against firebase_core 4.13.0 and FlutterFire CLI 1.4.0 on 2026-08-11. Use the installed package/CLI documentation and changelogs as the source of truth when versions differ.

Preserve these invariants

  • Initialize Firebase once per intended app instance.
  • Use one [DEFAULT] app for the normal application case.
  • Centralize bootstrap ownership; do not initialize Firebase from screens, repositories, or unrelated services.
  • Call WidgetsFlutterBinding.ensureInitialized() when plugin access precedes runApp, and keep binding initialization and runApp in the same zone.
  • Still call Firebase.initializeApp() from Flutter when native Android/Apple files auto-configure the native default app.
  • Initialize Core before using any FlutterFire product plugin.
  • Do not eagerly initialize every Firebase product merely because Core exists.
  • Prefer flutterfire configure and generated platform-aware firebase_options.dart; do not hand-edit generated options.
  • Treat Firebase client options and API keys as client configuration, not Admin authorization. Protect access with product security rules and API-key restrictions where applicable.
  • Never ship service-account JSON, Admin SDK credentials, private keys, signing secrets, database credentials, or privileged server tokens in Flutter.
  • Select dev/staging/production projects deterministically at build time and keep Dart options aligned with native service files for the same build.
  • Prefer separate Firebase projects for isolated environments.
  • Do not use kDebugMode as the complete environment-selection model.
  • Do not dynamically delete/recreate or switch the default app for ordinary user tenancy or logout.
  • Create secondary apps only for genuine simultaneous multi-project needs, then verify every downstream plugin supports the named app.
  • Do not use Firebase.apps.isEmpty as a scattered lifecycle guard.
  • Treat core/duplicate-app and configuration mismatch as deterministic defects, not transient failures to retry blindly.
  • Initialize explicitly in background entry points that execute in a separate Dart isolate when their workflow requires Firebase.
  • Do not use production Firebase projects for automated tests.
  • Do not assume Core configures each product's emulator automatically.
  • Do not claim Linux support when no platform implementation is registered.
  • Treat Windows Firebase support as development-oriented unless current official guidance explicitly establishes production support.
  • Measure startup in profile/release-like builds and separate Core cost from registered plugin and remote-service work.

Choose the smallest bootstrap

Use this decision order:

  1. For a normal app, initialize one default app with generated current-platform options, then run the application.
  2. If root state requires Firebase, await Core before runApp and fail with a bounded, actionable startup state.
  3. If the first screen is Firebase-independent, render it first and initialize optional Firebase-dependent features behind an explicit readiness boundary.
  4. For dev/staging/production, select the exact project through flavors/build configuration, not runtime user state.
  5. Add a named secondary app only when two projects must be active simultaneously and all consumers support it.

Do not introduce a bootstrap abstraction unless it centralizes real environment, readiness, error, testing, or multi-app policy.

Route to the production guide

Read only the relevant sections of references/production-guide.md. Locate sections before reading them with:

rg -n '^#{1,3} (SECTION|RELATED SECTION)$' references/production-guide.md

Use these search headings:

TaskSearch headings
Understand Core versus native/product initialization, API, or platform support`Package ArchitectureDart vs Native vs Service InitializationCurrent APIFirebaseAppFirebaseOptionsPlatform Capability Matrix`
Install/configure CLI or generated options`FlutterFire CLIInstallConfigureNoninteractive ConfigurationRe-run flutterfire configureflutterfire reconfigurefirebase_options.dartDo Not Manually Edit Generated Options`
Review configuration secrecy and source control`Are Firebase Options SecretsSource ControlSecurity BoundaryNEVER Ship TheseAPI-Key NuanceSecurity Rules`
Initialize the default app or fix duplicate/lifecycle behavior`InitializationRecommended DefaultWidgetsFlutterBinding.ensureInitializedBinding Decision RuleKeep Binding and runApp in the Same ZoneDefault Firebase AppBefore InitializationNative Default ConfigurationDuplicate InitializationDo Not Use Firebase.apps.isEmpty EverywhereRepeated Initialization SemanticsHot Reload and Hot Restart`
Create, use, or delete secondary apps`Secondary Firebase AppsGood Secondary-App Use CasesBad Secondary-App Use CasesPlugin Support for Secondary AppsFirebase App DeletionDynamic Project SwitchingMultiple Firebase App Cost`
Design or optimize startup`Startup ModelStartup Decision FrameworkDefault Recommended BootstrapFirebase-Independent First FrameStartup PerformanceNative Core CostWeb Core CostRegistered Plugin CostAvoid Eager Service InitializationParallel Startup WorkStartup AuditStartup TimingDo Not Skip await Incorrectly`
Configure Android, Apple, Web, Windows, or check Linux`AndroidFirebase App Registrationgoogle-services.jsonGoogle Services Gradle PluginAndroid Flavors / Build TypesiOSBundle IDGoogleService-Info.plistApple Build ConfigurationsmacOSWebWeb JS SDKAdvanced Web Manual LoadingWeb Trusted TypesWindowsLinux`
Configure environments/flavors and prevent project mismatch`Environments and FlavorsEnvironment SelectionFlavor Options SelectionAvoid kDebugMode as the Entire Environment ModelConfiguration VerificationPrevent Production/Stage MismatchManual FirebaseOptionsNative Service Files vs Dart Options`
Initialize background entry points or isolates`Background IsolatesFirebase Messaging Background ExampleGeneric Spawned Isolates`
Test Core or configure emulators/demo projects`TestingPure Unit TestsWidget TestsCore Integration TestsEmulator SuiteDemo ProjectDo Not Use Production Firebase for Automated Tests`
Handle initialization errors or degraded startup`Error Handlingcore/no-appcore/not-initializedcore/duplicate-appConfiguration Failure vs Transient FailureInitialization TimeoutFail Fast vs Degraded ModeStartup Error Screen Pattern`
Review architecture, ordering, debugging, or production readiness`ArchitectureFirebase Core Is Not a Service LocatorMultiple FlutterFire PluginsPlugin OrderingPerformance Anti-Optimization WarningsLoggingDebugging GuideAnti-PatternsImplementation ChecklistStartup Audit ChecklistCode Review ChecklistProduction Readiness ChecklistVersion-Sensitive AreasDecision Framework`

For a full Firebase bootstrap or production-readiness audit, read the entire guide after completing the repository inventory.

Implement at the single bootstrap boundary

  • Fix repeated initialization in the shared app bootstrap, not with guards in every caller.
  • Fix wrong-project behavior by aligning flavor selection, generated Dart options, native service files, and registered package/bundle IDs.
  • Keep product-specific emulator, permissions, listeners, and remote fetching in the owning product layer.
  • Preserve existing generated-file and CI conventions when sound; regenerate deterministically when configuration changes.
  • Keep Firebase Core readiness explicit where startup can proceed without it.

Validate the result

Run the narrowest relevant Dart/Flutter and configuration checks, then test release-like builds. Cover changed paths from this matrix:

  • one default app with the expected name/options on every affected platform;
  • exact dev/staging/production project and app IDs for each flavor;
  • Android package/service file/Gradle alignment;
  • Apple bundle ID/plist/build-configuration alignment;
  • Web reload and current options/JS integration;
  • background entry-point initialization when changed;
  • deterministic configuration failures versus supported degraded behavior;
  • emulator/demo isolation without production access;
  • downstream plugin access after Core readiness;
  • profile/release startup timing when performance changed.

Never claim Firebase production readiness from Core initialization alone. Report untested platforms, flavors, downstream plugins, and background entry points.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.