/sports-analytics-core:data-pipelinefrom SportsDataHQ: analytics core
Automates sports data pipelines: cron jobs, GitHub Actions, storage, model versioning, retraining, and drift alerts. Runs data checks (IDs, season conventions, duplicates, sample-size floors) before any pull or analysis.
Ships in SportsDataHQ: analytics core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in sports analytics automation. The goal is to move from "I built a model" to "my model runs every morning and its results are logged." Odds are information only: the pipeline stores market probabilities next to model probabilities for comparison and does not produce wagering instructions.
Call your sport's SportsDataHQ MCP tools. Examples: hockey get_schedule and get_games, football get_games and get_plays, basketball list_games and get_shot_chart, baseball get_games and get_pitches, soccer list_games and get_events, tennis get_matches and get_match, golf get_leaderboard, UFC get_event and get_fight, cricket get_deliveries. Market inputs come from get_odds, get_game_probabilities or get_line_movement where the server offers them.
The MCP server is pull-only (no streaming) and has no scheduler. Automate by running Claude headlessly on a schedule:
claude -p "Pull today's games with the SportsDataHQ tools and save JSON to data/games/"
Own data: skip the tools and read files directly.
Most wrong answers in sports analysis come from the data step, not the math: the wrong player with the same name, a season boundary off by one, a league mixed in, a game counted twice, or a conclusion drawn from eight games. Other skills point here for these checks.
Resolve every entity to an id with a search call. Never pass a name where a tool wants an id, and never guess an id.
search_players (or search_fighters for UFC). If two results match, show both and ask, or pick by team and position and say so.list_teams; most tools also accept the team abbreviation.get_schedule, get_games/list_games/get_matches, or the event (get_event, get_tournament).Pin the season convention for the sport and say it in the answer:
| Sport | season means |
|---|---|
| NHL | 8-digit id, start year + end year (20252026) |
| NFL, college football | the year the regular season starts (2025 = 2025-26) |
| NBA, college basketball | the year the season ends (2026 = 2025-26); WNBA calendar year |
| MLB, college baseball | calendar year |
| Soccer | the year the season starts (2025 = 2025-26); MLS, NWSL, Liga MX, Brazil, Argentina calendar year |
| Tennis, UFC | calendar year |
| Golf | tour season year (PGA Tour 2014 to 2024 seasons began the previous October) |
| Cricket | a year (2024) or split season (2024/25) |
Confirm the league. Multi-league APIs default to the flagship (NHL, NFL, NBA, MLB, Premier League, ATP, PGA Tour). Pass league explicitly when the user means another, and never mix leagues in one average.
Deduplicate. Count each game once per team or player; drop rows repeated across pages; for odds, one row per bookmaker per snapshot unless the user asked for all.
Decide if there is enough data. State the sample size beside every rate. Rough floors before a rate means much: 10+ games for team form, 20+ games or 200+ plate appearances or 100+ shots for a player rate, 30+ balls for a batter vs bowler matchup, 50+ cases for any backtest. Below the floor, say "not enough data to say" and show the raw counts instead.
Start any analysis answer with one line: Data: <tools used>, <season(s) and league>, <sample size>.
[Schedule] -> [Data pull] -> [Prediction] -> [Storage + alert]
cron MCP tools model.predict() SQLite / Sheets
name: Daily pipeline
on:
schedule:
- cron: '0 11 * * *' # 6 AM ET = 11:00 UTC
workflow_dispatch:
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: '3.11' }
- run: pip install -r requirements.txt
- name: Pull games and market probabilities
run: python scripts/pull_data.py --date today
- name: Generate predictions
run: python scripts/generate_predictions.py --date today
- name: Log predictions
run: python scripts/log_predictions.py --date today
- name: Drift check
run: python scripts/drift_check.py --window 14
- name: Commit results
run: |
git config user.email "[email protected]"
git config user.name "Pipeline Bot"
git add data/ predictions/
git commit -m "Daily pipeline $(date +%F)" || echo "Nothing to commit"
git push
Schedules vary by sport: pick a run time after lineups or starters are usually known (starting goalies, starting pitchers, injury reports, confirmed XIs), and a second refresh closer to game time if the market inputs matter.
# scripts/pull_data.py
import json, os
from datetime import date
def save_pull(payload: dict, kind: str, target_date: str, source_call: str):
"""payload is the result Claude got from an MCP tool; source_call records which tool produced it."""
path = f"data/{kind}/{target_date}.json"
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "w") as f:
json.dump({"date": target_date, "pulled_at": date.today().isoformat(),
"source_call": source_call, "data": payload}, f, indent=2)
# scripts/generate_predictions.py
import json, pickle
def active_version() -> str:
return json.load(open("models/registry.json"))["active"]
def generate(target_date: str):
version = active_version()
model = pickle.load(open(f"models/{version}/model.pkl", "rb"))
games = json.load(open(f"data/games/{target_date}.json"))["data"]
out = []
for g in games:
x = build_features(g) # your feature code, shift(1) applied
p = float(model.predict_proba([x])[0][1])
out.append({"game_id": g["id"], "date": target_date,
"home_win_prob": round(p, 4), "model_version": version})
json.dump(out, open(f"predictions/{target_date}.json", "w"), indent=2)
def build_features(game):
raise NotImplementedError("Use feature-engineering output here")
CREATE TABLE IF NOT EXISTS predictions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
game_id TEXT NOT NULL,
game_date DATE NOT NULL,
home_team TEXT NOT NULL,
away_team TEXT NOT NULL,
home_win_prob REAL NOT NULL, /* model probability */
market_open_prob REAL, /* market no-margin probability at prediction time */
market_close_prob REAL, /* fill later */
model_version TEXT NOT NULL,
generated_at TIMESTAMP NOT NULL,
actual_result INTEGER, /* 1 home win, 0 away win; fill after game */
source_call TEXT /* tool call that supplied inputs */
);
CREATE TABLE IF NOT EXISTS model_versions (
version TEXT PRIMARY KEY,
trained_at DATE NOT NULL,
training_games INTEGER NOT NULL,
val_log_loss REAL NOT NULL,
val_accuracy REAL NOT NULL,
feature_set TEXT NOT NULL,
is_active INTEGER DEFAULT 0
);
CREATE TABLE IF NOT EXISTS drift_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
check_date DATE NOT NULL,
window_days INTEGER NOT NULL,
games_in_window INTEGER NOT NULL,
accuracy REAL,
expected_acc REAL NOT NULL,
drift_flag INTEGER DEFAULT 0
);
Rolling accuracy query:
SELECT game_date,
AVG(CASE WHEN actual_result = ROUND(home_win_prob) THEN 1.0 ELSE 0.0 END)
OVER (ORDER BY game_date ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS rolling_14
FROM predictions WHERE actual_result IS NOT NULL ORDER BY game_date;
Never overwrite a model file. Each training run writes a new directory (models/v2.2.0/model.pkl) and models/registry.json points at the active version with its training date, validation scores and feature list. Roll back by changing the pointer.
| Condition | Trigger | Action |
|---|---|---|
| Calendar | Start of each month or season | Retrain on the latest completed seasons |
| Game count | Every 50 new games | Rolling-window retrain |
| Accuracy drop | Window accuracy more than 3 points below validation | Review features first, then retrain |
| New season | Season opens | Full retrain with a carryover check |
| Closing-line check | Model probability stops moving toward the closing probability for 30 days | Model is lagging the market; review features |
Do not retrain on one bad week. Require the trigger to hold on two or three consecutive checks.
# scripts/drift_check.py
import sqlite3, json, argparse
THRESH = 0.03
def check(window: int = 14):
conn = sqlite3.connect("predictions.db")
games, acc = conn.execute("""
SELECT COUNT(*), AVG(CASE WHEN actual_result = ROUND(home_win_prob) THEN 1.0 ELSE 0.0 END)
FROM predictions WHERE actual_result IS NOT NULL
AND game_date >= DATE('now', ?)""", (f"-{window} days",)).fetchone()
if games < 30:
print(f"Not enough data: {games} games in {window} days")
return
reg = json.load(open("models/registry.json"))
expected = next(v["val_accuracy"] for v in reg["versions"] if v["version"] == reg["active"])
flag = acc < expected - THRESH
conn.execute("INSERT INTO drift_log (check_date, window_days, games_in_window, accuracy, expected_acc, drift_flag) VALUES (DATE('now'),?,?,?,?,?)",
(window, games, acc, expected, int(flag)))
conn.commit()
print(("DRIFT: " if flag else "OK: ") + f"{acc:.1%} over {games} games (expected {expected:.1%})")
if __name__ == "__main__":
p = argparse.ArgumentParser(); p.add_argument("--window", type=int, default=14)
check(p.parse_args().window)
A small window is noisy: the check refuses to flag below 30 games.
Pull results, market probabilities and team or player stats in parallel; if one source fails, continue and mark the missing input in the log rather than hiding it.
results = await asyncio.gather(pull_games(d), pull_market(d), pull_team_stats(d), return_exceptions=True)
games, market, stats = results
if isinstance(market, Exception):
log_warning("market pull failed; storing model probability only")
market = {}
Cache slow-moving inputs (season stats, ratings) and refresh weekly rather than daily. Backfill history once, store it locally, then pull only new games.
| Claim | Why it fails | Do instead |
|---|---|---|
| "I will run it by hand each morning" | You will miss days | Schedule it now, even if imperfect |
| "Overwrite the model on retrain" | Cannot audit which model made which prediction | Version every model |
| "One bad week means drift" | Variance | Window of 30+ games and a 3 point drop on repeat checks |
| "Spreadsheet is fine" | Manual entry breaks | SQLite takes minutes to set up |
| "Pull full history daily" | Wasteful | Backfill once, pull new games only |
| Finding | Next | Skill |
|---|---|---|
| Pipeline running | Grade the logged predictions over time | prediction-tracker |
| Accuracy drifting | Test on recent history | backtesting |
| Need better inputs | Rebuild features | feature-engineering |
| Need a new model | Retrain | model-building |
| Want today's gap to the market | Compare probabilities | market-vs-model |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sports-data-hq/dunkapi-mcp --plugin sports-analytics-core10 skills in this plugin
/backtestingUse when the user asks whether a sports model or system would have worked in the past, for any sport, in plain wording: 'does my model actually work', 'test it on the last three seasons', 'did it beat the closing line', 'is it still as accurate as it used to be', 'what is the confidence interval on my hit rate', 'how would this have done in 2023', 'run it against past odds', 'is this edge real or luck', 'how should I split seasons to test it'. Use this whenever historical performance, fold design, sample size or an interval is the question. Load this skill first, before calling any data tool; it says which tools to call. Walk-forward only; refuses k-fold and in-sample testing; reports sample size, an interval and a per-season breakdown. Not for logging live predictions as games finish (see prediction-tracker), tonight's gap to the market (see market-vs-model) or training (see model-building)./elo-engineeringUse when the user asks to build Elo ratings, rate teams or players, tune K-factor or home advantage, carry ratings across seasons, add margin-of-victory, or mentions Fading, Form or Component Elo. Works for team sports and for tennis, golf, UFC and cricket player or fighter ratings. Load this skill first, before calling any data tool, for short fragments and follow-ups too; it says which tools to call. Not for general feature construction (use feature-engineering), not for a full model (use model-building), not for plain team stats (call get_standings or get_team_stats for hockey, or your sport's stats tools), not for season simulation (use nhl-playoff-simulation).Other plugins' skills for the same job
9 plugins ship this exact skill · first indexed Dec 3, 2026
Showing 6 of 9 plugins, one per repository first