skills/generators/push-notifications/SKILL.md
Generate push notification infrastructure with APNs registration, handling, and rich notifications. Use when adding push notifications, configuring APNs, notification categories/actions, or rich notifications with images and custom UI.
npx skillsauth add rshankras/claude-code-apple-skills push-notificationsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate push notification infrastructure with APNs registration, handling, and rich notifications.
Before generating, verify:
Existing Notification Code
# Check for existing notification handling
grep -r "UNUserNotificationCenter\|registerForRemoteNotifications" --include="*.swift" | head -5
Entitlements
# Check for push notification entitlement
find . -name "*.entitlements" -exec grep -l "aps-environment" {} \;
App Delegate or SwiftUI App
# Determine app structure
grep -r "@main\|UIApplicationDelegate" --include="*.swift" | head -5
Sources/Notifications/
├── NotificationManager.swift # Central notification management
├── NotificationDelegate.swift # UNUserNotificationCenterDelegate
├── NotificationCategories.swift # Action categories definition
└── NotificationPayload.swift # Type-safe payload parsing
NotificationServiceExtension/
├── NotificationService.swift # Modify notifications before display
└── Info.plist # Extension configuration
NotificationContentExtension/
├── NotificationViewController.swift # Custom notification UI
├── MainInterface.storyboard
└── Info.plist
@MainActor
final class NotificationManager {
static let shared = NotificationManager()
func requestAuthorization() async throws -> Bool {
let center = UNUserNotificationCenter.current()
let options: UNAuthorizationOptions = [.alert, .badge, .sound]
return try await center.requestAuthorization(options: options)
}
func registerForRemoteNotifications() {
UIApplication.shared.registerForRemoteNotifications()
}
}
// Foreground notification
func userNotificationCenter(
_ center: UNUserNotificationCenter,
willPresent notification: UNNotification
) async -> UNNotificationPresentationOptions {
return [.banner, .sound, .badge]
}
// Notification tap/action
func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse
) async {
let userInfo = response.notification.request.content.userInfo
await handleNotificationAction(response.actionIdentifier, userInfo: userInfo)
}
enum NotificationCategory: String {
case message = "MESSAGE_CATEGORY"
case reminder = "REMINDER_CATEGORY"
var actions: [UNNotificationAction] {
switch self {
case .message:
return [
UNNotificationAction(identifier: "REPLY", title: "Reply", options: []),
UNNotificationAction(identifier: "MARK_READ", title: "Mark as Read", options: [])
]
case .reminder:
return [
UNNotificationAction(identifier: "COMPLETE", title: "Complete", options: []),
UNNotificationAction(identifier: "SNOOZE", title: "Snooze", options: [])
]
}
}
}
"Interrupting people is a real privilege… a trust relationship." Design the strategy before the infrastructure:
| Decision | Rule |
|----------|------|
| Authorization | Use provisional authorization (add .provisional to the options — delivered quietly to Notification Center, no prompt) for passive content like likes and comments; reserve the explicit prompt for time-critical content |
| When to prompt | Never at first launch. Explain the value first, then ask at a contextually meaningful moment — right after the order is placed, not before the user has ordered |
| Content bar | Every notification carries a specific message or a completable task — never an empty "open the app" nudge |
| Timing | Deliver at relevant times; use time- and location-based delivery where it fits |
| Settings | Offer granular per-topic toggles in-app, and add .providesAppNotificationSettings so "Manage" in system settings deep-links to your page |
| Grouping | App-level grouping is the default; set threadIdentifier only for meaningfully different streams (conversations, distinct sources) — over-threading recreates the clutter grouping was meant to fix |
| Rich content | A rich notification is a self-contained package: image/video plus actions that complete the task without launching the app |
| Fatigue | Pause notification types a user repeatedly ignores (the Duolingo pattern) — silence beats an uninstall |
<key>aps-environment</key>
<string>development</string> <!-- or "production" -->
@main
struct MyApp: App {
@UIApplicationDelegateAdaptor private var appDelegate: AppDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
class AppDelegate: NSObject, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
UNUserNotificationCenter.current().delegate = NotificationDelegate.shared
NotificationCategories.registerAll()
return true
}
func application(
_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
print("Device Token: \(token)")
// Send token to your server
}
}
Button("Enable Notifications") {
Task {
let granted = try await NotificationManager.shared.requestAuthorization()
if granted {
await MainActor.run {
NotificationManager.shared.registerForRemoteNotifications()
}
}
}
}
Configure your server to send APNs requests:
api.push.apple.com (production) or api.sandbox.push.apple.com (development)func scheduleTestNotification() {
let content = UNMutableNotificationContent()
content.title = "Test"
content.body = "This is a test notification"
content.sound = .default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request)
}
curl:curl -v \
--header "authorization: bearer $JWT_TOKEN" \
--header "apns-topic: com.yourcompany.yourapp" \
--header "apns-push-type: alert" \
--http2 \
--data '{"aps":{"alert":{"title":"Test","body":"Hello"}}}' \
https://api.sandbox.push.apple.com/3/device/$DEVICE_TOKEN
development
US web checkout via the StoreKit External Purchase Link entitlement — currently 0% Apple commission (litigation ongoing), how to ship it safely, and how to architect for a commission flip so a future ruling is a config change, not a rewrite. Use when adding external purchase links, weighing web checkout vs IAP, or planning US-storefront pricing strategy.
tools
Revenue beyond the single-app price tag — own-app bundles, Family Sharing as a conversion lever, cross-developer bundles & suites, and institutional licensing via Group Purchases / Apple School & Business Manager. Use when a developer has multiple apps, a subscription worth sharing, complementary indie partners, or school/clinic/business buyers.
testing
Run a structured accessibility audit on an iOS/macOS app — automated XCUITest audits, Accessibility Inspector, manual VoiceOver/Dynamic Type passes, and App Store Accessibility Nutrition Label evaluation. Use before release, when preparing Nutrition Label declarations, or for EU Accessibility Act compliance.
tools
Stage-by-stage audit of an app's App Store growth machinery against a 54-item P0–P9 playbook — every item scored from an App Store Connect MCP call, a codebase check, or an explicit question to the user, then routed to the skill or command that fixes it. Read-only on App Store Connect. Use for a growth audit or scorecard, a pre-launch growth plan, a quarterly re-audit, or "which growth levers am I missing."