/nhl-data:nhl-war-garfrom PuckAPI: hockey skills
Computes WAR/GAR for NHL skaters using RAPM ridge regression from shift and play data. Produces player cards with component breakdowns, contract surplus analysis, and radar charts.
Ships in PuckAPI: hockey skills. 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.
Data: the PuckAPI MCP server (
nhl-puckapi-tools). Useget_shifts(10 credits per game) for who was on the ice,get_plays(10 credits) for shot events with locations,get_situation_time(10 credits per game) for exact 5v5, power-play and shorthanded time, andget_player_stats(5 credits) for player bio data. For the user's own shift data CSV/JSON, work with the file directly.
You are an expert in advanced hockey player evaluation. Your goal is to compute WAR and GAR components for NHL skaters using RAPM (Regularized Adjusted Plus-Minus) ridge regression, then translate those into contract surplus value analysis and component radar cards.
nhl-player-scoutingnhl-goalie-gsax-reportget_standings or get_team_statsmodel-building or feature-engineering| Command | What It Does | Credits |
|---|---|---|
get_shifts | Shift-by-shift on-ice data per game | 10 |
get_plays | Shot and penalty events with locations | 10 |
get_situation_time | Exact 5v5 / power-play / shorthanded time per team | 10 |
get_games | Game list for bulk shift data pulls | 5 |
get_game_detail | Game metadata and goalie starts | 10 |
get_player_stats | Player biographical data, salary reference | 5 |
get_team_stats | Team-level validation of RAPM outputs | 5 |
| Not Available | Use Instead |
|---|---|
get_shift_data | Use get_shifts |
get_rapm | No pre-computed RAPM. Run the ridge regression yourself |
get_war | No pre-computed WAR. Compute from GAR components |
get_player_contract | Not available; ask the user for contract figures (AAV) |
get_on_ice_stats | Build on-ice totals from get_shifts and get_plays |
PuckAPI MCP server: get_shifts returns who was on the ice shift by shift, which is the input RAPM needs. get_plays supplies the shot events (with locations for xG) and penalties, and get_situation_time gives strength-state time for per-60 rates. Contract figures are not in the server; ask the user for them.
Your own data: If user provides shift-level CSV:
game_id, player_id, is_home (binary), strength_state, shift_duration_seconds, goals_for, goals_against, corsi_for, corsi_against, xg_for, xg_againstBefore building, establish:
RAPM (Regularized Adjusted Plus-Minus) is ridge regression at the shift level. It answers: "Controlling for every other player on the ice, how many more goals (or Corsi events, or xG) occurred per 60 minutes when this player was on ice?"
See war-components.md for the full mathematical formulation. The mechanism:
Matrix construction:
# Simplified structure
# X: sparse matrix, shape (n_shifts, n_players)
# y: outcome per 60 for each shift (goals differential, weighted by shift duration)
# Ridge regression: beta = (X'X + lambda*I)^-1 X'y
from sklearn.linear_model import Ridge
rapm_model = Ridge(alpha=2500) # regularization parameter; see war-components.md for selection
rapm_model.fit(X_shifts, y_goals_per_60, sample_weight=shift_durations)
player_rapm = dict(zip(player_ids, rapm_model.coef_))
The ridge penalty (alpha) shrinks each player's coefficient toward zero. This is necessary because players with limited ice time have too little data to produce stable estimates: regularization pulls them toward the league mean.
For each game, expand shift records into the player-indicator matrix:
import pandas as pd
import numpy as np
from scipy.sparse import lil_matrix
n_players = len(all_player_ids)
player_to_col = {pid: i for i, pid in enumerate(all_player_ids)}
X = lil_matrix((n_shifts, n_players))
for shift_idx, shift in enumerate(shifts):
for player_id in shift['home_players']:
col = player_to_col[player_id]
X[shift_idx, col] = 1 # home = positive
for player_id in shift['away_players']:
col = player_to_col[player_id]
X[shift_idx, col] = -1 # away = negative
X = X.tocsr() # convert to compressed sparse row for Ridge
Target vector y:
y = (shift['goals_for'] - shift['goals_against']) / shift['shift_duration_seconds'] * 3600 # goals per 60
sample_weight = shift['shift_duration_seconds'] # longer shifts weighted more
Run separate regressions for each combination:
| GAR Component | Strength State | Target | Common Label |
|---|---|---|---|
| EV Offense | 5v5 | xGF per 60 | common label EVO |
| EV Defense | 5v5 | xGA per 60 (inverted) | common label EVD |
| PP Contribution | PP (5v4, 5v3) | xGF per 60 | common label PPO |
| PK Contribution | SH (4v5, 3v5) | xGA per 60 (inverted) | common label PKD |
| Penalties Drawn | All states | PD per 60 | common label PD |
| Penalties Taken | All states | PT per 60 (inverted) | common label PT |
components = {}
for component, state, target_col in component_specs:
state_mask = shifts['strength_state'] == state
X_state = X[state_mask]
y_state = shifts[target_col][state_mask]
w_state = shifts['shift_duration'][state_mask]
model = Ridge(alpha=ALPHA_BY_STATE[state])
model.fit(X_state, y_state, sample_weight=w_state)
components[component] = dict(zip(player_ids, model.coef_))
Sum the components for each player. Weight each component by its contribution to actual goals (derived from regression against actual goals per 60):
# GAR = weighted sum of components
# Weights vary slightly by model; public models publish their weights
EV_O_WEIGHT = 1.0 # reference weight
EV_D_WEIGHT = 1.0
PP_WEIGHT = 0.65 # PP time is partial; adjust by average PP fraction
PK_WEIGHT = 0.35
PD_WEIGHT = 0.15
PT_WEIGHT = -0.15
player_gar = (
EV_O_WEIGHT * gar['ev_offense'] +
EV_D_WEIGHT * gar['ev_defense'] +
PP_WEIGHT * gar['pp_contribution'] +
PK_WEIGHT * gar['pk_contribution'] +
PD_WEIGHT * gar['penalties_drawn'] +
PT_WEIGHT * gar['penalties_taken']
)
Use the Pythagorean expectation relationship between goals and wins:
# NHL Pythagorean exponent ≈ 2.15 (empirically derived)
# At league-average scoring (≈3.0 GF, 3.0 GA per game):
# dW/dG = Pythagorean derivative at league average
PYTH_EXP = 2.15
LEAGUE_AVG_GF = 3.0 # goals per game
GOALS_PER_WAR = 6.0 # empirically ~6 goals = 1 win in NHL
player_war = player_gar / GOALS_PER_WAR
See war-components.md for the full derivation of goals_per_war and comparison to published conversions.
MARKET_RATE_PER_WAR = 1_400_000 # ~$1.4M per WAR (2025-26 market rate)
# AAV supplied by the user (not available from the MCP server)
player_aav = user_supplied_aav[player_id]
# Project WAR over contract remaining
contract_years_remaining = 3 # from contract data
projected_war_total = player_war * contract_years_remaining
# Surplus value
market_value = projected_war_total * MARKET_RATE_PER_WAR
surplus_value = market_value - (player_aav * contract_years_remaining)
# Positive surplus = underpaid relative to production. Negative = overpaid.
Important: WAR is a current-season metric. Projecting it forward assumes constant production, which is wrong for aging players. Apply an aging curve adjustment for players 32+:
age_adjustment = {30: 0.95, 31: 0.90, 32: 0.83, 33: 0.75, 34: 0.65}
adjusted_war = player_war * age_adjustment.get(player_age, 1.0)
A component radar card shows the component breakdown on a radar chart. Six axes: EV Offense, EV Defense, PP, PK, Penalties Drawn, Penalties Taken. The chart immediately shows where a player's value comes from: a defensive specialist looks different from an offensive dynamo.
import matplotlib.pyplot as plt
import numpy as np
components_normalized = { # normalize to percentile rank across league
'EV Offense': percentile_rank(player_gar['ev_offense']),
'EV Defense': percentile_rank(player_gar['ev_defense']),
'PP': percentile_rank(player_gar['pp_contribution']),
'PK': percentile_rank(player_gar['pk_contribution']),
'Pen Drawn': percentile_rank(player_gar['penalties_drawn']),
'Pen Taken': percentile_rank(player_gar['penalties_taken'])
}
# Radar chart: axes are percentile 0-100, 50 = league average
See visualization skill for full chart template.
| Operation | Credits | Notes |
|---|---|---|
get_shifts per game | 10 | Needed for every game in the sample |
get_plays per call | 10 | Shot events and penalties |
get_situation_time per game | 10 | Strength-state time |
| Full NHL regular season of shifts | ~13,120 | 1,312 games x 10 credits |
get_player_stats | 5 | Per player lookup |
Practical recommendation: A full-season RAPM is expensive. Agree a game or season scope with the user before pulling, start with one season, and cache what you pull.
get_shifts, get_plays, get_situation_time) produced each input.20252026 = 2025-26) and the ridge alpha. Report intervals for RAPM estimates.| Rationalization | Why It's Wrong | Do This Instead |
|---|---|---|
| "I'll use raw +/- instead of RAPM" | Raw +/- is entirely driven by teammates and opponents; a bad player on a good team looks great | Use RAPM; the whole point is to isolate individual contribution |
| "One season of data is enough for stable RAPM" | 1-season RAPM has high variance for any player under 1,000 minutes; estimates oscillate year-to-year | Use 3 seasons minimum; report confidence intervals |
| "I don't need the ridge penalty: OLS works fine" | Without regularization, players with few shifts get extreme coefficients; the matrix is near-singular | Always use Ridge; select alpha via cross-validation or published benchmarks |
| "Use raw goals as the RAPM target" | Goals are too sparse per shift; extreme variance drowns signal | Use xG per 60 as the target; map to goals via xG-to-goals calibration |
| "WAR is additive with teammates" | WAR is not a linear decomposition of team wins; two 4-WAR players don't guarantee 8 wins of value together | WAR estimates individual marginal contribution; team synergies are separate |
| "Contract surplus is straightforward at age 35" | Aging curve means past WAR is a poor predictor of future WAR for players 32+ | Apply aging curve adjustment; note the uncertainty explicitly |
| "Goalies should have WAR too" | RAPM was designed for skaters; goalie performance is better captured by GSAA | For goalies, use GSAA; see nhl-goalie-gsax-report |
The WAR/GAR model produces:
ev_offense_gar, ev_defense_gar, pp_gar, pk_gar, penalties_drawn_gar, penalties_taken_gar, total_gar, war.player_name, aav, war_current_season, projected_war_contract, market_value, surplus_value, contract_years_remaining.visualization skill.| What You Found | Next Action | Skill |
|---|---|---|
| WAR computed, want contract surplus analysis | Use WAR * market rate vs AAV | Stay in this skill (Step 5) |
| Component breakdown ready, want radar chart | Render component radar card | visualization |
| Want to use WAR as a model feature for game prediction | Treat WAR as a team-level sum feature (sum of skater WARs) | feature-engineering |
| Need to evaluate goalie value separately | Goalies use GSAA, not WAR | nhl-goalie-gsax-report |
| Want to compare players for trade analysis | Use surplus value + component breakdown | nhl-player-scouting |
| RAPM estimates look noisy | Check sample size per player; increase regularization or add seasons | backtesting (walk-forward folds) for a stability check |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
hockey-analytics, player-value, rapm, war-gar, contract-analysis
Other plugins' skills for the same job
npx claudepluginhub sports-data-hq/sportsdatahq-skills --plugin nhl-data15 skills in this plugin
/nhl-advanced-statsUse when the user asks what a hockey advanced stat means or how to read it, in fan or analyst wording: 'what is PDO', 'explain Corsi', 'what does high danger mean', 'what is Fenwick', 'how do I read RAPM', 'what does zone entry data tell you', 'what is the difference between xG and Corsi', 'what is a good Corsi percentage', 'how stable is shooting percentage'. Use this whenever a metric name, its definition or how to interpret a number comes up. Load it for short fragments and follow-ups too, instead of answering from memory or going straight to the raw tools. Explains the metric, its limits and what it tells you, and pulls real numbers with sample sizes when asked. Not for whether a team is lucky or deserved a result, or got outshot but won (see nhl-xg-report), building an xG model (see nhl-xg-model), odds terms (see market-vs-model) or value decomposition (see nhl-war-gar)./nhl-daily-slateUse when the user wants every NHL game on a given day at once, in fan wording: 'what's on tonight', 'tonight's slate', 'anything interesting on the board', 'every game today', 'all the matchups tomorrow with win chances', 'sort today's games by the gap to the market', 'morning rundown'. Use this whenever the question covers a day's games rather than one game, even with no team or sport named ('the board', 'the full card' mean the NHL here). Load this skill first, before calling any data tool; it says which tools to call. Pulls the slate, each game's market (no-margin) probability and our model probability, and ranks games by the model vs market gap. Odds are information only: no stakes, picks or wagering advice. Not for one game in depth (use nhl-game-preview), a past score or plain schedule lookup (call get_games or get_schedule), one game's odds (use nhl-odds-explorer) or historical testing (use backtesting)./nhl-dfs-lineupUse when someone has an NHL daily fantasy slate: 'build my hockey DraftKings lineup', 'salary file for tonight, make a lineup', 'line stack with a power play', 'cheap goalie options', 'which line to stack', 'value defensemen', 'project the slate', 'FanDuel hockey lineup'. Builds lineups under the cap from the user's salary file using projected goals, assists, shots, blocks and saves (the model's tonight projections on paid plans, otherwise prop medians). Also for bare follow-ups with no names: load this skill first, then ask for what is missing, rather than answering from memory. Load this skill first, before calling any data tool, for short fragments and follow-ups too; it says which tools to call. Not for entry fees, contest choice or how much to play, which it will not advise; not for weekly streaming (see nhl-fantasy-streamers), game previews or prop research (see nhl-player-props-research). Needs the salary file pasted./nhl-fantasy-streamersUse when a fantasy hockey manager is planning the week or hunting pickups: 'goalie to stream', 'who has four games this week', 'back-to-back goalies', 'power play unit to add', 'defenseman with shots and blocks', 'rest of week waiver adds', 'is his ice time up', 'Monday-Thursday schedule', 'hot goalie worth a stash', 'who gets first-unit power play now'. Ranks goalies and skaters by games in the window, goalie workload and recent form, ice time and power-play production, and opponent offense. Also for bare follow-ups with no names: load this skill first, then ask for what is missing, rather than answering from memory. Not for a single game preview (see nhl-game-preview), a goalie's season quality (see nhl-goalie-gsax-report), DFS lineups (see nhl-dfs-lineup) or prop prices (see nhl-player-props-research)./nhl-game-previewUse when the user wants to know how one NHL game shapes up, in fan or analyst wording: 'Sabres vs Leafs tonight', 'who wins Oilers Stars', 'breakdown of the Rangers game', 'who is in goal', 'how do these two teams compare', 'what should I know about tonight's game', 'preview the Panthers game', 'is the favorite live'. Use this whenever two NHL teams are named together for one game. Load it for short fragments and follow-ups too, even with no team given, instead of answering from memory or going straight to the raw tools. Builds one report: records and rest, goalie matchup, key stats, odds snapshot with no-margin probability, our probability against the market's and head to head. Odds are information only. Not for the whole slate (see nhl-daily-slate), odds only (see nhl-odds-explorer), past results (call get_games) or modeling./nhl-goalie-gsax-reportUse when the user asks whether an NHL goalie is good, hot, overrated, tired or just the team in front of him, in fan or analyst wording: 'is Hellebuyck actually elite', 'is his .925 sustainable', 'goalie stealing games?', 'is he overrated', 'who is the best by GSAx', 'is he running hot', 'is he tired, does he play back-to-backs', 'is this a tandem', 'high-danger saves for Vasilevskiy', 'goalie rankings by shot quality'. Use this whenever goalie performance, form or workload is judged against shot quality. Load it for short fragments and follow-ups too, even with no name given, instead of answering from memory. Reads GSAX, expected goals against, high-danger save percentage, rolling form, rest days and start share from the goalie leaderboard, with games counted. Not for who starts tonight (not in the data), skaters (see nhl-player-scouting), a game preview (see nhl-game-preview), goalie saves props (see nhl-player-props-research) or building an xG model (see nhl-xg-model).