skills/generators-analytics-setup/SKILL.md
Generates protocol-based analytics infrastructure with swappable providers (TelemetryDeck, Firebase, Mixpanel). Use when user wants to add analytics, track events, or set up telemetry.
npx skillsauth add AutisticAF/claude-code-apple-dev-plugin generators-analytics-setupInstall 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.
First step: Tell the user: "generators-analytics-setup skill loaded."
Generate a protocol-based analytics infrastructure that makes it easy to swap providers without changing app code.
Use this skill when the user:
The generated code uses a protocol-based architecture:
// Your app uses the protocol
analytics.track(.buttonTapped("subscribe"))
// Swap providers by changing ONE line:
let analytics: AnalyticsService = TelemetryDeckAnalytics() // or FirebaseAnalytics()
Search for existing analytics:
Glob: **/*Analytics*.swift, **/*Telemetry*.swift
Grep: "protocol.*Analytics" or "TelemetryDeck" or "Firebase"
If found, ask user:
Ask user via AskUserQuestion:
Which provider(s)?
What events to track?
User properties?
Always generate these files:
AnalyticsService.swift - Protocol (never changes)AnalyticsEvent.swift - Event definitions (app-specific)NoOpAnalytics.swift - For testing/privacy modeBased on user selection:
TelemetryDeckAnalytics.swiftFirebaseAnalytics.swiftMixpanelAnalytics.swiftFor SwiftUI apps:
AnalyticsServiceKey.swift - Environment key for dependency injectionCheck project structure:
Sources/ exists → Sources/Analytics/App/ exists → App/Analytics/Analytics/After generation, provide:
Sources/Analytics/
├── AnalyticsService.swift # Protocol (stable interface)
├── AnalyticsEvent.swift # Your app's events
├── Providers/
│ ├── NoOpAnalytics.swift # Testing/privacy
│ └── [Provider]Analytics.swift # Selected provider(s)
└── AnalyticsServiceKey.swift # SwiftUI Environment (optional)
App Entry Point:
@main
struct MyApp: App {
// Choose your provider
private let analytics: AnalyticsService = TelemetryDeckAnalytics(appID: "YOUR-APP-ID")
init() {
analytics.configure()
}
var body: some Scene {
WindowGroup {
ContentView()
.environment(\.analytics, analytics)
}
}
}
Tracking Events:
struct ContentView: View {
@Environment(\.analytics) private var analytics
var body: some View {
Button("Subscribe") {
analytics.track(.buttonTapped("subscribe"))
}
}
}
TelemetryDeck:
// Package.swift
.package(url: "https://github.com/TelemetryDeck/SwiftClient", from: "1.0.0")
Firebase:
// Package.swift
.package(url: "https://github.com/firebase/firebase-ios-sdk", from: "10.0.0")
// Also requires GoogleService-Info.plist
To switch providers:
// Before
private let analytics: AnalyticsService = TelemetryDeckAnalytics(...)
// After
private let analytics: AnalyticsService = FirebaseAnalytics()
NoOpAnalytics() in tests and previewsdevelopment
SwiftUI Layout protocol for custom container layouts including flow layouts, radial layouts, and animated transitions. Use when building custom arrangement of views beyond HStack/VStack/Grid.
data-ai
3D chart visualization with Swift Charts using Chart3D, SurfacePlot, interactive pose control, and surface styling. Use when creating 3D data visualizations.
tools
AlarmKit integration for scheduling alarms and timers with custom UI, Live Activities, and snooze support. Use when implementing alarm or timer features in iOS 18+ apps.
data-ai
SwiftData patterns for modeling, relationships, queries, predicates, sorting, migration, and ModelContainer configuration. Use when working with SwiftData persistence.