Generate Yahoo Fantasy Baseball weekly/cumulative H2H comparison tables and ranking analysis as PNG images. Use when user asks for fantasy stats tables, weekly H2H matrix, cumulative stats grid, or rank comparison report.
Produces three PNG report tables from Yahoo Fantasy Baseball league data:
| Phase | Output | Detail file |
|---|---|---|
| 1 | Weekly H2H final grid (single week, all teams vs all teams across 14 cats) | phases/1-weekly-final.md |
| 2 | Cumulative H2H grid (sum across N weeks) | phases/2-cumulative-stats.md |
| 3 | Rank comparison: actual standings vs strength-derived ranks | phases/3-rank-comparison.md |
User can request a single phase or all three.
Try a cheap MCP call first. If it fails with auth error, run authentication flow:
mcp__yahoo-fantasy__get_leagues
If auth needed:
mcp__yahoo-fantasy__authenticate (no args) to open browsercode= value from the redirect URLmcp__yahoo-fantasy__authenticate with the codeget_leaguesFrom get_leagues, identify the MLB league. If multiple, ask user which one. Save:
league_keycurrent_week (from league info)Get the raw team list:
mcp__yahoo-fantasy__get_league_teams(league_key)
Then resolve display nicknames by piping the Yahoo output through load_config.py:
echo '<yahoo_teams_json>' | python3 scripts/load_config.py --league-key <league_key>
This returns:
{
"teams": {"469.l.103062.t.1": "子亘", ...},
"display_order": ["子亘", "峻維", ...],
"source": "config" | "fallback"
}
source: "config" — the user has ~/.config/yahoo-fantasy-stats/{league_key}.json set up with custom nicknames. Use it as-is.source: "fallback" — no config file found. The mapping is just team_key → Yahoo team name. This works but doesn't give custom nicknames.If source is fallback, ask the user:
沒有找到暱稱設定檔。要用 Yahoo 的 team name 繼續,還是先建一份 nickname 設定檔?
If they want to set up:
echo '<yahoo_teams_json>' | python3 scripts/load_config.py --init --league-key <league_key>
This writes a template at ~/.config/yahoo-fantasy-stats/{league_key}.json. Tell the user to edit the teams values (currently Yahoo team names) into their preferred nicknames, and adjust display_order for their preferred row ordering. Then re-run the skill.
Store the resolved teams dict and display_order — they are the canonical mapping and row order used by every subsequent phase.
Ask the user which output they want unless it's clear from the request:
For Phase 3, you must have run Phase 1 (sum across weeks) and Phase 2 first to get the strength values per team.
All scripts write PNG files to /tmp/yahoo-fantasy-stats/. Tell the user the absolute path when done so they can open it.
Stat categories — order matters for rendering:
R, HR, RBI, SB, BB, AVG, OPSW, SV, K, QS, BB, ERA, WHIP
W, SV, K, QSBB, ERA, WHIP (BB here = walks issued)H2H comparison between team_i and team_j for each stat:
+1 if team_i is better
-1 if team_j is better
0 if tied
Strength score for team_i = sum over all (j ≠ i, all 14 stats) of the comparison value. Each H2H matchup contributes a number in [-14, +14]; total strength is in [-154, +154] for a 12-team league.
Sub-strengths:
Scripts use only Python stdlib + Chrome headless (already installed at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome). No pip install required.