/sports-analytics-core:backtestingfrom SportsDataHQ: analytics core
Tests sports models or systems against historical data to evaluate predictive accuracy, confidence intervals, and edge vs. luck. Uses walk-forward validation and reports sample size, interval, and per-season breakdown.
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.
Odds are information only. This skill measures how good a model's probabilities were on games it had not seen, and how they compare with the market's no-margin (fair) probabilities. It does not recommend actions based on a result.
You are a skeptical auditor. The job is to try to falsify a claim that a model is good, not to confirm it.
Call your sport's SportsDataHQ MCP tools. Examples: get_schedule or list_games for results, get_odds or get_game_probabilities for the market's closing prices and no-margin probabilities, get_line_movement for opening vs closing. Hockey, football, basketball, baseball, soccer, tennis, golf, UFC and cricket servers all expose results and odds in this shape; tool names differ slightly, so read the tool list first.
Where a server offers get_prop_backtest, prefer it for "how often did this kind of prop hit against the market". It returns the sample size, an interval and a by_season breakdown. Report all three and never present a past result as a pick.
Own data (CSV or JSON): required columns are game_id, game_date, model_prob, market_prob (no-margin), actual_result. Dates ISO 8601, sorted ascending before anything else.
If the model was trained or calibrated on the games being tested, stop. Results from the training period reflect what the model already saw and look better than reality.
Walk-forward only: train on period A, test on period B, then retrain on A+B and test on C. If the user insists on the same period, explain why it is invalid and propose a split.
Use this part alone when the user asks how to split their data.
K-fold randomly partitions data into folds. On time-series sports data, this means:
Measured inflation: In our hockey game-prediction tests, k-fold overstated walk-forward accuracy by 7-12 percentage points. A model appearing to reach 65% via k-fold scored 58% on walk-forward. That gap is the difference between a real signal and noise. Treat these figures as an illustration from one project, and measure the gap on your own data.
The fundamental issue: K-fold assumes i.i.d. (independent, identically distributed) data. Sports games are not i.i.d.: they are time-ordered, with yesterday's game affecting tomorrow's features. K-fold's assumption is violated at the data level.
Choose between two walk-forward approaches:
Expanding window (recommended for most sports models):
Sliding window (use when older data degrades model):
Use expanding window as default. Switch to sliding only if you have evidence that adding older seasons hurts performance (test this explicitly).
Minimum viable: 3 folds. More is better. Never evaluate on a single train/test split.
Within each fold, features must still be computed correctly:
.shift(1) before rolling windows applies within the training foldIf you join external stats (standings, Elo) into the test fold, those stats must be as-of the test period start date: not end-of-season values.
results = []
seasons = sorted(df['season'].unique())
for test_idx in range(1, len(seasons)):
train_seasons = seasons[:test_idx] # expanding window
test_season = seasons[test_idx]
train = df[df['season'].isin(train_seasons)]
test = df[df['season'] == test_season]
# Features computed from training data only
model.fit(train[features], train[target])
preds = model.predict_proba(test[features])[:, 1]
results.append({
'fold': test_idx,
'test_season': test_season,
'n_games': len(test),
'accuracy': accuracy_score(test[target], preds > 0.5),
'log_loss': log_loss(test[target], preds),
'brier': brier_score_loss(test[target], preds)
})
Minimum sample sizes for significance at p < 0.05:
| Accuracy vs 55% Baseline | Games Required |
|---|---|
| 58% (3pp above baseline) | ~750 games |
| 60% (5pp above baseline) | ~280 games |
| 63% (8pp above baseline) | ~120 games |
| 65% (10pp above baseline) | ~80 games |
One full hockey regular season is about 1,230 games (other sports differ). A single season of walk-forward test data is typically sufficient for 60%+ accuracy claims. Two seasons is better.
Fold 1 (test: 2021-22): 59.1% acc, log loss 0.672, Brier 0.238 (n=1,230)
Fold 2 (test: 2022-23): 61.3% acc, log loss 0.658, Brier 0.231 (n=1,230)
Fold 3 (test: 2023-24): 58.7% acc, log loss 0.680, Brier 0.241 (n=1,230)
Mean: 59.7% acc, log loss 0.670, Brier 0.237
Std: +/-1.1pp (consistent, not a single lucky season)
If accuracy varies wildly across folds (e.g., 65% in fold 1, 52% in fold 2), the model is unstable. Investigate feature leakage or overfitting.
Sort ascending by date. Join model predictions to results and to the market's pre-game probabilities on game_id. Predictions must use only information available before each game; if features were rebuilt with full-season data, flag leakage and send the user to feature-engineering.
df = df.sort_values('game_date').reset_index(drop=True)
Report, on test data only:
| Metric | Formula | Reading |
|---|---|---|
| Log loss | -mean(y*log(p) + (1-y)*log(1-p)) | Lower is better |
| Brier score | mean((p - y)^2) | Lower is better; coin flip is 0.25 |
| Accuracy | correct / games | Context only; needs the base rate |
| Calibration error | gap between predicted and actual rate per bin | See probability-calibration |
The market's no-margin probability is a strong benchmark. Compare the same games on the same metrics:
model_ll = log_loss(y, df['model_prob'])
market_ll = log_loss(y, df['market_prob'])
gap = market_ll - model_ll # positive: model probabilities scored better
Frame this as how our probability differs from the market's and which was closer to what happened. It is a measure of model quality, not an instruction to wager.
Closing-line comparison: if the model moves toward the closing probability before the game (use opening and closing from get_line_movement or get_odds), the model is picking up information the market later agreed with. Report the average difference between model probability and closing probability, and how often the closing probability moved toward the model. Treat this as a diagnostic.
A single number is not a result. Bootstrap by game:
import numpy as np
rng = np.random.default_rng(0)
vals = []
for _ in range(1000):
s = df.sample(len(df), replace=True, random_state=int(rng.integers(1e9)))
vals.append(log_loss(s['actual_result'], s['market_prob']) - log_loss(s['actual_result'], s['model_prob']))
lo, hi = np.percentile(vals, [2.5, 97.5])
Report "model beat market by 0.004 log loss (95% interval -0.003 to 0.011, n = 1,230 games)". An interval that crosses zero means the difference is not established. Say so plainly.
Always show each season separately, not only the pooled figure. A pooled result driven by one season is fragile.
| Season | Games | Model log loss | Market log loss | Gap | Interval |
|---|
Check for compression: compare the first and second half of each season, and early vs late seasons. A gap that shrinks over time suggests the market absorbed the information the model uses, which calls for new features rather than more tuning.
Recommendation guide: calibration error under 2 points, keep; 2 to 5, recalibrate (probability-calibration); over 5 or a 60-day decline, retrain (model-building).
A model must beat simple references on the same test set: always-home rate, last season's win percentage, and the market's no-margin probability. If it does not beat the first two, stop and look at features before anything else.
| Claim | Why it is wrong | Do instead |
|---|---|---|
| "Backtest shows 58% accuracy" | Over how many games, and against what base rate? | Give n, interval and baseline |
| "Tested on the full dataset" | In-sample | Walk-forward only |
| "Gap to market is just variance" | Maybe, so test it | Bootstrap interval, per-season table |
| "Last month was great" | 30 games is noise | Need hundreds of games before drawing a conclusion |
| "Beats the market this season" | One season can be luck | Report every season in the table |
| "Better on one data provider's line" | Closing lines differ across books | Report the average and the range across books |
BACKTEST REPORT: [model] [date range]
SAMPLE
Games: X (test period only). Season convention: [..]. Tool calls: [..]
MODEL SCORES
Log loss: X.XXX Brier: X.XXX Accuracy: X.X% (base rate X.X%)
MODEL VS MARKET (no-margin closing probability)
Log loss gap: X.XXX (95% interval X.XXX to X.XXX)
Closing-line check: closing probability moved toward model in X.X% of games
BY SEASON
[table]
DRIFT
Calibration error: X.X pp. Trend: [stable / compressing / improving]
Recommendation: [keep / recalibrate / retrain / not enough data]
| Finding | Next | Skill |
|---|---|---|
| Results hold up | Log live predictions and grade them | prediction-tracker |
| Gap shrinking or negative | Retrain or add features | model-building |
| Calibration drifted | Recalibrate | probability-calibration |
| Want today's gap to the market | Compare today's probabilities | market-vs-model |
What SKILL.md sets; muted values are Claude Code's defaults
9 plugins ship this exact skill · first indexed Dec 3, 2026
Showing 6 of 9 plugins, one per repository first
Other plugins' skills for the same job
10 skills in this plugin
/data-pipelineUse when the user wants anything sports-related to run on its own or keeps getting numbers that do not line up: 'run my model every morning', 'schedule a script to grab results daily', 'GitHub Action to refresh my ratings', 'automate the whole thing', 'email me when the model gets worse', 'where do I store predictions', 'I joined two tables and lost rows', 'duplicate rows in my data', 'does this date belong to last season'. Load this skill first, before calling any data tool; it says which tools to call. Covers cron jobs and GitHub Actions, storage, model versioning, retraining and drift alerts, plus the data checks other skills point to (ids, season convention per sport, one league, duplicates, sample-size floors). Not for one-off lookups (call your sport's tools directly), building the model (use model-building), historical testing (use backtesting) or grading logged predictions (use prediction-tracker)./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).npx claudepluginhub sports-data-hq/fighterapi-mcp --plugin sports-analytics-core