بنقرة واحدة
sdv-new-example-notebook
Scaffold a per-sport intro Jupyter notebook (examples/notebooks/0X_<sport>_intro.ipynb).
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Scaffold a per-sport intro Jupyter notebook (examples/notebooks/0X_<sport>_intro.ipynb).
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when porting R logic into the Python SportsDataverse package (sdv-py) — e.g. translating an nflfastR / cfbfastR / cfbscrapR / baseballr / hoopR R function, reconciling a fix from the pandas `0.36-live` branch into polars `main`, or re-implementing a modeling recipe (EP/WP/QBR/CPOE) from R. Enforces a parity-test-first workflow (golden fixture from the R output → failing parity test → port → green) and the polars-1x + ID-dtype + no-lookaround conventions. Also covers R numeric fidelity when outputs must match R bit-for-bit (R>=4.0 fround, 80-bit long-double sum, non-na.rm null-poisoning, dplyr group order), stale-fork sibling packages (wbigballR-style), and oracle integrity (a browser/rvest-captured oracle can be corrupt — fix the bug, don't match it). Invoke for "port this R function to polars", "port from nflfastR/bigballR", "reconcile 0.36-live into main", "translate this dplyr/np.select to polars", "re-implement the R model recipe in Python", or when a parity test fails on a handful of rounding-boundar
Use when shipping a change in sportsdataverse-py (sdv-py) — opening, pushing, or merging a PR. Runs the steps in the correct order (regenerate codegen docs, update changelog/docs/tutorials, lint, full pytest, commit + verify it landed, push, triage bot reviews CodeRabbit/Sourcery/Copilot immediately — in parallel with CI, not after it — wait for CI green, confirm merge, write a session note) and never cleans up a branch before the merge is confirmed. Invoke for "ship this", "open/merge the PR", "land this change", or any end-of-change release flow.
Use when executing a model-spine implementation plan (the ClaudeCowork specs/plans backlog — prediction stacks, ratings engines, projection/impact models) or building any oracle-gated analytics module in an SDV repo. Covers the full loop — isolated worktree + baseline, Phase-0 oracle harness (metrics/constants/leakage split/fixtures), per-task TDD with verified commits, oracle gates with the never-lower rule, league-shim parity, mypy/codegen close-out, reviewer pass, and the session restart prompt. Invoke for "implement T<x>", "start the <sport> model spine", "continue the prediction stack", or any multi-phase model build.
Use when capturing an external oracle/validation corpus into committed test fixtures — Torvik/KenPom ratings, ESPN BPI/predictor/odds, market closing lines, MoneyPuck, published RAPM/EPM, or any third-party reference a model gate will assert against. Covers column contracts, Utf8-id discipline, the team/player name-crosswalk recipe (contracting normalizer + candidate keys + alias table + match-rate reporting), rate-limit-aware sampling, and the mandatory provenance README. Invoke for "capture the oracle corpus", "commit the <source> fixtures", or any Task-0-style fixture capture in a model plan.
Use when porting Python logic from the SportsDataverse Python package (sdv-py) into a SportsDataverse R package — cfbfastR, hoopR, wehoop, baseballr, fastRhockey, softballR, etc. Enforces a parity-test-first workflow (golden fixture from the Python output → failing testthat test → port → green) plus the tidyverse/data.table idiom map and R package conventions (roxygen2 docs, snake_case, tibble returns, pkgdown reference coverage). Invoke for "port this to cfbfastR", "translate this polars logic to dplyr", "re-implement the sdv-py parser in R", or "bring this Python fix back to the R package".
Add a CBS Sports (NAPI) league/resource — capture + catalog in sdv-internal-refs/cbs.
| name | sdv-new-example-notebook |
| description | Scaffold a per-sport intro Jupyter notebook (examples/notebooks/0X_<sport>_intro.ipynb). |
| disable-model-invocation | true |
Add a new per-sport intro notebook that parallels the existing set under examples/notebooks/. Each notebook demonstrates the canonical surface for one sport in a consistent order, making the set easy to navigate across sports.
Notebooks use zero-padded two-digit prefixes so they sort correctly:
examples/notebooks/
01_nfl_intro.ipynb
02_cfb_intro.ipynb
03_nba_intro.ipynb
04_wnba_intro.ipynb
05_mbb_intro.ipynb
06_wbb_intro.ipynb
07_nhl_intro.ipynb
08_mlb_intro.ipynb
09_<new_sport>_intro.ipynb ← your file
Pick the next available number. The set must stay parallel — every sport gets exactly one intro notebook.
# <Sport Full Name> — sportsdataverse-py intro
Short one-paragraph description of the sport module and what data it provides.
Links: package docs, companion R package (e.g. hoopR / wehoop / cfbfastR).
import polars as pl
import sportsdataverse.<sport> as <abbr>
print(pl.__version__)
print(<abbr>.__version__ if hasattr(<abbr>, "__version__") else "ok")
schedule = <abbr>.espn_<sport>_schedule(season=2024, return_parsed=True)
print(schedule.shape)
schedule.head(5)
One markdown cell before it explaining what the schedule endpoint returns (columns to highlight: game_id, date, home_team, away_team, home_score, away_score).
# Pick a recent completed game_id from schedule above
game_id = int(schedule.filter(pl.col("home_score").is_not_null())["game_id"][0])
pbp = <abbr>.espn_<sport>_pbp(event_id=game_id, return_parsed=True)
print(pbp.shape)
pbp.select(["clock_display_value", "type_text", "text", "score_value"]).head(10)
teams = <abbr>.espn_<sport>_teams(return_parsed=True)
print(teams.shape)
teams.head(5)
standings = <abbr>.espn_<sport>_standings(season=2024, return_parsed=True)
standings.head(10)
Adapt to whatever the sport's canonical season-level endpoint is (scoreboard, standings, statistics).
Include only when the sport uses the NFL-style cache layer:
from sportsdataverse.nfl import get_config, update_config, clear_cache
print(get_config())
update_config(cache_mode="memory", cache_duration=3600)
# ... call a loader ...
clear_cache()
## Next steps
- PBP deep-dive: see `examples/notebooks/0X_<sport>_pbp_deep_dive.ipynb` (if it exists)
- R parity: [<companion R package>](<url>)
- Full API reference: [sportsdataverse docs](https://py.sportsdataverse.org)
If the repo has nbstripout configured (check .gitattributes for *.ipynb filter=nbstripout), all cell outputs are stripped automatically on git add. If not configured, strip outputs manually before committing:
uv run jupyter nbconvert --ClearOutputPreprocessor.enabled=True \
--to notebook --inplace examples/notebooks/09_<sport>_intro.ipynb
Never commit notebooks with large embedded outputs (images, full DataFrames) — they bloat the repo and produce noisy diffs.
0X_<sport>_intro.ipynb with the correct next number.SDV_PY_LIVE_TESTS=1 uv run jupyter nbconvert --to notebook --execute ...).See Also cross-links point to the correct companion R package URL from the CLAUDE.md table.