healthkit

Read, write, and query HealthKit data with authorization and workout sessions.

Updated Apr 19, 2026
One-click install
npx skills add https://github.com/femitz/flyby --skill healthkit-femitz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: healthkit
Source: https://github.com/femitz/flyby/tree/main/.agents/skills/healthkit
Command: npx skills add https://github.com/femitz/flyby --skill healthkit-femitz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Apple Health data integration is complex due to the need for proper authorization, consistent read/write access, and robust querying and update patterns. This skill consolidates HealthKit usage into a cohesive guide that helps developers implement authorization, sample and statistics queries, background delivery, and workout session management in Swift.

Core Features & Use Cases

  • Authorization workflow: request access to common data types like stepCount, heartRate, and more.
  • Data access patterns: support for sample queries, statistics queries, and time-series data for charts.
  • Background delivery and workouts: enable background updates and manage live workouts with HKWorkoutSession and HKLiveWorkoutBuilder.

Quick Start

Provide a Swift HealthKit integration plan covering authorization, data queries, background delivery, and workout session setup for a Swift app.

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 to read and write health data in Swift?

To request HealthKit authorization in Swift, you configure HKHealthStore and request access to specific data types like stepCount and heartRate using HKQuantityTypeIdentifiers. This establishes the necessary permissions for your app to securely read and write health data.

What's the best way to query HealthKit data for displaying charts in an iOS app?

The best way to query HealthKit data for charts is using statistics queries and sample queries. These query patterns allow you to aggregate time-series health data efficiently, enabling your Swift app to render accurate visual representations of the user's health metrics.

Can I use HKWorkoutSession and HKLiveWorkoutBuilder to track live workouts in the background?

Yes, you can use HKWorkoutSession and HKLiveWorkoutBuilder to track live workouts in the background. These components enable your Swift app to manage active workout sessions and record real-time health data updates while running in the background.

How does background delivery work with HealthKit for automatic data updates?

Background delivery in HealthKit works by registering observers on HKHealthStore that wake your app up when new health data is available. This allows your Swift app to process incoming health data and execute update logic automatically without requiring user interaction.

Why do I need to use HKUnit and HKQuantityTypeIdentifiers when accessing health data?

You need to use HKUnit and HKQuantityTypeIdentifiers to enforce safe data access patterns in HealthKit. They ensure that health data queries and writes are type-safe and consistently formatted, preventing errors when reading or writing measurements like heart rate and step count.