원클릭으로
nightscout-cgm
// Analyze CGM blood glucose data from Nightscout. Use this skill when asked about current glucose levels, blood sugar trends, A1C estimates, time-in-range statistics, glucose variability, or diabetes management insights.
// Analyze CGM blood glucose data from Nightscout. Use this skill when asked about current glucose levels, blood sugar trends, A1C estimates, time-in-range statistics, glucose variability, or diabetes management insights.
| name | nightscout-cgm |
| description | Analyze CGM blood glucose data from Nightscout. Use this skill when asked about current glucose levels, blood sugar trends, A1C estimates, time-in-range statistics, glucose variability, or diabetes management insights. |
This skill provides tools for fetching and analyzing Continuous Glucose Monitor (CGM) data from Nightscout.
Always run tests before and after modifying cgm.py:
cd <skill-path>
python -m pytest tests/ -q # Quick check (255+ tests)
python -m pytest tests/ --cov=scripts # With coverage
Run the cgm.py script from this skill's scripts/ directory:
python <skill-path>/scripts/cgm.py <command> [options]
Where <skill-path> is the location where this skill is installed (e.g., ~/.copilot/skills/nightscout-cgm, .github/skills/nightscout-cgm, or .claude/skills/nightscout-cgm).
| Command | Description |
|---|---|
current | Get the latest glucose reading |
analyze [--days N] | Analyze CGM data (default: 90 days) |
report [--days N] [--open] | Generate interactive HTML report with charts |
compare --period1 P1 --period2 P2 | Compare two time periods side-by-side |
alerts [--days N] | Get trend alerts for recurring patterns |
refresh [--days N] | Fetch latest data from Nightscout |
patterns [--days N] | Find interesting patterns (best/worst times, problem areas) |
query [options] | Query with filters (day of week, time range) |
day <date> [options] | View all readings for a specific date |
worst [options] | Find your worst days for glucose control |
chart [options] | Terminal visualizations (heatmap, sparkline, day chart) |
pump | Get current pump status (IOB, COB, predicted glucose) * |
treatments [--hours N] | Get recent treatments (boluses, temp basals, carbs) * |
profile | Get pump profile settings (basal rates, ISF, carb ratios) * |
* Pump commands require Loop, OpenAPS, or similar closed-loop system. The skill auto-detects pump capabilities on first use. CGM-only users won't see errors—commands simply report that pump data isn't available.
Generate a comprehensive, self-contained HTML report with interactive charts:
--days N - Number of days to include (default: 90)--output PATH - Custom output path (default: nightscout_report.html)--open - Open report in browser after generatingAuto-Sync: Reports automatically sync from Nightscout if local data is more than 30 minutes old.
Report Features:
View detailed readings for a specific date:
day <date> - Date can be 'today', 'yesterday', '2026-01-16', or 'Jan 16'--hour-start H - Start hour for time window (0-23)--hour-end H - End hour for time window (0-23)Find your worst days ranked by peak glucose:
--days N - Number of days to search (default: 21)--hour-start H - Start hour for time window (0-23)--hour-end H - End hour for time window (0-23)--limit N - Number of worst days to show (default: 5)The query command supports flexible filtering:
--days N - Number of days to analyze (default: 90)--day NAME - Filter by day of week (e.g., Tuesday, or 0-6 where 0=Monday)--hour-start H - Start hour for time window (0-23)--hour-end H - End hour for time window (0-23)The chart command creates terminal visualizations:
--sparkline - Compact trend line using Unicode blocks (▁▂▃▄▅▆▇█)--hours N - Hours of data for sparkline (default: 24)--date DATE - Specific date for sparkline (e.g., today, yesterday, 2026-01-16)--hour-start H - Start hour for sparkline time window (0-23)--hour-end H - End hour for sparkline time window (0-23)--heatmap - Weekly grid showing time-in-range by day and hour--day NAME - Hourly breakdown for a specific day of week--color - Use ANSI colors (for direct terminal, not inside Copilot)These commands require a closed-loop system (Loop, OpenAPS, AndroidAPS, etc.) uploading to Nightscout. The skill auto-detects pump capabilities—CGM-only users won't be bothered with errors.
pump - Get current pump/loop status:
treatments [--hours N] - Get recent treatments:
profile - Get pump profile settings:
# Get current glucose
python scripts/cgm.py current
# Generate interactive HTML report (opens in browser)
python scripts/cgm.py report --days 90 --open
# Analyze last 30 days
python scripts/cgm.py analyze --days 30
# Find patterns automatically (best/worst times, problem areas)
python scripts/cgm.py patterns
# What happened yesterday during lunch (11am-2pm)?
python scripts/cgm.py day yesterday --hour-start 11 --hour-end 14
# Find my worst lunch days in the last 3 weeks
python scripts/cgm.py worst --days 21 --hour-start 11 --hour-end 14
# What happens on Tuesdays after lunch?
python scripts/cgm.py query --day Tuesday --hour-start 12 --hour-end 15
# How are my overnight numbers on weekends?
python scripts/cgm.py query --day Saturday --hour-start 22 --hour-end 6
python scripts/cgm.py query --day Sunday --hour-start 22 --hour-end 6
# Morning analysis across all days
python scripts/cgm.py query --hour-start 6 --hour-end 10
# Show sparkline of last 24 hours (compact visual trend)
python scripts/cgm.py chart --sparkline --hours 24
# Show sparkline for a specific date and time range (with colors)
python scripts/cgm.py chart --date yesterday --hour-start 11 --hour-end 15 --color
# Show heatmap of time-in-range by day/hour
python scripts/cgm.py chart --heatmap
# Show hourly breakdown for a specific day
python scripts/cgm.py chart --day Saturday
# Generate interactive HTML report (opens in browser)
python scripts/cgm.py report --days 90 --open
# Compare two time periods
python scripts/cgm.py compare --period1 "last 7 days" --period2 "previous 7 days"
python scripts/cgm.py compare --period1 "this week" --period2 "last week"
# Get trend alerts (recurring patterns)
python scripts/cgm.py alerts --days 30
# Refresh data from Nightscout
python scripts/cgm.py refresh
With the pattern analysis capabilities, you can ask natural questions like:
Set the NIGHTSCOUT_URL environment variable to your Nightscout API endpoint:
# Linux/macOS
export NIGHTSCOUT_URL="https://your-nightscout-site.com/api/v1/entries.json"
# Windows PowerShell
$env:NIGHTSCOUT_URL = "https://your-nightscout-site.com/api/v1/entries.json"
# Windows (persistent)
[Environment]::SetEnvironmentVariable("NIGHTSCOUT_URL", "https://your-nightscout-site.com/api/v1/entries.json", "User")
The script will not run without this environment variable configured.