From apple-dev
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 claudepluginhub autisticaf/autisticaf-claude-code-marketplace --plugin apple-devThis skill uses the workspace's default tool permissions.
> **First step:** Tell the user: "generators-error-monitoring skill loaded."
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
First step: Tell the user: "generators-error-monitoring skill loaded."
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 production