strava
Skill2 starsChanged 9 months agoMITView on GitHub
Query Strava fitness data including activities, stats, and athlete info. Use when the user asks about their Strava data, running or cycling activities, workout history, fitness stats, "how far did I run", "my cycling stats", "Strava activities", or wants to analyze exercise data from Strava.
- Reads credentials
2 other projects use a version of this.
Adopted by
Most recently taken up by
- rubengarciam/kaitheir own version, first seen Oct 20, 2026
- ai-ecoverse/skillstheir own version, first seen Oct 2, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- ai-ecoverse/skills★ 1same name
- rubengarciam/kai★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- garminSkill
- githubSkill
- listsSkill
- pagesSkill
- playwrightSkill
- plexSkill
- remindersSkill
- skill-creatorSkill
- summariseSkill
- twitterSkill
- zettelkastenSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
If not set, walk the user through creating a Strava API application:
- Very specific: line 19
Create an application (any name, set Authorization Callback Domain to localhost)
- Distinctive: line 213
If a method call fails or you're unsure what's available, introspect:
- Distinctive: line 223
"Not authenticated": Run the OAuth flow from the Setup section
- Very specific: line 224
Token refresh fails: Check STRAVA_CLIENT_ID and STRAVA_CLIENT_SECRET are set in .env
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Strava Skill
Query Strava fitness data by writing UV inline Python scripts using stravalib.
Setup
Credentials
Requires STRAVA_CLIENT_ID and STRAVA_CLIENT_SECRET in workspace/.env.
If not set, walk the user through creating a Strava API application:
- Go to https://www.strava.com/settings/api
- Create an application (any name, set Authorization Callback Domain to
localhost) - Copy the Client ID and Client Secret
Then append to .env:
echo 'STRAVA_CLIENT_ID=their_client_id' >> .env
echo 'STRAVA_CLIENT_SECRET=their_client_secret' >> .envAuthentication
Strava uses OAuth2. Generate an auth link, send it to the user, then ask them to paste back the redirect URL.
Step 1: Generate auth URL
set -a; source .env 2>/dev/null; set +a; uv run - <<'EOF'
# /// script
# requires-python = ">=3.11"
# dependencies = ["stravalib>=2.4"]
# ///
import os
from stravalib import Client
client = Client()
url = client.authorization_url(
client_id=int(os.environ["STRAVA_CLIENT_ID"]),
redirect_uri="http://localhost/callback",
scope=["read", "activity:read", "activity:read_all", "profile:read_all"]
)
print(f"URL: {url}")
EOFSend the URL to the user as a clickable link. Tell them:
- Click the link and authorize the app
- The browser will redirect to a page that won't load (localhost) — that's expected
- Copy the full URL from the browser address bar and paste it back here
Step 2: Exchange code for tokens (after user pastes the redirect URL)
Extract the code parameter from the URL the user pastes (it's in ?code=...&), then:
set -a; source .env 2>/dev/null; set +a; uv run - "THE_CODE_HERE" <<'EOF'
# /// script
# requires-python = ">=3.11"
# dependencies = ["stravalib>=2.4"]
# ///
import json, os, sys
from pathlib import Path
from stravalib import Client
client = Client()
tokens = client.exchange_code_for_token(
client_id=int(os.environ["STRAVA_CLIENT_ID"]),
client_secret=os.environ["STRAVA_CLIENT_SECRET"],
code=sys.argv[1]
)
Path("strava-tokens.json").write_text(json.dumps({
"access_token": tokens["access_token"],
"refresh_token": tokens["refresh_token"],
"expires_at": tokens["expires_at"],
"athlete_id": tokens.get("athlete", {}).get("id")
}, indent=2))
Path("strava-tokens.json").chmod(0o600)
print(f"SUCCESS: Tokens saved")
EOFQuery Template
set -a; source .env 2>/dev/null; set +a; uv run - <<'EOF'
# /// script
# requires-python = ">=3.11"
# dependencies = ["stravalib>=2.4"]
# ///
import json, os, logging
from datetime import datetime, timedelta
from pathlib import Path
from stravalib import Client
logging.getLogger().setLevel(logging.ERROR)
TOKEN_FILE = Path("strava-tokens.json")
if not TOKEN_FILE.exists():
print("ERROR: Not authenticated — run Strava setup first")
exit(1)
tokens = json.loads(TOKEN_FILE.read_text())
client = Client()
# Auto-refresh expired tokens
if datetime.now().timestamp() >= tokens["expires_at"] - 60:
new = client.refresh_access_token(
client_id=int(os.environ["STRAVA_CLIENT_ID"]),
client_secret=os.environ["STRAVA_CLIENT_SECRET"],
refresh_token=tokens["refresh_token"]
)
tokens["access_token"] = new["access_token"]
tokens["refresh_token"] = new["refresh_token"]
tokens["expires_at"] = new["expires_at"]
TOKEN_FILE.write_text(json.dumps(tokens, indent=2))
client.access_token = tokens["access_token"]
# === YOUR QUERY CODE HERE ===
for activity in client.get_activities(limit=5):
dist_km = float(activity.distance) / 1000
print(f"{activity.start_date_local.date()}: {activity.name} - {dist_km:.1f}km")
EOFAPI Reference
Client Methods
| Method | Returns | Description |
client.get_athlete() | Athlete | Current user's profile |
client.get_athlete_stats(athlete_id) | AthleteStats | Aggregated statistics |
client.get_activities(limit=N, after=date, before=date) | Iterator[SummaryActivity] | List activities |
client.get_activity(activity_id) | DetailedActivity | Single activity with full details |
Activity Fields (SummaryActivity)
| Field | Type | Description |
id | int | Activity ID |
name | str | Activity name |
type | str | "Run", "Ride", "Swim", etc. |
sport_type | str | More specific type (e.g., "TrailRun") |
distance | Distance | Meters (use float() to convert) |
moving_time | Duration | Seconds as int (use .timedelta() for timedelta) |
elapsed_time | Duration | Seconds as int |
total_elevation_gain | Distance | Meters climbed |
average_speed / max_speed | Velocity | m/s |
average_heartrate / max_heartrate | float/None | bpm (if recorded) |
start_date_local | datetime | Local time |
DetailedActivity adds: calories, description, laps, splits_metric, segment_efforts
AthleteStats
Access via client.get_athlete_stats(tokens["athlete_id"]):
ytd_run_totals,ytd_ride_totals- Year-to-dateall_run_totals,all_ride_totals- All-timerecent_run_totals,recent_ride_totals- Last 4 weeks
Each Totals object has: count, distance, moving_time (Duration), elevation_gain
Examples
These show non-obvious patterns. For straightforward methods, use the API reference above.
Filter Activities (type conversion gotchas)
# distance/moving_time are wrapper types — use float()/int() to convert
start = datetime.now() - timedelta(days=30)
runs = [a for a in client.get_activities(after=start, limit=100) if a.type == "Run"]
total_km = sum(float(a.distance) for a in runs) / 1000
total_hrs = sum(int(a.moving_time) for a in runs) / 3600
print(f"{len(runs)} runs: {total_km:.0f}km in {total_hrs:.1f}h")Quick Reference
# Unit conversions
dist_km = float(activity.distance) / 1000
speed_kmh = float(activity.average_speed) * 3.6
time_sec = int(activity.moving_time)
pace_min_km = (time_sec / 60) / (float(activity.distance) / 1000)
# List all activity types
from stravalib.strava_model import ActivityType, SportType
print(ActivityType.model_json_schema()['enum']) # Run, Ride, Swim, Hike, ...
print(SportType.model_json_schema()['enum']) # TrailRun, MountainBikeRide, ...Re-authentication
Strava tokens auto-refresh in the query template. If refresh fails (e.g. user revoked access), re-run the full OAuth flow from the Setup section.
Debugging
If a method call fails or you're unsure what's available, introspect:
uv run -c "from stravalib.client import Client; print([m for m in dir(Client) if not m.startswith('_')])"For full library docs: webfetch https://github.com/stravalib/stravalib
Troubleshooting
- "Not authenticated": Run the OAuth flow from the Setup section
- Token refresh fails: Check
STRAVA_CLIENT_IDandSTRAVA_CLIENT_SECRETare set in.env - 401 Unauthorized: User may have revoked access, re-run OAuth
- Field is None: Some fields like
average_heartrateonly exist if recorded - User confused by localhost error: Explain that the redirect to localhost failing is expected — they just need to copy the URL
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

