一键导入
strava
Load and analyze Strava activities, stats, and workouts using the Strava API
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Load and analyze Strava activities, stats, and workouts using the Strava API
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | strava |
| description | Load and analyze Strava activities, stats, and workouts using the Strava API |
| homepage | https://developers.strava.com/ |
| metadata | {"clawdbot":{"emoji":"🏃","requires":{"bins":["curl"],"env":["STRAVA_ACCESS_TOKEN"]},"primaryEnv":"STRAVA_ACCESS_TOKEN"}} |
Interact with Strava to load activities, analyze workouts, and track fitness data.
Two options (in priority order):
STRAVA_ACCESS_TOKEN~/.config/strava/credentials.json with keys:
STRAVA_CLIENT_IDSTRAVA_CLIENT_SECRETSTRAVA_ACCESS_TOKEN (expires every 6h)STRAVA_REFRESH_TOKENAccess tokens expire every 6 hours. Refresh:
bash {baseDir}/scripts/refresh_token.sh
If a script returns a 401 error, run this first.
activities.sh — Recent Activitiesbash {baseDir}/scripts/activities.sh # last 14 days
bash {baseDir}/scripts/activities.sh --days 30
bash {baseDir}/scripts/activities.sh --days 7 --count 20
Output: date, sport type, name, distance, time, elevation, avg HR.
gear-mileage.sh — Bike & Shoe Mileagebash {baseDir}/scripts/gear-mileage.sh # scans 250 activities
bash {baseDir}/scripts/gear-mileage.sh --pages 10 # scan further back
Returns lifetime distance for all bikes (gear_id starts with b) and shoes (gear_id starts with g) in separate sections. Discovers gear via activity gear_id fields — requires activity:read_all scope only.
shoe-mileage.sh — Shoes Only (legacy)bash {baseDir}/scripts/shoe-mileage.sh # scans 250 activities
Shoes only. Use gear-mileage.sh for both bikes and shoes.
athlete-stats.sh — All-Time Totalsbash {baseDir}/scripts/athlete-stats.sh
Returns cumulative all-time and YTD totals for Run, Ride, Swim (activity count, distance, time, elevation).
For one-off queries, use Python directly (credentials auto-loaded):
import json, urllib.request, os
token = os.environ.get("STRAVA_ACCESS_TOKEN")
if not token:
path = os.path.expanduser("~/.config/strava/credentials.json")
if os.path.exists(path):
with open(path) as f:
token = json.load(f)["STRAVA_ACCESS_TOKEN"]
def strava(path):
req = urllib.request.Request(f"https://www.strava.com/api/v3{path}",
headers={"Authorization": f"Bearer {token}"})
with urllib.request.urlopen(req) as r:
return json.loads(r.read())
# Full activity detail
activity = strava("/activities/ACTIVITY_ID")
# Lap splits
laps = strava("/activities/ACTIVITY_ID/laps")
# Time-series streams (HR, pace, cadence, power, altitude)
streams = strava("/activities/ACTIVITY_ID/streams?keys=heartrate,velocity_smooth,cadence,watts,altitude")
# Athlete HR/power zones
zones = strava("/athlete/zones")
# Athlete profile
athlete = strava("/athlete")
# All-time stats
stats = strava(f"/athletes/{athlete['id']}/stats")
Activity objects include:
name, sport_type, start_date_localdistance (meters), moving_time (seconds), elapsed_time (seconds)total_elevation_gain (meters)average_speed, max_speed (m/s)average_heartrate, max_heartrate (bpm)average_watts, weighted_average_watts (if power meter)gear_id — gear used (shoes for runs, bike for rides)activity:read_all scope~/.config/strava/credentials.json