Health Data logo

Health Data

Community
glebis
health-data

Query Apple Health SQLite database for vitals, activity, sleep, and workouts. Supports Markdown, JSON, and FHIR R4 output formats. This skill should be used when analyzing health metrics, generating health reports, answering questions about fitness or sleep patterns, or exporting health data in standard formats.

Overview

Publisherglebis
Repositoryclaude-skills
Skill namehealth-data
Stars
379
Forks
56
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by glebis on GitHub. Read the source before you install it.

Installation

Install the Health Data AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/glebis/claude-skills.git /tmp/claude-skills
mkdir -p .claude/skills
cp -r /tmp/claude-skills/health-data .claude/skills/health-data
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Health Data in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Health Data on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Health Data is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Apple Health Data Query Skill

Query and analyze health data from the local SQLite database containing 6.3M+ records across 43 health metrics.

Database Location

~/data/health.db

Query Methods

1. Python Script (Recommended for Common Queries)

Use scripts/health_query.py for pre-built queries with automatic formatting:

bash
# Daily summary
python ~/.claude/skills/health-data/scripts/health_query.py --format markdown daily --date 2025-11-29

# Weekly trends
python ~/.claude/skills/health-data/scripts/health_query.py --format json weekly --weeks 4

# Sleep analysis
python ~/.claude/skills/health-data/scripts/health_query.py --format fhir sleep --days 7

# Latest vitals
python ~/.claude/skills/health-data/scripts/health_query.py vitals

# Activity rings
python ~/.claude/skills/health-data/scripts/health_query.py --format json activity --days 30

# Workout history
python ~/.claude/skills/health-data/scripts/health_query.py workouts --days 30 --type Running

# Custom SQL
python ~/.claude/skills/health-data/scripts/health_query.py --format json query "SELECT * FROM workouts LIMIT 5"

Output formats: markdown, json, fhir, ascii

2. Direct SQL (For Custom/Ad-hoc Queries)

For flexible queries, run SQL directly against the database. See references/schema.md for table structures and query templates.

bash
sqlite3 ~/data/health.db "SELECT AVG(value) FROM health_records WHERE record_type LIKE '%HeartRate%' AND start_date LIKE '2025-11%'"

Pre-built Queries

Daily Health Summary

Get today's key metrics:

bash
python ~/.claude/skills/health-data/scripts/health_query.py daily

Returns: steps, calories, heart rate (avg/min/max), exercise minutes, distance, activity ring status.

Weekly Trends

Compare week-over-week performance:

bash
python ~/.claude/skills/health-data/scripts/health_query.py weekly --weeks 4

Returns: average daily steps, resting HR, exercise minutes, workout count per week.

Sleep Analysis

Analyze sleep patterns:

bash
python ~/.claude/skills/health-data/scripts/health_query.py sleep --days 14

Returns: nightly duration, sleep stages (Core, Deep, REM), average sleep hours.

Latest Vitals

Get most recent vital readings:

bash
python ~/.claude/skills/health-data/scripts/health_query.py vitals

Returns: Heart Rate, HRV, Resting HR, Blood Oxygen, Respiratory Rate with timestamps.

Activity Rings

Track ring completion:

bash
python ~/.claude/skills/health-data/scripts/health_query.py activity --days 30

Returns: daily ring values/goals, completion percentages, perfect day count.

Workout History

Review exercise sessions:

bash
python ~/.claude/skills/health-data/scripts/health_query.py workouts --days 30 --type Running

Returns: workout type, duration, distance, calories, summary by type.

Output Formats

Markdown (default)

Human-readable tables and lists. Best for reports and summaries.

JSON

Structured data for programmatic use:

json
{
  "date": "2025-11-29",
  "metrics": {
    "steps": 8542,
    "active_calories": 450.5,
    "heart_rate": {"avg": 72.3, "min": 52, "max": 145}
  }
}

FHIR R4

Healthcare interoperability format. Outputs as FHIR Bundle with Observation resources using LOINC codes. See references/fhir_mappings.md for code mappings.

