healthkit · dpearson2699 — Claude Code skill: what it does, how to install
This skill guides AI agents through reading, writing, and querying Apple Health data via HealthKit in Swift. Use it for workout flows, health metric charts, and background updates.
npx skills add dpearson2699/swift-ios-skills --skill healthkit -a claude-codeWhat healthkit does
The skill outlines workflows for Apple HealthKit targeting Swift 6.3 and iOS 26+. It guides the setup of a single HKHealthStore instance and enforces initial checks with HKHealthStore.isHealthDataAvailable(). This check prevents crashes on unsupported hardware like iPadOS 16 or earlier.
Inside, it emphasizes modern async/await descriptors rather than legacy callbacks. For one-off sample reads it applies HKSampleQueryDescriptor, while aggregated totals use HKStatisticsQueryDescriptor. When building chart series, it configures HKStatisticsCollectionQueryDescriptor with custom date anchors and intervals.
Xcode setup requires enabling the HealthKit capability alongside NSHealthShareUsageDescription and NSHealthUpdateUsageDescription keys in Info.plist. Because HealthKit conceals whether read permission was denied, queries silently return empty results if access was withheld, making permission debugging easy to misinterpret.
What it helps with
- configure
HKHealthStorepermissions without requesting redundant types - fetch recent heart rate samples using
HKSampleQueryDescriptor - calculate daily step counts with
HKStatisticsQueryDescriptor - group activity metrics into time intervals for charts
Example prompts for the agent
- Write a Swift function to fetch today's total steps using HKStatisticsQueryDescriptor
- How do I fetch the 20 most recent heart rate samples using HKSampleQueryDescriptor?
- Show how to check HealthKit availability and request read and write permissions
How to install healthkit
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill healthkit -a claude-code2Manually: put the files in place
~/.claude/skills/healthkit/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/healthkit/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill healthkit -a codex2Manually: put the files in place
.agents/skills/healthkit/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill healthkit -a cursor2Manually: put the files in place
.cursor/skills/healthkit/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dpearson2699/swift-ios-skills healthkit2Manually: put the files in place
.github/skills/healthkit/SKILL.md1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill healthkit -a gemini-cli2Platform CLI
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/healthkitManually: put the files in place
.devin/skills/healthkit/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill healthkit -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about healthkit
How to install healthkit in Claude Code?
Run npx skills add dpearson2699/swift-ios-skills --skill healthkit -a claude-code in your terminal.
What does the healthkit skill do?
It teaches the agent how to implement HealthKit features in Swift, including authorization, background delivery, and sample query descriptors.
Can an app detect if read access was denied?
No, HealthKit hides read denial to protect user privacy. When access is denied, queries simply yield empty results or only samples created by your app.
Similar skills
Everything for Mobile →healthkit by other authors comes first.