Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dpearson2699/swift-ios-skills --skill healthkit -a claude-code
Open on GitHub

What 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 HKHealthStore permissions 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-code

2Manually: put the files in place

~/.claude/skills/healthkit/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/healthkit/

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.

From the same set69

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor