flutter-firebase
Integrate Firebase services including Authentication, Firestore, Cloud Messaging, Crashlytics, and Analytics. Use when adding backend capabilities, push notifications, crash reporting, or remote configuration to a Flutter app.
Works with
---
name: flutter-firebase
description: Integrate Firebase services including Authentication, Firestore, Cloud Messaging, Crashlytics, and Analytics. Use when adding backend capabilities, push notifications, crash reporting, or remote configuration to a Flutter app.
license: MIT
---
# Firebase Setup
- Use `firebase_core` for initialization — call `Firebase.initializeApp()` before `runApp()`
- Use `flutterfire configure` for platform-specific setup
- Use separate Firebase projects per flavor (see `app-config` skill)
- Register Firebase services via `injectable` for consistent DI
# Authentication
- Use `firebase_auth` for user management
- Wrap all auth calls in an `AuthRepository` — no direct `FirebaseAuth` usage in BLoCs or UI
- Support email/password, Google Sign-In, and Apple Sign-In at minimum
- Handle auth state changes via `FirebaseAuth.instance.authStateChanges()` stream in `AuthBloc`
- Store auth tokens via `flutter_secure_storage` — never in `SharedPreferences` or source code
- Implement proper sign-out: clear local cache, navigate to login, dispose user-specific BLoCs
# Firestore
- Use `cloud_firestore` for remote data persistence
- DataSources wrap all Firestore calls (`get`, `set`, `update`, `delete`, `snapshots`)
- Use typed model classes with `fromFirestore` / `toFirestore` factory methods
- Prefer `.withConverter<T>()` for type-safe collection references
- Use batch writes for multi-document operations — never multiple sequential writes
- Implement offline persistence (enabled by default on mobile)
## Security Rules
- NEVER rely on client-side validation alone — enforce rules in Firestore Security Rules
- Default deny: start with `allow read, write: if false;` and open only what's needed
- Always validate `request.auth != null` for authenticated-only collections
- Test rules with the Firebase Emulator Suite before deploying
# Push Notifications (FCM)
- Use `firebase_messaging` for push notifications
- Request notification permissions early but gracefully (explain value before requesting)
- Handle foreground, background, and terminated-state messages separately
- Store FCM token in Firestore user document for server-side targeting
- Re-register token on `onTokenRefresh` stream
# Crashlytics
- Use `firebase_crashlytics` for crash reporting
- Enable in staging and production flavors only — disable in dev
- Record Flutter errors: `FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError`
- Catch async errors via `PlatformDispatcher.instance.onError`
- Add custom keys for user context: `Crashlytics.instance.setCustomKey('userId', id)`
# Analytics
- Use `firebase_analytics` for user behavior tracking
- Log meaningful events with descriptive names: `analytics.logEvent(name: 'purchase_completed')`
- Set user properties for segmentation: `analytics.setUserProperty(name: 'plan', value: 'premium')`
- Track screen views via `FirebaseAnalyticsObserver` in `GoRouter`
- NEVER log PII (emails, passwords, phone numbers) in analytics events
# Remote Config
- Use `firebase_remote_config` for feature flags and A/B testing
- Set sensible defaults locally — app MUST work without Remote Config fetched
- Fetch and activate on app start with a timeout fallback
- Cache values and respect minimum fetch intervals to avoid throttlingMore Security skills
azure-cost
microsoft/azure-skills
Azure cost management: query costs, forecast spending, optimize to reduce waste. WHEN: \"Azure costs\", \"Azure bill\", \"cost breakdown\", \"how much am I spending\", \"forecast spending\", \"optimize costs\", \"reduce spending\", \"orphaned resources\", \"rightsize VMs\", \"cost spike\", \"reduce storage costs\", \"AKS cost\". DO NOT USE FOR: deploying resources, provisioning, diagnostics, or security audits.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
azure-messaging
microsoft/azure-skills
Troubleshoot and resolve issues with Azure Messaging SDKs for Event Hubs and Service Bus. Covers connection failures, authentication errors, message processing issues, and SDK configuration problems. WHEN: event hub SDK error, service bus SDK issue, messaging connection failure, AMQP error, event processor host issue, message lock lost, message lock expired, lock renewal, lock renewal batch, send timeout, receiver disconnected, SDK troubleshooting, azure messaging SDK, event hub consumer, service bus queue issue, topic subscription error, enable logging event hub, service bus logging, eventhub python, servicebus java, eventhub javascript, servicebus dotnet, event hub checkpoint, event hub not receiving messages, service bus dead letter, batch processing lock, session lock expired, idle timeout, connection inactive, link detach, slow reconnect, session error, duplicate events, offset reset, receive batch.

