Garmin Health Analysis
Query health metrics from Garmin Connect and generate interactive HTML charts.
Two Installation Paths
This skill supports two different setups:
- 1. Clawdbot Skill (this guide) - Use with Clawdbot for automation and proactive health monitoring
- MCP Server (see MCP setup guide) - Use with standard Claude Desktop as an MCP server
Choose the path that matches your use case. You can also use both simultaneously!
Clawdbot Skill Setup (first time only)
1. Install Dependencies
CODEBLOCK0
2. Configure Credentials
You have three options to provide your Garmin Connect credentials:
Option A: Clawdbot Config (Recommended - UI configurable)
Add credentials to ~/.clawdbot/clawdbot.json:
CODEBLOCK1
Tip: You can also set these through the Clawdbot UI in the Skills settings panel.
Option B: Local Config File
Create a config file in the skill directory:
CODEBLOCK2
config.json:
CODEBLOCK3
Note: config.json is gitignored to keep your credentials secure.
Option C: Command Line
Pass credentials directly when authenticating:
CODEBLOCK4
3. Authenticate
Login to Garmin Connect and save session tokens:
CODEBLOCK5
This uses credentials from (in priority order):
- 1. Command line arguments (
--email, --password) - Local config file (
config.json) - Environment variables (
GARMIN_EMAIL, GARMIN_PASSWORD) - Clawdbot config (
skills.entries.garmin-health-analysis.env)
Session tokens are stored in ~/.clawdbot/garmin-tokens.json and auto-refresh.
Check authentication status:
CODEBLOCK6
Fetching Data
Use scripts/garmin_data.py to get JSON data:
CODEBLOCK7
Output is JSON to stdout. Parse it to answer user questions.
Generating Charts
Use scripts/garmin_chart.py for interactive HTML visualizations:
CODEBLOCK8
Charts open automatically in the default browser. They use Chart.js with a modern gradient design, stat cards, and interactive tooltips.
Answering Questions
| User asks | Action |
|---|
| "How did I sleep last night?" | INLINECODE11 , report sleep hours + score |
| "How's my recovery this week?" |
garmin_data.py body_battery --days 7, report average + trend |
| "Show me my health for the last month" |
garmin_chart.py dashboard --days 30 |
| "Is my HRV improving?" |
garmin_data.py hrv --days 30, analyze trend |
| "What workouts did I do this week?" |
garmin_data.py activities --days 7, list activities with details |
| "How's my resting heart rate?" |
garmin_data.py heart_rate --days 7, report average + trend |
Key Metrics
Body Battery (0-100)
Garmin's proprietary recovery metric based on HRV, stress, sleep, and activity:
- - High (75-100): Fully recharged, ready for high intensity
- Medium (50-74): Moderate energy, good for regular activity
- Low (25-49): Limited energy, recovery needed
- Very Low (0-24): Depleted, prioritize rest
Sleep Scores (0-100)
Overall sleep quality based on duration, stages, and disturbances:
- - Excellent (90-100): Optimal restorative sleep
- Good (80-89): Quality sleep with minor issues
- Fair (60-79): Adequate but could improve
- Poor (0-59): Significant sleep deficiencies
HRV (Heart Rate Variability)
Measured in milliseconds, higher is generally better:
- - Indicates nervous system balance and recovery capacity
- Track trends over time (increasing = improving recovery)
- Affected by sleep, stress, training load, illness
- Normal range varies by individual (20-200+ ms)
Resting Heart Rate (bpm)
Lower generally indicates better cardiovascular fitness:
- - Athletes: 40-60 bpm
- Fit adults: 60-70 bpm
- Average adults: 70-80 bpm
- Sudden increases may indicate stress, illness, or overtraining
Stress Levels
Based on HRV analysis throughout the day:
- - Low stress: Rest and recovery periods
- Medium stress: Normal daily activities
- High stress: Physical activity or mental pressure
Health Analysis
When users ask for insights or want to understand their trends, use references/health_analysis.md for:
- - Science-backed interpretation of all metrics
- Normal ranges by age and fitness level
- Pattern detection (weekly trends, recovery cycles, training load balance)
- Actionable recommendations based on data
- Warning signs that suggest rest or medical consultation
Analysis workflow
- 1. Fetch data: INLINECODE18
- Read
references/health_analysis.md for interpretation framework - Apply the analysis framework: Status → Trends → Patterns → Insights → Recommendations
- Always include disclaimer that this is informational, not medical advice
Troubleshooting
Authentication Issues
- - "Invalid credentials": Double-check email/password, try logging into Garmin Connect web
- "Tokens expired": Run login again: INLINECODE20
- "Too many requests": Garmin rate-limits; wait a few minutes and try again
Missing Data
- - Some metrics require specific Garmin devices (Body Battery needs HRV-capable devices)
- Historical data may have gaps if device wasn't worn
- New accounts may have limited history
Library Issues
- - If
garminconnect import fails: INLINECODE22 - Garmin occasionally changes their API; update the library if requests fail
Privacy Note
- - Credentials are stored locally in INLINECODE23
- Session tokens refresh automatically
- No data is sent anywhere except to Garmin's official servers
- You can revoke access anytime by deleting the tokens file
Comparison: Garmin vs Whoop
| Feature | Garmin | Whoop |
|---|
| Recovery metric | Body Battery (0-100) | Recovery Score (0-100%) |
| HRV tracking |
Yes (nightly average) | Yes (detailed) |
|
Sleep stages | Light, Deep, REM, Awake | Light, SWS, REM, Awake |
|
Activity tracking | Built-in GPS, many sport modes | Strain score (0-21) |
|
Stress | All-day stress levels | Not directly tracked |
|
API | Unofficial (garminconnect) | Official OAuth |
|
Device types | Watches, fitness trackers | Wearable band only |
References
- -
references/api.md — Garmin Connect API details (unofficial) - INLINECODE25 — Science-backed health data interpretation
- garminconnect library — Python API wrapper
- Garmin Connect — Official web interface
Version Info
- - Created: 2026-01-25
- Author: EversonL & Claude
- Version: 1.2.0
- Dependencies: garminconnect, fitparse, gpxpy (Python libraries)
- License: MIT
Garmin 健康分析
从 Garmin Connect 查询健康指标并生成交互式 HTML 图表。
两种安装路径
本技能支持两种不同的设置方式:
- 1. Clawdbot 技能(本指南)—— 与 Clawdbot 配合使用,实现自动化和主动健康监测
- MCP 服务器(查看 MCP 设置指南)—— 作为 MCP 服务器与标准 Claude Desktop 配合使用
选择符合您使用场景的路径。您也可以同时使用两者!
Clawdbot 技能设置(仅首次)
1. 安装依赖
bash
pip3 install garminconnect
2. 配置凭据
您有三种方式提供 Garmin Connect 凭据:
选项 A:Clawdbot 配置(推荐 - 可通过 UI 配置)
将凭据添加到 ~/.clawdbot/clawdbot.json:
json
{
skills: {
entries: {
garmin-health-analysis: {
enabled: true,
env: {
GARMIN_EMAIL: your-email@example.com,
GARMIN_PASSWORD: your-password
}
}
}
}
}
提示:您也可以在 Clawdbot UI 的技能设置面板中进行设置。
选项 B:本地配置文件
在技能目录中创建配置文件:
bash
cd ~/.clawdbot/skills/garmin-health-analysis
或:cd /skills/garmin-health-analysis
cp config.example.json config.json
编辑 config.json 并添加您的邮箱和密码
config.json:
json
{
email: your-email@example.com,
password: your-password
}
注意:config.json 已被 gitignore 忽略,以确保您的凭据安全。
选项 C:命令行
在认证时直接传递凭据:
bash
python3 scripts/garmin_auth.py login \
--email YOUR_EMAIL@example.com \
--password YOUR_PASSWORD
3. 认证
登录 Garmin Connect 并保存会话令牌:
bash
python3 scripts/garmin_auth.py login
此命令按优先级顺序使用以下来源的凭据:
- 1. 命令行参数(--email、--password)
- 本地配置文件(config.json)
- 环境变量(GARMINEMAIL、GARMINPASSWORD)
- Clawdbot 配置(skills.entries.garmin-health-analysis.env)
会话令牌存储在 ~/.clawdbot/garmin-tokens.json 中,并会自动刷新。
检查认证状态:
bash
python3 scripts/garmin_auth.py status
获取数据
使用 scripts/garmin_data.py 获取 JSON 数据:
bash
睡眠(默认最近 7 天)
python3 scripts/garmin_data.py sleep --days 14
身体电量(Garmin 的恢复指标)
python3 scripts/garmin
data.py bodybattery --days 30
HRV 数据
python3 scripts/garmin_data.py hrv --days 30
心率(静息、最大、最小)
python3 scripts/garmin
data.py heartrate --days 7
活动/锻炼
python3 scripts/garmin_data.py activities --days 30
压力水平
python3 scripts/garmin_data.py stress --days 7
包含平均值的综合摘要
python3 scripts/garmin_data.py summary --days 7
自定义日期范围
python3 scripts/garmin_data.py sleep --start 2026-01-01 --end 2026-01-15
用户资料
python3 scripts/garmin_data.py profile
输出为 JSON 格式到标准输出。解析后用于回答用户问题。
生成图表
使用 scripts/garmin_chart.py 生成交互式 HTML 可视化图表:
bash
睡眠分析(时长 + 评分)
python3 scripts/garmin_chart.py sleep --days 30
身体电量恢复图表(颜色编码)
python3 scripts/garmin
chart.py bodybattery --days 30
HRV 和静息心率趋势
python3 scripts/garmin_chart.py hrv --days 90
活动摘要(按类型、卡路里)
python3 scripts/garmin_chart.py activities --days 30
完整仪表盘(全部 4 个图表)
python3 scripts/garmin_chart.py dashboard --days 30
保存到指定文件
python3 scripts/garmin_chart.py dashboard --days 90 --output ~/Desktop/garmin-health.html
图表会自动在默认浏览器中打开。它们使用 Chart.js 实现现代渐变设计、统计卡片和交互式提示框。
回答问题
| 用户提问 | 操作 |
|---|
| 我昨晚睡得怎么样? | garmindata.py summary --days 1,报告睡眠时长和评分 |
| 我这周的恢复情况如何? |
garmindata.py body_battery --days 7,报告平均值和趋势 |
| 给我看看我上个月的健康状况 | garmin_chart.py dashboard --days 30 |
| 我的 HRV 在改善吗? | garmin_data.py hrv --days 30,分析趋势 |
| 我这周做了哪些锻炼? | garmin_data.py activities --days 7,列出活动详情 |
| 我的静息心率怎么样? | garmin
data.py heartrate --days 7,报告平均值和趋势 |
关键指标
身体电量(0-100)
Garmin 基于 HRV、压力、睡眠和活动的专有恢复指标:
- - 高(75-100):完全充电,适合高强度活动
- 中(50-74):中等能量,适合常规活动
- 低(25-49):能量有限,需要恢复
- 极低(0-24):能量耗尽,优先休息
睡眠评分(0-100)
基于时长、阶段和干扰的整体睡眠质量:
- - 优秀(90-100):最佳恢复性睡眠
- 良好(80-89):质量良好,有小问题
- 一般(60-79):尚可,但可以改善
- 差(0-59):睡眠严重不足
HRV(心率变异性)
以毫秒为单位测量,通常越高越好:
- - 反映神经系统平衡和恢复能力
- 跟踪趋势(上升 = 恢复能力改善)
- 受睡眠、压力、训练负荷、疾病影响
- 正常范围因人而异(20-200+ 毫秒)
静息心率(bpm)
通常越低表示心血管健康越好:
- - 运动员:40-60 bpm
- 健康成人:60-70 bpm
- 普通成人:70-80 bpm
- 突然升高可能表示压力、疾病或过度训练
压力水平
基于全天 HRV 分析:
- - 低压:休息和恢复期
- 中压:正常日常活动
- 高压:体力活动或精神压力
健康分析
当用户寻求见解或想了解其趋势时,请使用 references/health_analysis.md 获取:
- - 所有指标的科学解读
- 按年龄和健康水平的正常范围
- 模式检测(周趋势、恢复周期、训练负荷平衡)
- 基于数据的可操作建议
- 提示需要休息或就医的警示信号
分析工作流程
- 1. 获取数据:python3 scripts/garmindata.py summary --days N
- 阅读 references/healthanalysis.md 获取解读框架
- 应用分析框架:状态 → 趋势 → 模式 → 见解 → 建议
- 始终包含免责声明:此为信息参考,非医疗建议
故障排除
认证问题
- - 凭据无效:检查邮箱和密码,尝试登录 Garmin Connect 网页版
- 令牌已过期:重新运行登录:python3 scripts/garmin_auth.py login ...
- 请求过多:Garmin 有速率限制;等待几分钟后重试
数据缺失
- - 某些指标需要特定 Garmin 设备(身体电量需要支持 HRV 的设备)
- 如果未佩戴设备,历史数据可能存在空白
- 新账户的历史数据可能有限
库问题
- - 如果 garminconnect 导入失败:pip3 install --upgrade garminconnect
- Garmin 偶尔会更改其 API;如果请求失败,请更新库
隐私说明