ASCII

Terminal-friendly output with bar charts and statistics:

============================================================
  DAILY SUMMARY - 2025-11-29
============================================================

METRICS
----------------------------------------
  steps                      2620
  active_calories           234.5
  heart_rate           avg:  67.5  min:  52  max: 108

ACTIVITY RINGS
----------------------------------------
  move       [███████░░░░░░░░░░░░░]  36.7% (238/650)
  exercise   [░░░░░░░░░░░░░░░░░░░░]   0.0% (0/35)
  stand      [████████████████████] 100.0% (10/10)

Common SQL Patterns

For ad-hoc queries, use these patterns from references/schema.md:

Heart rate by hour (circadian pattern):

sql
SELECT strftime('%H', start_date) as hour, ROUND(AVG(value), 1) as avg_hr
FROM health_records
WHERE record_type = 'HKQuantityTypeIdentifierHeartRate'
AND value BETWEEN 40 AND 200
GROUP BY hour ORDER BY hour;

Steps per day this month:

sql
SELECT DATE(start_date) as day, SUM(value) as steps
FROM health_records
WHERE record_type = 'HKQuantityTypeIdentifierStepCount'
AND start_date >= DATE('now', 'start of month')
GROUP BY day ORDER BY day;

Sleep quality (deep + REM hours):

sql
SELECT DATE(start_date) as night,
       ROUND(SUM(duration_minutes)/60.0, 1) as quality_hours
FROM sleep_sessions
WHERE sleep_stage IN ('Deep', 'REM')
GROUP BY night ORDER BY night DESC LIMIT 14;

Workout summary:

sql
SELECT REPLACE(workout_type, 'HKWorkoutActivityType', '') as type,
       COUNT(*) as count, ROUND(SUM(duration_minutes)) as total_min
FROM workouts
WHERE start_date >= DATE('now', '-30 days')
GROUP BY type ORDER BY count DESC;

Record Types Available

The database contains 43 health metric types including:

Vitals: Heart Rate, HRV, Resting HR, Blood Oxygen, Respiratory Rate, Blood Pressure

Activity: Steps, Distance, Active Calories, Basal Calories, Flights Climbed, Exercise Time, Stand Time

Mobility: Walking Speed, Step Length, Walking Asymmetry, Stair Speed, Walking Steadiness

Body: Weight, BMI, Body Fat %

Audio: Environmental Noise, Headphone Exposure

Other: VO2 Max, Time in Daylight, UV Exposure

Data Coverage

  • Records: 6.3M+ measurements
  • Date range: 2015-10-13 to present
  • Workouts: 1,435 sessions
  • Sleep sessions: 40,514 records
  • Activity days: 1,875 daily summaries

Resources

scripts/

  • health_query.py - Main query tool with Markdown/JSON/FHIR output

references/

  • schema.md - Database schema, record type mappings, SQL query templates
  • fhir_mappings.md - LOINC codes and FHIR R4 templates

Troubleshooting

Database not found: Ensure ~/data/health.db exists. Run the import script from /Users/server/apple_health_export/:

bash
python import_health.py --status

No data for date range: Check available date range:

sql
SELECT MIN(start_date), MAX(start_date) FROM health_records;

Outlier values: Filter physiologically valid ranges (e.g., heart rate 40-200 bpm):

sql
WHERE value BETWEEN 40 AND 200

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Health Data AI skill do?

Query Apple Health SQLite database for vitals, activity, sleep, and workouts. Supports Markdown, JSON, and FHIR R4 output formats. This skill should be used when analyzing health metrics, generating health reports, answering questions about fitness or sleep patterns, or exporting health data in standard formats.

Why use Health Data on TypingMind?

Because you install it once and use it with any model. Health Data is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Health Data in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/glebis/claude-skills/tree/main/health-data. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Health Data?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Health Data?

As many as you like. As long as a model supports skills, you can use Health Data with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Health Data AI skill free?

Yes. It is published on GitHub by glebis under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