flutter-firebase-messaging
Skill8 starsChanged 48 days agoMITView on GitHub
Use when adding, configuring, reviewing, debugging, migrating, or optimizing Firebase Cloud Messaging in a Flutter app with FlutterFire firebase_messaging. Covers permissions, registration tokens, foreground and background handling, notification taps and routing, Android channels and priority, APNs, macOS, Web Push service workers, topics, backend registration, reliability, security, and release validation. Trigger on Flutter FCM, firebase_messaging, getToken, onTokenRefresh, onMessage, onBackgroundMessage, getInitialMessage, onMessageOpenedApp, notification permission, duplicate notifications, or push failures. Do not use for generic Firebase Admin SDK, APNs, local-notification, or service-worker work unless it directly affects FlutterFire messaging.
In this repository70 other files it gives its agents.
- camerawesome-flutterSkill
- dart-args-production-cliSkill
- dart-flutter-equatable-engineeringSkill
- dart-flutter-ffi-systems-engineeringSkill
- dart-metaSkill
- document-camera-frameSkill
- document-scan-flutterSkill
- figma-to-flutter-expertSkill
- flutter-animations-production-engineeringSkill
- flutter-app-hardening-reverse-engineeringSkill
- flutter-app-icon-engineeringSkill
- flutter-application-security-engineeringSkill
- flutter-app-links-deep-link-engineeringSkill
- flutter-cachingSkill
- flutter-concurrency-memory-performanceSkill
- flutter-confetti-engineeringSkill
- flutter-dart-package-engineeringSkill
- flutter-design-system-from-design-mdSkill
- flutter-dio-cache-interceptor-engineeringSkill
- flutter-dio-engineeringSkill
- flutter-doc-scannerSkill
- flutter-drift-persistence-engineeringSkill
- flutter-expert-tipsSkill
- flutter-firebase-analyticsSkill
- flutter-firebase-core-engineeringSkill
- flutter-get-it-injectable-dependency-injectionSkill
- flutter-go-router-engineeringSkill
- flutter-hive-persistence-engineeringSkill
- flutter-image-performanceSkill
- flutter-image-picker-production-engineeringSkill
- flutter-lints-static-analysis-engineeringSkill
- flutter-local-notifications-production-engineeringSkill
- flutter-memory-leak-engineeringSkill
- flutter-mobile-developmentSkill
- flutter-motion-engineeringSkill
- flutter-multi-environmentSkill
- flutter-native-splash-engineeringSkill
- flutter-package-plugin-selectionSkill
- flutter-path-provider-production-storageSkill
- flutter-performance-jank-optimizationSkill
- flutter-permission-handler-engineeringSkill
- flutter-pinputSkill
- flutter-production-build-releaseSkill
- flutter-production-engineeringSkill
- flutter-production-loggingSkill
- flutter-pro-image-editor-engineeringSkill
- flutter-secure-storage-security-engineeringSkill
- flutter-sentry-engineeringSkill
- flutter-share-plus-engineeringSkill
- flutter-skeletonizer-engineeringSkill
- flutter-squadron-concurrency-engineeringSkill
- flutter-supabase-engineeringSkill
- flutter-svg-engineeringSkill
- flutter-ui-performance-engineeringSkill
- flutter-url-launcher-engineeringSkill
- flutter-video-player-production-engineeringSkill
- flutter-webview-production-engineeringSkill
- freezed-production-engineeringSkill
- html-to-flutterSkill
- hydrated-blocSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Read pubspec.yaml, pubspec.lock, Flutter/Dart constraints, and the installed firebase_messaging changelog.
- Distinctive: line 15
Search every messaging listener, token call, background handler, permission request, topic operation, payload parser, presentation path, …
- Very specific: line 17
Read the relevant sections of references/production-guide.md.
- Distinctive: line 36
Treat FCM as a delivery hint, not durable business state or a guaranteed job queue.
- Distinctive: line 37
Keep server credentials and send authorization out of the Flutter client.
- Distinctive: line 38
Treat payload data and notification routes as untrusted input.
- Very specific: line 40
Keep native background handlers top-level, annotated with @pragma('vm:entry-point'), short, idempotent, isolate-safe, and free of UI or …
- Distinctive: line 42
Treat registration tokens as rotating installation routes, not user identities.
- Distinctive: line 44
Avoid duplicate presentation when the OS already displays a notification payload.
- Distinctive: line 45
Use topics for broadcast segmentation, never authorization.
- Distinctive: line 48
Use high-priority Android delivery only for time-sensitive, user-visible notifications.
≈ “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.
Files
Flutter Firebase Messaging
Build or repair production Firebase Messaging integrations without importing stale native or Web assumptions into FlutterFire.
Workflow
- Inspect before editing:
- Read
pubspec.yaml,pubspec.lock, Flutter/Dart constraints, and the installedfirebase_messagingchangelog. - Identify every supported platform and inspect its existing Firebase/native configuration.
- Search every messaging listener, token call, background handler, permission request, topic operation, payload parser, presentation path, and notification route.
- Identify the trusted sender, payload schema, backend registration model, permission UX, and reliability assumptions.
- Read
- Read the relevant sections of
references/production-guide.md. Userg -n '^#|^##' references/production-guide.mdto locate sections; do not load the entire reference when a focused section is sufficient. - Revalidate version-sensitive facts against current official FlutterFire, Firebase, Android, Apple, or Flutter documentation before relying on them. Prefer installed package source and current official documentation over the reference when they conflict.
- Fix the shared root cause with the smallest complete change. Reuse the application's existing lifecycle, routing, persistence, authentication, and networking patterns.
- Validate the affected lifecycle on every supported platform, including release mode where background execution or tree shaking matters.
Reference Routing
- For architecture or implementation: read
Core Principles,Recommended Architecture,Initialization, andProduction Decision Rules. - For permissions or consent: read
Permission HandlingandPrivacy-Aware Auto Initialization. - For tokens and accounts: read
Token and Registration Managementand the backend registration sections. - For callbacks or routing: read the foreground, background, interaction, payload, deduplication, and navigation sections.
- For Android: read the Android permission, channel, priority, Doze, and release-handler sections.
- For iOS or macOS: read the APNs, capabilities, swizzling, UIScene, foreground presentation, and initial-message sections.
- For Web: read the Web capability, VAPID, service-worker, routing, topic, and token-reconciliation sections.
- For review or debugging: use
Code Review Checklist, anti-patterns,Version Sensitivity, andRelease Validation. - For security or sending: read the payload, trusted backend, HTTP v1, authorization, topic, logging, and deep-link sections.
Non-Negotiable Rules
- Treat FCM as a delivery hint, not durable business state or a guaranteed job queue.
- Keep server credentials and send authorization out of the Flutter client.
- Treat payload data and notification routes as untrusted input; authenticate and authorize before protected navigation or mutation.
- Register application-wide listeners once. Never add listeners in widget
build()methods. - Keep native background handlers top-level, annotated with
@pragma('vm:entry-point'), short, idempotent, isolate-safe, and free of UI or navigation work. - Request notification permission contextually. Do not let startup token retrieval become accidental permission UX.
- Treat registration tokens as rotating installation routes, not user identities. Make backend association and refresh synchronization idempotent.
- Separate message receipt deduplication from notification-interaction deduplication.
- Avoid duplicate presentation when the OS already displays a notification payload.
- Use topics for broadcast segmentation, never authorization.
- Design Web separately: do not assume native background handlers, token-refresh streams, tap APIs, or client topic APIs work there.
- Preserve standard FlutterFire Apple swizzling unless current FlutterFire documentation explicitly supports the intended alternative.
- Use high-priority Android delivery only for time-sensitive, user-visible notifications.
Output Expectations
When implementing, make the smallest reviewable diff and add one focused runnable check for non-trivial parsing, routing, registration, or deduplication logic. When reviewing, report findings by severity with exact file and line locations, then list validation gaps. State any platform or version behavior that still requires a physical-device, release-build, or deployed-HTTPS test.
Examples
Should trigger:
- "Add Firebase push notifications to this Flutter app."
- "Why does
onBackgroundMessagework in debug but fail in release?" - "Review our FCM token refresh and logout handling."
- "Fix duplicate notifications and cold-start routing on iOS."
- "Configure Flutter Web messaging with a service worker and VAPID key."
Should not trigger:
- "Send an FCM message from a Node Admin SDK backend" unless Flutter payload compatibility is part of the request.
- "Schedule a local notification with flutter_local_notifications" unless it is the presentation layer for an FCM flow.
- "Explain APNs token authentication" unless it is configuring FlutterFire messaging.
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
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.

