Builds HealthKit authorization, sample reads/writes, statistics, background delivery, and workout sessions. Use for Apple Health metrics, charts, HKQuantitySample storage, HKLiveWorkoutBuilder, unit handling, workout recording, or health-data delivery and privacy behavior.
85%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Access, query, and store health and fitness metrics in Apple Health using HealthKit. Covers authorization, quantity samples, statistics collection queries, background delivery, and workout sessions. Targets Swift 6.4 / iOS 26+.
Enable HealthKit in Signing & Capabilities. If your app observes updates in the background, enable the Background Delivery checkbox.
Declare usage descriptions in Info.plist:
NSHealthShareUsageDescription: Required for reading health data.NSHealthUpdateUsageDescription: Required for writing health data.NSHealthClinicalHealthRecordsShareUsageDescription: Required if accessing clinical records.[!IMPORTANT] Request only the exact types needed for the immediate feature. App Review strictly rejects apps requesting unneeded health permissions.
Always guard initialization with HKHealthStore.isHealthDataAvailable(). HealthKit is supported on iPhone, Apple Watch, iPad (iPadOS 17+), and Vision Pro, but unavailable on iPadOS 16 or earlier and managed devices with restrictions.
guard HKHealthStore.isHealthDataAvailable() else { return }
let healthStore = HKHealthStore() // Single thread-safe shared store| Query Type | Best Used For | Execution |
|---|---|---|
HKSampleQueryDescriptor | Raw individual samples with sorting and limits | One-shot async |
HKStatisticsQueryDescriptor | Single aggregate metric (sum, average, min/max) over a date range | One-shot async |
HKStatisticsCollectionQueryDescriptor | Time-series aggregations (daily step charts, hourly heart rate) | One-shot or continuous |
HKAnchoredObjectQueryDescriptor | Incremental synchronization with anchor tokens | One-shot or streaming |
HKObserverQuery | Background delivery triggers when health data changes | Background notification |
Always specify compatible HKUnits matching the quantity type. For cumulative metrics (steps, active energy), set start and end dates encompassing the measurement interval; for discrete metrics (heart rate), use identical start and end dates.
enableBackgroundDelivery, read Background Delivery.HKWorkoutSession and HKLiveWorkoutBuilder, read Live Workout Sessions.HKCategoryTypeIdentifierMenopausalState (menopause, perimenopause, none) and HKCategoryTypeIdentifierBleedingAfterMenopause (unspecified, light, medium, heavy). Both are read/write, fall under Reproductive Health, and use standard category authorization.Sources: https://sosumi.ai/documentation/ios-ipados-release-notes/ios-ipados-27-release-notes
HKHealthStore.isHealthDataAvailable().NSHealthShareUsageDescription or NSHealthUpdateUsageDescription, causing immediate crash on launch.HKHealthStore instances instead of sharing a single instance across the app..meter() instead of .count()).HKHealthStore.isHealthDataAvailable() checked before accessing storeHKQuantityType dimensionenableBackgroundDelivery(for:frequency:)thienqo/ios-skills
6bf8b62
Canonical home
since May 23, 2026
Also appears in
on Oct 29, 2026
since May 22, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.