Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Multi-platform push notification skill for implementing APNs (iOS), FCM (Android), and cross-platform notification systems with rich media, deep linking, and background processing capabilities.
.claude/skills/a5c-ai-push-notifications/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 280% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 209% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 187% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 174% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 183% | 0% |
Comprehensive push notification implementation for iOS (APNs) and Android (FCM), including rich notifications, deep linking, and background processing.
This skill provides capabilities for implementing push notifications across iOS and Android platforms, covering certificate/key configuration, notification payload design, rich media attachments, deep linking, and background notification handling.
bash# Ensure push notification entitlement is enabled # In Xcode: Signing & Capabilities > + Capability > Push Notifications # APNs Key (.p8) from Apple Developer Portal # Or APNs Certificate (.p12) - less preferred
groovy// build.gradle (project) classpath 'com.google.gms:google-services:4.4.0' // build.gradle (app) plugins { id 'com.google.gms.google-services' } dependencies { implementation platform('com.google.firebase:firebase-bom:32.7.0') implementation 'com.google.firebase:firebase-messaging' }
bash# Node.js server for sending notifications npm install firebase-admin @parse/node-apn
swiftimport SwiftUI import UserNotifications @main struct MyApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { WindowGroup { ContentView() } } } class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { UNUserNotificationCenter.current().delegate = self registerForPushNotifications() return true } func registerForPushNotifications() { UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in guard granted else { return } DispatchQueue.main.async { UIApplication.shared.registerForRemoteNotifications() } } } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined() print("APNs Token: \(token)") // Send token to your server } func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { print("Failed to register for notifications: \(error)") } // Handle notification when app is in foreground func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { completionHandler([.banner, .sound, .badge]) } // Handle notification tap func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { let userInfo = response.notification.request.content.userInfo handleNotificationTap(userInfo: userInfo) completionHandler() } func handleNotificationTap(userInfo: [AnyHashable: Any]) { if let deepLink = userInfo["deep_link"] as? String { // Navigate to deep link destination NotificationCenter.default.post(name: .handleDeepLink, object: nil, userInfo: ["url": deepLink]) } } } extension Notification.Name { static let handleDeepLink = Notification.Name("handleDeepLink") }
kotlinimport com.google.firebase.messaging.FirebaseMessagingService import com.google.firebase.messaging.RemoteMessage import android.app.NotificationChannel import android.app.NotificationManager import android.app.PendingIntent import android.content.Intent import android.os.Build import androidx.core.app.NotificationCompat class MyFirebaseMessagingService : FirebaseMessagingService() { override fun onNewToken(token: String) { super.onNewToken(token) // Send token to your server sendTokenToServer(token) } override fun onMessageReceived(remoteMessage: RemoteMessage) { super.onMessageReceived(remoteMessage) // Handle data payload remoteMessage.data.isNotEmpty().let { handleDataPayload(remoteMessage.data) } // Handle notification payload (when app in foreground) remoteMessage.notification?.let { showNotification(it.title, it.body, remoteMessage.data) } } private fun handleDataPayload(data: Map<String, String>) { val deepLink = data["deep_link"] val customData = data["custom_data"] // Process data payload } private fun showNotification(title: String?, body: String?, data: Map<String, String>) { val channelId = "default_channel" createNotificationChannel(channelId) val intent = Intent(this, MainActivity::class.java).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK data.forEach { (key, value) -> putExtra(key, value) } } val pendingIntent = PendingIntent.getActivity( this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE ) val notification = NotificationCompat.Builder(this, channelId) .setSmallIcon(R.drawable.ic_notification) .setContentTitle(title) .setContentText(body) .setPriority(NotificationCompat.PRIORITY_HIGH) .setContentIntent(pendingIntent) .setAutoCancel(true) .build() val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager notificationManager.notify(System.currentTimeMillis().toInt(), notification) } private fun createNotificationChannel(channelId: String) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val channel = NotificationChannel( channelId, "Default Notifications", NotificationManager.IMPORTANCE_HIGH ).apply { description = "Default notification channel" enableLights(true) enableVibration(true) } val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager notificationManager.createNotificationChannel(channel) } } private fun sendTokenToServer(token: String) { // API call to register token with backend } }
swiftimport UserNotifications class NotificationService: UNNotificationServiceExtension { var contentHandler: ((UNNotificationContent) -> Void)? var bestAttemptContent: UNMutableNotificationContent? override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { self.contentHandler = contentHandler bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) if let bestAttemptContent = bestAttemptContent { // Handle rich media attachment if let imageURLString = request.content.userInfo["image_url"] as? String, let imageURL = URL(string: imageURLString) { downloadImage(from: imageURL) { attachment in if let attachment = attachment { bestAttemptContent.attachments = [attachment] } contentHandler(bestAttemptContent) } } else { contentHandler(bestAttemptContent) } } } private func downloadImage(from url: URL, completion: @escaping (UNNotificationAttachment?) -> Void) { let task = URLSession.shared.downloadTask(with: url) { localURL, _, error in guard let localURL = localURL, error == nil else { completion(nil) return } let tmpDirectory = FileManager.default.temporaryDirectory let tmpFile = tmpDirectory.appendingPathComponent(url.lastPathComponent) try? FileManager.default.moveItem(at: localURL, to: tmpFile) if let attachment = try? UNNotificationAttachment(identifier: "", url: tmpFile, options: nil) { completion(attachment) } else { completion(nil) } } task.resume() } override func serviceExtensionTimeWillExpire() { if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { contentHandler(bestAttemptContent) } } }
javascript// Using Firebase Admin SDK for FCM const admin = require('firebase-admin'); admin.initializeApp({ credential: admin.credential.cert(serviceAccount) }); async function sendPushNotification(token, title, body, data) { const message = { notification: { title, body }, data: { deep_link: data.deepLink || '', custom_data: JSON.stringify(data.custom || {}) }, android: { priority: 'high', notification: { channelId: 'default_channel', imageUrl: data.imageUrl } }, apns: { payload: { aps: { 'mutable-content': 1, sound: 'default' } }, fcmOptions: { imageUrl: data.imageUrl } }, token }; try { const response = await admin.messaging().send(message); console.log('Successfully sent message:', response); return response; } catch (error) { console.error('Error sending message:', error); throw error; } } // Using node-apn for direct APNs const apn = require('@parse/node-apn'); const apnProvider = new apn.Provider({ token: { key: './AuthKey_XXXXXXXXXX.p8', keyId: 'XXXXXXXXXX', teamId: 'YYYYYYYYYY' }, production: false // true for production }); async function sendAPNsNotification(deviceToken, title, body, data) { const notification = new apn.Notification(); notification.expiry = Math.floor(Date.now() / 1000) + 3600; notification.badge = 1; notification.sound = 'default'; notification.alert = { title, body }; notification.payload = { deep_link: data.deepLink, ...data.custom }; notification.topic = 'com.example.app'; notification.mutableContent = true; if (data.imageUrl) { notification.payload.image_url = data.imageUrl; } try { const result = await apnProvider.send(notification, deviceToken); console.log('APNs result:', result); return result; } catch (error) { console.error('APNs error:', error); throw error; } }
javascriptconst pushNotificationTask = defineTask({ name: 'push-notification-setup', description: 'Configure push notifications for mobile app', inputs: { platform: { type: 'string', required: true, enum: ['ios', 'android', 'both'] }, projectPath: { type: 'string', required: true }, features: { type: 'array', items: { type: 'string', enum: ['rich_media', 'deep_linking', 'silent_push', 'notification_actions'] } } }, outputs: { configuredPlatforms: { type: 'array' }, tokenRegistrationCode: { type: 'string' }, serverIntegrationGuide: { type: 'string' } }, async run(inputs, taskCtx) { return { kind: 'skill', title: `Configure push notifications for ${inputs.platform}`, skill: { name: 'push-notifications', context: { operation: 'configure', platform: inputs.platform, projectPath: inputs.projectPath, features: inputs.features } }, io: { inputJsonPath: `tasks/${taskCtx.effectId}/input.json`, outputJsonPath: `tasks/${taskCtx.effectId}/result.json` } }; } });
json{ "aps": { "alert": { "title": "New Message", "subtitle": "From John", "body": "Hey, how are you?" }, "badge": 1, "sound": "default", "mutable-content": 1, "category": "MESSAGE_CATEGORY", "thread-id": "conversation-123" }, "deep_link": "myapp://messages/123", "image_url": "https://example.com/image.jpg", "custom_data": { "message_id": "msg-456", "sender_id": "user-789" } }
json{ "message": { "token": "device_fcm_token", "notification": { "title": "New Message", "body": "Hey, how are you?", "image": "https://example.com/image.jpg" }, "data": { "deep_link": "myapp://messages/123", "message_id": "msg-456", "sender_id": "user-789" }, "android": { "priority": "high", "notification": { "channel_id": "messages", "tag": "message-123", "click_action": "OPEN_MESSAGE" } }, "apns": { "payload": { "aps": { "mutable-content": 1, "category": "MESSAGE_CATEGORY" } } } } }
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 10,194 | 14,198 | +39% | 1 | 1 | 0% | 1,550 | 5,894 | +280% | 0 | 0 | — |
case-02 | pass→pass | 10,769 | 9,230 | -14% | 1 | 1 | 0% | 2,119 | 5,815 | +174% | 0 | 0 | — |
case-03 | pass→pass | 11,276 | 12,571 | +11% | 1 | 1 | 0% | 2,326 | 6,577 | +183% | 0 | 0 | — |
case-04 | pass→pass | 5,386 | 5,591 | +4% | 1 | 1 | 0% | 1,055 | 4,937 | +368% | 0 | 0 | — |
case-05 | pass→pass | 8,973 | 12,860 | +43% | 1 | 1 | 0% | 1,990 | 6,119 | +207% | 0 | 0 | — |
case-06 | pass→pass | 2,202 | 3,735 | +70% | 1 | 1 | 0% | 399 | 4,658 | +1067% | 0 | 0 | — |
case-07 | pass→pass | 5,565 | 5,059 | -9% | 1 | 1 | 0% | 1,065 | 4,887 | +359% | 0 | 0 | — |
case-08 | pass→pass | 6,482 | 5,560 | -14% | 1 | 1 | 0% | 1,241 | 4,921 | +297% | 0 | 0 | — |
case-09 | pass→pass | 9,998 | 12,078 | +21% | 1 | 1 | 0% | 2,046 | 6,300 | +208% | 0 | 0 | — |
case-10 | pass→pass | 12,784 | 14,438 | +13% | 1 | 1 | 0% | 2,077 | 6,232 | +200% | 0 | 0 | — |
case-11 | pass→pass | 7,091 | 4,895 | -31% | 1 | 1 | 0% | 1,413 | 4,838 | +242% | 0 | 0 | — |
case-12 | pass→pass | 3,239 | 5,937 | +83% | 1 | 1 | 0% | 660 | 4,810 | +629% | 0 | 0 | — |
case-13 | pass→pass | 8,710 | 8,943 | +3% | 1 | 1 | 0% | 1,774 | 5,646 | +218% | 0 | 0 | — |
case-14 | fail→pass | 9,750 | 8,969 | -8% | 1 | 1 | 0% | 1,805 | 5,570 | +209% | 0 | 0 | — |
case-15 | pass→pass | 5,086 | 6,703 | +32% | 1 | 1 | 0% | 927 | 4,890 | +428% | 0 | 0 | — |
case-16 | fail→pass | 8,806 | 5,910 | -33% | 1 | 1 | 0% | 1,818 | 5,226 | +187% | 0 | 0 | — |
case-17 | pass→pass | 10,782 | 8,748 | -19% | 1 | 1 | 0% | 2,034 | 5,561 | +173% | 0 | 0 | — |
case-18 | pass→pass | 13,298 | 11,552 | -13% | 1 | 1 | 0% | 2,128 | 6,296 | +196% | 0 | 0 | — |
case-19 | pass→pass | 7,986 | 7,646 | -4% | 1 | 1 | 0% | 1,602 | 5,423 | +239% | 0 | 0 | — |
case-20 | pass→pass | 9,192 | 6,604 | -28% | 1 | 1 | 0% | 1,861 | 5,184 | +179% | 0 | 0 | — |
case-21 | pass→pass | 14,298 | 12,647 | -12% | 1 | 1 | 0% | 3,268 | 6,662 | +104% | 0 | 0 | — |
case-22 | pass→pass | 17,244 | 20,757 | +20% | 1 | 1 | 0% | 3,947 | 8,910 | +126% | 0 | 0 | — |
case-23 | pass→pass | 10,313 | 8,760 | -15% | 1 | 1 | 0% | 1,760 | 5,924 | +237% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +13 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.