$npx -y skills add getsentry/sentry-for-ai --skill sentry-cocoa-sdkFull Sentry SDK setup for Apple platforms (iOS, macOS, tvOS, watchOS, visionOS). Use when asked to "add Sentry to iOS", "add Sentry to Swift", "install sentry-cocoa", or configure error monitoring, tracing, profiling, session replay, logging, or metrics for Apple applications. Su
| 1 | > [All Skills](../../SKILL_TREE.md) > [SDK Setup](../sentry-sdk-setup/SKILL.md) > Cocoa SDK |
| 2 | |
| 3 | # Sentry Cocoa SDK |
| 4 | |
| 5 | Opinionated wizard that scans your Apple project and guides you through complete Sentry setup. |
| 6 | |
| 7 | ## Invoke This Skill When |
| 8 | |
| 9 | - User asks to "add Sentry to iOS/macOS/tvOS" or "set up Sentry" in an Apple app |
| 10 | - User wants error monitoring, tracing, profiling, session replay, or logging in Swift/ObjC, or metrics in Swift |
| 11 | - User mentions `sentry-cocoa`, `SentrySDK`, or the Apple/iOS Sentry SDK |
| 12 | - User wants to monitor crashes, app hangs, watchdog terminations, or performance |
| 13 | |
| 14 | > **Note:** SDK versions and APIs below reflect Sentry docs at time of writing (sentry-cocoa 9.15.0). |
| 15 | > Always verify against [docs.sentry.io/platforms/apple/](https://docs.sentry.io/platforms/apple/) before implementing. |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | ## Phase 1: Detect |
| 20 | |
| 21 | Run these commands to understand the project before making any recommendations: |
| 22 | |
| 23 | ```bash |
| 24 | # Check existing Sentry dependency |
| 25 | grep -rEi "sentry|sentry-cocoa|SentrySPM|SentrySwiftUI" \ |
| 26 | --include="Package.swift" --include="Podfile" --include="Cartfile" \ |
| 27 | --include="Package.resolved" --include="project.pbxproj" . 2>/dev/null | head -20 |
| 28 | |
| 29 | # Detect UI framework (SwiftUI vs UIKit) |
| 30 | grep -rE "@main|struct .*: App" --include="*.swift" . 2>/dev/null | head -5 |
| 31 | grep -rE "AppDelegate|UIApplicationMain|@UIApplicationDelegateAdaptor" --include="*.swift" . 2>/dev/null | head -5 |
| 32 | |
| 33 | # Detect platform and deployment targets |
| 34 | grep -rE "platforms:|\\.iOS|\\.macOS|\\.tvOS|\\.watchOS|\\.visionOS|IPHONEOS_DEPLOYMENT_TARGET|MACOSX_DEPLOYMENT_TARGET|TVOS_DEPLOYMENT_TARGET|WATCHOS_DEPLOYMENT_TARGET|XROS_DEPLOYMENT_TARGET" \ |
| 35 | --include="Package.swift" --include="project.pbxproj" . 2>/dev/null | head -20 |
| 36 | grep -E "platform :ios|platform :osx|platform :tvos|platform :watchos" Podfile 2>/dev/null |
| 37 | |
| 38 | # Detect logging |
| 39 | grep -rE "import OSLog|import os\\.log|Logger\\(|CocoaLumberjack|DDLog" --include="*.swift" . 2>/dev/null | head -5 |
| 40 | |
| 41 | # Detect companion backend |
| 42 | ls ../backend ../server ../api 2>/dev/null |
| 43 | ls ../go.mod ../requirements.txt ../Gemfile ../package.json 2>/dev/null |
| 44 | ``` |
| 45 | |
| 46 | **What to note:** |
| 47 | - Is `sentry-cocoa` already in `Package.swift` or `Podfile`? If yes, skip to Phase 2 (configure features). |
| 48 | - SwiftUI (`@main App` struct) or UIKit (`AppDelegate`)? Determines init pattern. |
| 49 | - Which Apple platforms? (Affects which features are available — see Platform Support Matrix.) |
| 50 | - Existing logging library? (Enables structured log capture.) |
| 51 | - SwiftUI tracing import/product? `SentrySwiftUI` still exists but is deprecated in SDK 9.4.1+; prefer the main `Sentry` module for released binary products. |
| 52 | - Companion backend? (Triggers Phase 4 cross-link for distributed tracing.) |
| 53 | |
| 54 | --- |
| 55 | |
| 56 | ## Phase 2: Recommend |
| 57 | |
| 58 | Based on what you found, present a concrete recommendation. Don't ask open-ended questions — lead with a proposal: |
| 59 | |
| 60 | **Recommended (core coverage):** |
| 61 | - **Error Monitoring** — always; crash reporting, app hangs, watchdog terminations, NSError/Swift errors |
| 62 | - **Tracing** — always for apps; auto-instruments app launch, network, UIViewController, file I/O, Core Data |
| 63 | - **Profiling** — production iOS/macOS apps; UI profiling via `configureProfiling` |
| 64 | |
| 65 | **Optional (enhanced observability):** |
| 66 | - **Session Replay** — user-facing iOS apps; verify masking on iOS 26+ / Liquid Glass builds |
| 67 | - **Logging** — when structured log capture is needed |
| 68 | - **Metrics** — Swift apps needing aggregate counters, gauges, or distributions |
| 69 | - **User Feedback** — apps that want crash/error feedback forms from users |
| 70 | |
| 71 | **Not available for Cocoa:** |
| 72 | - Crons — backend only |
| 73 | - AI Monitoring — JS/Python only |
| 74 | |
| 75 | **Recommendation logic:** |
| 76 | |
| 77 | | Feature | Recommend when... | |
| 78 | |---------|------------------| |
| 79 | | Error Monitoring | **Always** — non-negotiable baseline | |
| 80 | | Tracing | **Always for apps** — rich auto-instrumentation out of the box | |
| 81 | | Profiling | iOS/macOS production apps where performance matters (not tvOS/watchOS/visionOS) | |
| 82 | | Session Replay | User-facing iOS apps; tvOS may work but is not officially supported | |
| 83 | | Logging | Existing `os.log` / CocoaLumberjack usage, or structured logs needed | |
| 84 | | Metrics | Aggregate product or health signals that should not create issues; Swift only, SDK 9.12+ | |
| 85 | | User Feedback | Apps wanting in-app bug reports with screenshots | |
| 86 | |
| 87 | Propose: *"I recommend Error Monitoring + Tracing + Profiling. Want me to also add Session Replay and Logging?"* |
| 88 | |
| 89 | --- |
| 90 | |
| 91 | ## Phase 3: Guide |
| 92 | |
| 93 | ### Install |
| 94 | |
| 95 | **Option 1 — Sentry Wizard (recommended):** |
| 96 | |
| 97 | > **You need to run this yourself** — the wizard opens a browser for login and requires inte |