xg-model-building

xg-model-building is a skill for Claude Code from PuckAPI/claude-sports-analytics. It costs 120 tokens per session (3,136 once invoked), scanned A, original, MIT.

A method for building expected-goals (xG) models for hockey. An xG model estimates how likely each shot is to become a goal using shot events and details such as location and game situation.

In plain words
What is it for?
Use it to build shot-probability models, calculate expected goals and expected-goals percentages, and detect rebounds or shots taken during rushes.
Why use it?
It helps distinguish shot quality from simply counting shots. The method uses NHL play-by-play data because the referenced PuckAPI data does not include individual shot events or locations.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the puckapi-skills plugin — 28 skills shipped together

Good fit Use it to build shot-probability models, calculate expected goals and expected-goals percentages, and detect rebounds or shots taken during rushes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/puckapi/claude-sports-analytics/xg-model-building
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add PuckAPI/claude-sports-analytics --skill xg-model-building
Clone the repo
git clone --depth 1 https://github.com/PuckAPI/claude-sports-analytics

Made for: Claude Code.

Or install puckapi-skills, the plugin that ships this one along with the rest of its 28 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for xg-model-building

README.md
[![agentmods](https://agentmods.dev/badge/skills/puckapi/claude-sports-analytics/xg-model-building/github.svg)](https://agentmods.dev/skills/puckapi/claude-sports-analytics/xg-model-building)
Your own site
<a href="https://agentmods.dev/skills/puckapi/claude-sports-analytics/xg-model-building"><img src="https://agentmods.dev/badge/skills/puckapi/claude-sports-analytics/xg-model-building/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for xg-model-building

Your own site · 80×15
<a href="https://agentmods.dev/skills/puckapi/claude-sports-analytics/xg-model-building"><img src="https://agentmods.dev/badge/skills/puckapi/claude-sports-analytics/xg-model-building.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 120 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,136 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00120 $0.03136
Opus 5 $0.00060 $0.01568
Sonnet 5 $0.00024 $0.00627
Haiku 4.5 $0.00012 $0.00314

Measured 10d ago against content hash 51496bee4f32, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

xg-model-building scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/xg-model-building/SKILL.md · 255 lines

How it starts

The opening of the file, as written. The whole thing — 255 lines — stays where its author put it; the contents beside it link to each section on GitHub.

xG Model Building

Important: PuckAPI does NOT have play-by-play data. The SDH database contains game-level data (scores, teams, odds, goalie starts) but no event-level shot data, coordinates, or play-by-play events.

Primary data source for xG: The NHL Stats API at api-web.nhle.com provides free play-by-play data with shot coordinates, event types, and strength state. No API key or credits required.

PuckAPI is useful for: Validating your xG model output against team-level stats (get_team_stats, 5 credits) and goalie stats (get_goalie_stats, 5 credits).

For user's own shot data CSV/JSON: skip external sources, work with the file directly.

You are an expert in hockey expected goals modeling. Your goal is to build a shot-level xG model that estimates the probability any given shot results in a goal, controlling for shot quality rather than shot volume.

When to Use

  • User asks "how do I build an xG model"
  • User wants to model shot probability or goal probability from play-by-play data
  • User wants to compute xGF%, xGA, or expected goals for teams or players
  • User asks about rebound detection, rush shot detection, or shot angle features
  • User wants to replicate or improve upon MoneyPuck or Evolving Hockey xG methodology
  • User asks about strength-state-specific (5v5, PP, SH, EN) goal models

When NOT to Use

  • Using xG values that already exist -- to analyze teams with pre-built xG, see team-analysis or hockey-analytics
  • Predicting game outcomes (win/loss) -- see model-building
  • Evaluating goalie quality using xGA -- see goalie-analysis
  • General feature engineering for non-xG features -- see feature-engineering

Data Sources

NHL Stats API (primary, free)

The NHL Stats API provides play-by-play event data for every game:

https://api-web.nhle.com/v1/gamecenter/{gameId}/play-by-play

Each play-by-play response includes shot events with:

  • Event type (SHOT, GOAL, MISS, BLOCK)
  • x/y coordinates (NHL coordinate system, feet, center ice = 0,0)
  • Shot type (wrist, slap, snap, backhand, tip, deflection, wrap-around)
  • Strength state (5v5, PP, SH, EN)
  • Period and game time
  • Shooter and goalie IDs

Read the full file on GitHub · 255 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 255 lines · 120 tokens per session scan A 51496bee4f32

Subscribe to this mod's changes

xg-model-building is a skill published in the GitHub repository PuckAPI/claude-sports-analytics (3 stars, last pushed 4mo ago), licensed MIT. It adds 120 tokens to every session and 3,136 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

dspy-gepa

Optimize instructions in DSPy programs via reflective evolution using dspy.GEPA without adding few-shot examples. Use when you want to optimize instructions without few-shot examples — a lightweight alternative when you do not have or do not want to use demonstrations. Common scenarios - optimizing instructions when…

lebsral/DSPy-Programming-not-prompting-LMs-skills · 215 tokens

dspy-primitives

DSPy typed wrappers (dspy.Image, dspy.Audio, dspy.Code, dspy.History, dspy.File, dspy.Reasoning, dspy.Tool, dspy.ToolCalls, dspy.Example, dspy.Prediction) for multimodal data, files, and structured outputs in signatures. Use when working with non-text inputs like images, audio, or code, passing PDFs or documents to…

lebsral/DSPy-Programming-not-prompting-LMs-skills · 275 tokens

ai-monitoring

Know when your AI breaks in production. Use when you need to monitor AI quality, track accuracy over time, detect model degradation, set up alerts for AI failures, log predictions, measure production quality, catch when a model provider changes behavior, build an AI monitoring dashboard, or prove your AI is still…

lebsral/DSPy-Programming-not-prompting-LMs-skills · 161 tokens

ai-querying-databases

Build AI that answers questions about your database. Use when you need text-to-SQL, natural language database queries, a data assistant for non-technical users, AI-powered analytics, plain English database search, or a chatbot that talks to your database. Also used for text-to-SQL that actually works, AI SQL…

lebsral/DSPy-Programming-not-prompting-LMs-skills · 149 tokens

ai-searching-docs

Build AI that searches your documents and answers questions. Use when building a knowledge base, help center Q&A, chatting with documents, answering questions from a database, search-and-answer over internal docs, customer support bot, or FAQ system. Also use when embedding search loses critical context, retrieval…

lebsral/DSPy-Programming-not-prompting-LMs-skills · 93 tokens

ai-stopping-hallucinations

Stop your AI from making things up. Use when your AI hallucinates, fabricates facts, is not grounded in real data, does not cite sources, makes unsupported claims, or you need to verify AI responses against source material. Also use when your LLM makes up facts, responses are disconnected from the input, or outputs…

lebsral/DSPy-Programming-not-prompting-LMs-skills · 174 tokens