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 rshankras/claude-code-apple-skills 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.
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
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.