Read, write, and query Apple Health data using HealthKit. Covers HKHealthStore authorization, sample queries, statistics queries, statistics collection queries for charts, saving HKQuantitySample data, background delivery, workout sessions with HKWorkoutSession and HKLiveWorkoutBuilder, HKUnit, and HKQuantityTypeIdentifier values.
SkillScore100Maintained
Automatic
◆Coding pack
Last verified 8/14/2026
What it changes
Passed 22 of 22 test cases with the skill, and 18 of 22 without it.
Without skill82%
With skill100%
Checks it passed that the model alone missed
Calls enableBackgroundDelivery using Swift async/await
Wraps the predicate using HKSamplePredicate.quantitySample
and 2 more in the full report
4 fixed18 passed either way0 still failing0 broke
Pass-rate lift
+18 pp
Tokens
+130%
Agent turns
0%
Response time
-37%
Model gemini-3.6-flashMeasured 8/14/2026v122 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 4 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 4
Prompt
I'm building an iOS health dashboard and need to fetch the user's daily heart rate averages for the past 7 days. Can you write a Swift function using modern HealthKit async/await APIs that accepts a start and end date and returns a list of daily average heart rate values?
What was checked, without and with the skill
Checked
Without skill
With skill
Wraps the predicate using HKSamplePredicate.quantitySample
Missed
Passed
Uses HKQuantityType(.heartRate) shorthand syntax to specify the quantity type
Missed
Passed
Specifies discreteAverage as the statistics option
Passed
Passed
case-01 · gemini-3.6-flash · 8/14/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md436 lines2 files
HealthKit
Read and write health and fitness data from the Apple Health store. Covers authorization, queries, writing samples, background delivery, and workout sessions. Targets Swift 6.3 / iOS 26+.
Enable the HealthKit capability in Xcode (adds the entitlement)
Add NSHealthShareUsageDescription (read) and NSHealthUpdateUsageDescription (write) to Info.plist
For background delivery, enable the "Background Delivery" sub-capability
Availability Check
Always check availability before calling other HealthKit APIs. Health data is
available on iOS, watchOS, visionOS, iPadOS 17+, and iOS apps running on
Vision Pro. It is unavailable on iPadOS 16 or earlier and may be restricted by
managed device policy.
import HealthKit
guard HKHealthStore.isHealthDataAvailable() else {
// Health data is unavailable or restricted on this device.