Garmin health analysis skills for clawdbot

Two clawdbot skills: one sets up Garmin data sync, another queries your health metrics.

Author Unknown
Namespace
Category general
Version
Stars 0
Downloads 0
Table of content

Two skills for working with Garmin data:

  1. garmin-grafana-setup — one-time setup for data collection
  2. health-analyst — queries your synced health data

Save each definition to .claude/skills/[skill-name]/index.md to activate.

Skill 1: garmin-grafana-setup

Sets up a local Grafana dashboard that syncs with your Garmin Connect account. Uses Docker.

Skill definition

---
name: garmin-grafana-setup
description: Performs a quick setup of the Garmin to Grafana dashboard.
---

# Quick Garmin to Grafana Setup

This skill clones the `garmin-grafana` project and runs its installation script.
**Requires:** Docker and Docker Compose.

## Process

1.  **Clone repository:**

        git clone https://github.com/arpanghosh8453/garmin-grafana.git ./garmin-grafana-data

2.  **Run installer:**
    The script will prompt for your Garmin Connect credentials.

        cd garmin-grafana-data && ./install.sh

3.  **Access:**
    Your dashboard will be at http://localhost:3000 (user: admin, pass: admin).

## Usage

    /skill garmin-grafana-setup

Skill 2: health-analyst

After setup, use this skill to query your data. It translates questions into InfluxDB queries.

Usage

/skill health-analyst "What was my average resting heart rate last month?"
/skill health-analyst "Show me my daily sleep scores for the last week"
/skill health-analyst "Correlate my sleep score with my average stress for the last 30 days"

Skill definition

---
name: health-analyst
description: Analyzes Garmin health data from the local InfluxDB database. Answers questions about heart rate, sleep, stress, and finds correlations.
---

# Health Data Analyst

This skill queries the `garmin` InfluxDB database populated by the `garmin-grafana` project to analyze health metrics and find correlations.

## Process

### Step 1: Understand the User's Question

Analyze the user's request to identify:
-   **Metric:** What health data are they asking about? (e.g., heart rate, sleep, stress, steps).
-   **Time Range:** What period are they interested in? (e.g., "yesterday", "last week", "last 30 days"). Default to 7 days if not specified.
-   **Analysis Type:** What kind of analysis? (e.g., average, summary, trend, correlation).

### Step 2: Map Metrics to InfluxDB Measurements

Use this table to map user terms to InfluxDB measurements and fields.

| User Term | InfluxDB Measurement | Field | Unit |
|---|---|---|---|
| Heart Rate | `garmin_hr_data` | `heart_rate` | bpm |
| Resting HR | `garmin_daily_summary`| `resting_hr` | bpm |
| Steps | `garmin_steps_data` | `steps` | count |
| Stress | `garmin_stress_data` | `stress_level`| 0-100 |
| Body Battery| `garmin_body_battery_data`| `body_battery`| 0-100 |
| Sleep Score| `garmin_sleep_score` | `overall_score`| 0-100 |
| Sleep Duration|`garmin_sleep_data` | `duration_in_seconds`| seconds |

### Step 3: Construct the InfluxQL Query

Based on the user's question, construct an InfluxQL query. Use `curl` to execute it against the local InfluxDB instance.

**Base URL:** `http://localhost:8086/query`
**Database:** `garmin`

**Query Templates:**

**Average value over time:**

    curl -G 'http://localhost:8086/query' --data-urlencode "db=garmin" --data-urlencode "q=SELECT mean(\"{field}\") FROM \"{measurement}\" WHERE time > now() - {time_range}"

*Example: Average heart rate over last 3 days*

    curl -G 'http://localhost:8086/query' --data-urlencode "db=garmin" --data-urlencode "q=SELECT mean(\"heart_rate\") FROM \"garmin_hr_data\" WHERE time > now() - 3d"

**Daily summary over time:**

    curl -G 'http://localhost:8086/query' --data-urlencode "db=garmin" --data-urlencode "q=SELECT mean(\"{field}\") FROM \"{measurement}\" WHERE time > now() - {time_range} GROUP BY time(1d) fill(none)"

*Example: Daily average stress over the last week*

    curl -G 'http://localhost:8086/query' --data-urlencode "db=garmin" --data-urlencode "q=SELECT mean(\"stress_level\") FROM \"garmin_stress_data\" WHERE time > now() - 7d GROUP BY time(1d) fill(none)"


**Correlation Query (Advanced):**
To correlate two metrics, you need to query both and analyze the results. This is hard in pure shell. A better approach is to use a script, but for this skill, we can retrieve two data series and present them together.

*Example: Correlate daily sleep score and daily average stress for the last 14 days.*

1.  **Get Sleep Data:**

        curl -G 'http://localhost:8086/query' --data-urlencode "db=garmin" --data-urlencode "q=SELECT mean(\"overall_score\") as sleep_score FROM \"garmin_sleep_score\" WHERE time > now() - 14d GROUP BY time(1d)" > /tmp/sleep_data.json

2.  **Get Stress Data:**

        curl -G 'http://localhost:8086/query' --data-urlencode "db=garmin" --data-urlencode "q=SELECT mean(\"stress_level\") as stress FROM \"garmin_stress_data\" WHERE time > now() - 14d GROUP BY time(1d)" > /tmp/stress_data.json

3.  **Analyze and Present:** (This part requires more advanced logic, for now, we will just present the raw data together).
    "Here is the data for the last 14 days. You can look for patterns:"
    (Present a table based on the JSON outputs).

### Step 4: Summarize and Respond

Parse the JSON output from `curl`. It will look like this:

    {
        "results": [
            {
                "series": [
                    {
                        "name": "garmin_hr_data",
                        "columns": [
                            "time",
                            "mean"
                        ],
                        "values": [
                            [
                                "2023-10-27T00:00:00Z",
                                65.4
                            ]
                        ]
                    }
                ]
            }
        ]
    }


Extract the value and present it to the user in a human-readable format.

"Your average heart rate over the last 3 days was 65 bpm."

"Here are your daily average stress levels for the last week:
- Monday: 35
- Tuesday: 42
- ..."

## Adding external data

You can correlate health metrics with weather, calendar events, or other data:

1. Fetch external data (weather API, calendar export)
2. Save to temp file
3. Query both and compare

Example: does rain affect stress?
- Get stress data from InfluxDB
- Get rainfall from weather API
- Plot both series