healthkit

Read and write HealthKit data with authorization, queries, and background delivery.

Updated Jun 5, 2026
One-click install
npx skills add https://github.com/harshav167/build-ios-apps --skill healthkit-harshav167
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: healthkit
Source: https://github.com/harshav167/build-ios-apps/tree/main/skills/healthkit
Command: npx skills add https://github.com/harshav167/build-ios-apps --skill healthkit-harshav167

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Read and write health data from Apple HealthKit, enabling proper authorization, data queries, and reliable background delivery for workouts and analytics.

Core Features & Use Cases

  • HealthKit authorization management with HKHealthStore and user privacy considerations.
  • Reading data: samples, statistics, and time-series queries for dashboards and insights.
  • Writing data: saving health samples and updating workout metrics, including background delivery.
  • Workout sessions: manage HKWorkoutSession and HKLiveWorkoutBuilder, with patterns for multi-device mirroring and live data handling.
  • References and extended patterns to handle edge cases and platform availability.

Quick Start

Enable HealthKit in your app, request the necessary permissions, and perform a sample read or write to verify the workflow.

Frequently Asked Questions about healthkit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I request HealthKit authorization in Swift for reading and writing health data?

To request HealthKit authorization in Swift, initialize HKHealthStore, configure NSHealthShareUsageDescription and NSHealthUpdateUsageDescription, and request permissions for specific data types. Check HKHealthStore.isHealthDataAvailable() before requesting access to ensure proper authorization management.

How do I set up HealthKit background delivery for workout tracking on iOS?

HealthKit background delivery enables workout tracking updates when your app is not active. Use HKWorkoutSession and HKLiveWorkoutBuilder to manage live data handling, with availability-based gating to ensure proper background updates across iOS 17+ and iPadOS 17+ contexts.

Can I use HKLiveWorkoutBuilder for multi-device mirroring on Vision Pro?

HKLiveWorkoutBuilder supports multi-device mirroring patterns for live workout data handling. HealthKit availability-based gating ensures proper functionality across iOS 17+, iPadOS 17+, and Vision Pro contexts when managing workout sessions and live data updates.

What's the best way to query HealthKit statistics and time-series data for dashboards?

Query HealthKit statistics and time-series data using sample queries, statistics queries, and time-series queries. These methods enable reading health samples for dashboards and insights, with proper authorization status interpretation ensuring data access compliance.

Why does HealthKit authorization return denied status even after requesting permissions?

HealthKit authorization status interpretation depends on correct implementation of HKHealthStore requests and proper Info.plist usage descriptions. Ensure NSHealthShareUsageDescription and NSHealthUpdateUsageDescription are configured, and verify HKHealthStore.isHealthDataAvailable() returns true before requesting access.