skills/generators/error-monitoring/SKILL.md
Generates protocol-based error/crash monitoring with swappable providers (Sentry, Crashlytics). Use when user wants to add crash reporting, error tracking, or production monitoring.
npx skillsauth add rshankras/claude-code-apple-skills error-monitoringInstall 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.
Generates a production-ready error monitoring infrastructure with protocol-based architecture for easy provider swapping.
Before generating, ALWAYS check:
# Check for existing crash reporting
rg -l "Sentry|Crashlytics|CrashReporter" --type swift
# Check Package.swift for existing SDKs
cat Package.swift | grep -i "sentry\|firebase\|crashlytics"
# Check for existing error handling patterns
rg "captureError|recordError|logError" --type swift | head -5
If existing crash reporting found:
Ask user via AskUserQuestion:
Initial provider?
Include breadcrumbs?
Include user context?
Always generate:
Sources/ErrorMonitoring/
├── ErrorMonitoringService.swift # Protocol
├── ErrorContext.swift # Breadcrumbs, user info
└── NoOpErrorMonitoring.swift # Testing/privacy
Based on provider selection:
Sources/ErrorMonitoring/Providers/
├── SentryErrorMonitoring.swift # If Sentry selected
└── CrashlyticsErrorMonitoring.swift # If Crashlytics selected
Read templates from this skill:
templates/ErrorMonitoringService.swifttemplates/ErrorContext.swifttemplates/NoOpErrorMonitoring.swifttemplates/SentryErrorMonitoring.swift (if selected)templates/CrashlyticsErrorMonitoring.swift (if selected)Adapt templates to match:
In App.swift:
import SwiftUI
@main
struct MyApp: App {
init() {
// Configure error monitoring
ErrorMonitoring.shared.configure()
}
var body: some Scene {
WindowGroup {
ContentView()
.environment(\.errorMonitoring, ErrorMonitoring.shared.service)
}
}
}
Capturing errors:
do {
try await riskyOperation()
} catch {
ErrorMonitoring.shared.service.captureError(error)
}
Adding breadcrumbs:
ErrorMonitoring.shared.service.addBreadcrumb(
Breadcrumb(category: "navigation", message: "Opened settings")
)
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.0.0")
protocol ErrorMonitoringService: Sendable {
func configure()
func captureError(_ error: Error, context: ErrorContext?)
func captureMessage(_ message: String, level: ErrorLevel)
func addBreadcrumb(_ breadcrumb: Breadcrumb)
func setUser(_ user: MonitoringUser?)
func reset()
}
// In ErrorMonitoring.swift
final class ErrorMonitoring {
static let shared = ErrorMonitoring()
// Change this ONE line to swap providers:
let service: ErrorMonitoringService = SentryErrorMonitoring()
// let service: ErrorMonitoringService = CrashlyticsErrorMonitoring()
// let service: ErrorMonitoringService = NoOpErrorMonitoring()
}
// Automatic navigation breadcrumbs
struct ContentView: View {
@Environment(\.errorMonitoring) var errorMonitoring
var body: some View {
Button("Open Details") {
errorMonitoring.addBreadcrumb(
Breadcrumb(category: "ui", message: "Tapped details button")
)
showDetails = true
}
}
}
After generation, verify:
NoOpErrorMonitoring for EU users who opt outAdd to PrivacyInfo.xcprivacy if using Sentry/Crashlytics:
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeCrashData</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>
enum AppError: Error {
case networkFailure(URLError)
case decodingFailure(DecodingError)
case authenticationRequired
var context: ErrorContext {
ErrorContext(
tags: ["error_type": String(describing: self)],
extra: ["recoverable": isRecoverable]
)
}
}
// Capture with context
errorMonitoring.captureError(error, context: error.context)
// Sentry supports performance monitoring
let transaction = SentrySDK.startTransaction(name: "Load Data", operation: "http")
defer { transaction.finish() }
let data = try await fetchData()
// Include version info
SentrySDK.start { options in
options.dsn = "YOUR_DSN"
options.releaseName = "\(Bundle.main.appVersion)-\(Bundle.main.buildNumber)"
}
analytics-setup - Often combined with error monitoringlogging-setup - Use Logger for debug, error monitoring for productiondevelopment
Build, install, and launch an iOS app on a physical iPhone or iPad entirely from the command line (no Xcode GUI), using xcodebuild + devicectl. Use when the user wants to run, test, or screenshot their app on a real device without opening Xcode.
development
Comprehensive iOS development guidance including Swift best practices, SwiftUI patterns, UI/UX review against HIG, and app planning. Use for iOS code review, best practices, accessibility audits, or planning new iOS apps.
development
Build, install, launch, and screenshot an iOS app in the Simulator to verify a change visually. Use when the user wants to run the app, see a change live, screenshot the running app, or confirm a UI fix actually works (not just that it compiles).
development
Audits skills in this repo for consistency, API drift, and structural gaps. Produces a prioritized report grouped by severity (Critical/High/Medium/Low). Use when asked to "audit skills", "check the skill repo for drift", or when planning bulk skill cleanup. Read-only — does not apply fixes.