eda-sports
Skill54 starsChanged 7 days agoMITView on GitHub
Exploratory data analysis for user-provided sports data: grain, key integrity, coverage, missingness, entity balance, base rates, outliers, structural breaks, and leakage red flags. Use before feature engineering or model fitting.
In this repository19 other files it gives its agents.
- anti-slop-analyticsSkill
- baseline-modelsSkill
- calibration-checkSkill
- data-sourcesSkill
- environment-setupSkill
- experiment-logSkill
- feature-rulesSkill
- leakage-auditSkill
- model-cardSkill
- model-interpretationSkill
- predictive-modelingSkill
- ratings-strength-modelsSkill
- results-reportingSkill
- simulation-sportsSkill
- sports-modeling-doctrineSkill
- sports-visualizationSkill
- statistical-modelingSkill
- time-series-sportsSkill
- validation-designSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
before feature engineering or first model fit.
- Distinctive: line 33
Do not use this skill as a substitute for:
- Distinctive: line 48
Before calculating summaries, record the question, target, prediction time T, claimed row grain and key, source/retrieval time, requested …
- Distinctive: line 52
Use the EDA checklist as the full run sheet.
- Distinctive: line 68
Write findings, repairs, limitations, and the decision.
- Distinctive: line 70
If grain is wrong or keys are unexplained duplicates, stop before modeling.
- Very specific: line 92
Do not call drop_duplicates() until the cause is known.
- Distinctive: line 166
Check scores, margins, counts, and rates against sport semantics.
- Distinctive: line 173
Before pooling seasons, check rule and overtime changes, schedule length, shortened seasons, labor disruptions, expansion/relocation, …
- Distinctive: line 242
Never hide incomplete periods, missing entities, or repairs.
- Very specific: line 245
Use references/eda_checklist.md for completeness, references/grain_guide.md for grain/key questions, and references/red_flags.md for …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
EDA for Sports Data
Outcome
Understand the data well enough that the next decision is explicit. Sports EDA
is not one call to describe(): it is a structured review of grain, keys, time
coverage, entities, missingness, targets, schedule structure, outliers,
structural breaks, and fields unavailable at prediction time T.
Finish with a written go, repair, or stop decision. A clean EDA report does not certify that engineered features are time-safe.
When to Use This Skill
Use when:
- a sports table is new, freshly loaded, or not yet trusted;
- grain, keys, coverage, missingness, or base rates need an honest audit;
- before feature engineering or first model fit;
- a weird model result might just be bad data structure.
Do not use this skill as a substitute for:
- formal leakage verdicts →
leakage-audit; - feature construction →
feature-rules/time-series-sports; - source selection →
data-sources.
| Need | Go instead |
| Choose a public source | data-sources |
| Build legal features | feature-rules |
| Prove time-safety | leakage-audit |
| Charts only | sports-visualization |
Required context
Before calculating summaries, record the question, target, prediction time T, claimed row grain and key, source/retrieval time, requested period, completion status, and populations included. If grain or T is ambiguous, resolve it first.
Use the EDA checklist as the full run sheet. Read the grain guide when row meaning, keys, or aggregation are in doubt. Use the red-flags guide when a count, base rate, or model result is odd.
Workflow
- Define one row: game, team-game, player-game, play, possession, pitch, or event.
- Count rows/columns; test natural-key uniqueness and rows per contest.
- List seasons, weeks/rounds, dates, gaps, partial periods, and active seasons.
- Count teams/players by season and inspect ID churn and failed joins.
- Measure missingness overall and by season, source, role, and completion state.
- Inspect targets, base rates, impossible values, ties, overtime, and zero inflation.
- Slice meaningful predeclared groups: home/away, phase, role, venue, and era.
- Find rule, schedule, provider, tracking, definition, and population breaks.
- Flag fields unavailable at T; reserve the formal verdict for
leakage-audit. - Write findings, repairs, limitations, and the decision.
If grain is wrong or keys are unexplained duplicates, stop before modeling.
Grain and key diagnostics
| Grain | One row | Typical key | Main trap |
| Game | one contest | game_id | mixing team perspectives |
| Team-game | one team in one contest | game_id, team | treating doubled rows as games |
| Player-game | one player in one contest | game_id, player_id | ignoring DNP/inactive policy |
| Play/event | one event | game_id, event_id | using post-event fields at pre-event T |
| Pitch | one pitch | game_pk, pitch_no | unstable event ordering |
These checks use the team-game panel from data-sources: team, opponent, game_id, season, game_date, event_time, is_home, won, and point_diff.
key = ["game_id", "team"]
dupes = panel.duplicated(key, keep=False)
print("duplicate key rows:", int(dupes.sum()))
print(panel.loc[dupes].sort_values(key).head(20))
print(panel.groupby("game_id", dropna=False).size().value_counts().sort_index())Do not call drop_duplicates() until the cause is known. Repeated pulls,
provider revisions, multiple competitions, and mixed grains need different
repairs. A normal team-game panel usually has two rows per game.
Coverage and entity balance
import pandas as pd
panel["game_date"] = pd.to_datetime(panel["game_date"])
coverage = (
panel.groupby("season", dropna=False)
.agg(rows=("game_id", "size"), games=("game_id", "nunique"),
teams=("team", "nunique"))
.reset_index()
)
print(coverage.to_string(index=False))
print(panel.groupby(["season", "team"]).size().unstack(0).fillna(0))Investigate empty periods, low game counts, abrupt entity-count changes, and the tail of an active season. Imbalance can be real—byes, playoffs, injuries, promotion/relegation—but can also reveal missing loads. Use stable IDs and a documented crosswalk for relocations and renames.
sportsleader-data games rows are one game each, with season, game_id, game_date, home_team_id, and away_team_id. Team files are one row per team per game, with team_id and game_date (a date, not a datetime) and no start_time. There is no week column. The panel in data-sources renames team_id to team and joins games.start_time as event_time.
Panel base rates
On a complete two-row team-game panel, overall won.mean() is near 0.5 because
each game contributes both perspectives. It is not home advantage.
home = panel.loc[panel["is_home"].eq(1)].copy()
print("overall team-row win rate:", panel["won"].mean())
print("home win rate:", home["won"].mean())
print(home.groupby("season")["won"].mean())Ties, neutral sites, forfeits, incomplete games, and duplicate perspectives can alter this identity. Explain them rather than forcing the expected value.
Missingness
Overall rates can hide an era or provider boundary:
critical = [c for c in ["event_time", "score", "opponent_score", "won", "point_diff"] if c in panel]
print(panel[critical].isna().mean().sort_values(ascending=False))
print(panel.groupby("season")[critical].agg(lambda s: s.isna().mean()))Classify each important pattern as structurally expected, temporarily unavailable, failed collection/join, not applicable, or unknown. Never silently fill early-history rolling nulls with zero; feature rules must define a prior, missing indicator, or minimum-history threshold.
Targets, distributions, and outliers
print(home["point_diff"].describe(percentiles=[.01, .05, .5, .95, .99]))
print(panel["won"].value_counts(dropna=False, normalize=True))import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(8, 4.5))
ax.hist(home["point_diff"].dropna(), bins=40, edgecolor="black", alpha=.85)
ax.axvline(0, color="red", linestyle="--")
ax.set(title=f"Home point differential (n={len(home):,})", xlabel="point differential")
ax.grid(alpha=.25, axis="y")
plt.show()Check scores, margins, counts, and rates against sport semantics. Determine whether extremes are authentic, unit errors, or duplicates. For count targets, report zeros and overdispersion; for players, slice by role and playing-time eligibility before comparing distributions.
Structural breaks
Before pooling seasons, check rule and overtime changes, schedule length, shortened seasons, labor disruptions, expansion/relocation, tracking start dates, provider/schema migrations, definition revisions, and playoff mixing. A real break may require a known-at-T era flag, separate analyses, a sliding window, or exclusion. Do not normalize it away without explanation.
Leakage scouts
For a pre-event task, current-event outcomes and summaries are legal labels but illegal predictors: current score, margin, result, yards, EPA, win probability, box-score totals, final-season aggregates, and post-event participation.
suspects = {"points_for", "points_against", "won", "point_diff", "final_score"}
print("present suspects:", sorted(suspects.intersection(panel.columns)))Presence is not failure; use as a pre-event feature is. Keep candidate features
separate and send them through feature-rules and leakage-audit.
Panel report
Read the user's CSV, Parquet, or JSON. For a team-game table derived from sportsleader-data team_game_stats or team_box_scores, expect season, game_id, team_id, is_home, score, and opponent_score. Derive won only after deciding how ties are labeled. games is one row per contest; do not require two team rows there.
Do not guess missing columns. Stop or write an explicit reviewed mapping. Issue GO, REPAIR, or STOP. A team-game table with a null natural key, a duplicate (game_id, team_id), or a completed game that does not have exactly two team rows and exactly one home row is STOP. Missing outcomes are REPAIR: upcoming games rows have no score and must be separated from completed-event analysis. GO still requires the time and leakage reviews above.
Red flags
| Symptom | Interpretation | Action |
| duplicate natural keys | mixed grain or repeated records | inspect groups; repair cause |
| wrong rows per contest | incomplete/mislabeled panel | rebuild or restate grain |
| entity count jump | real expansion or ID churn | verify and document crosswalk |
| empty periods | incomplete pull or active season | quantify and reload if unexpected |
| constant scores/target | corrupt source or filter | stop and verify source |
| overall win rate near .5 on team-game | expected pairing | use one perspective for game claims |
| early form null | no history | specify prior/minimum history |
| near-perfect first model | leakage until disproved | stop; run leakage-audit |
EDA note template
Question / target / decision time T:
Dataset, source, retrieval/version:
Grain and natural key:
Population and period:
Rows / games / entities:
Key and rows-per-game findings:
Coverage gaps:
Missingness findings:
Target, distribution, and slice findings:
Structural breaks:
Leakage suspects:
Repairs performed / remaining limitations:
Artifacts and plots:
Decision: GO | REPAIR | STOP
Reasons and next action:Worked example
For a two-season pre-game team win project: declare (game_id, team_id) on a team file; confirm two rows per completed game and expected season coverage;
measure home win rate on home rows; separate future scheduled games from failed
result joins; mark current score/result fields target-only; record era/provider
breaks; and issue GO only for the supported population.
Integrity and resource routing
- State grain before metrics; never model through unexplained duplicate keys.
- Never hide incomplete periods, missing entities, or repairs.
- Compare base rates on the correct independent unit.
- Preserve raw data and separate outcomes from feature candidates.
- Use
references/eda_checklist.mdfor completeness,references/grain_guide.mdfor grain/key questions, andreferences/red_flags.mdfor diagnosis.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

