skills/mlb-regression-flagger/SKILL.md
Identifies fantasy baseball players whose surface stats (wOBA, ERA, batting average) are diverging from their underlying Statcast quality (xwOBA, FIP, xBA) — emits a `regression_index` from -100 (very lucky, sell high) to +100 (very unlucky, buy low). Primary signal for buy-low/sell-high decisions on trades and waivers. Use when user mentions "buy low", "sell high", "regression candidate", "lucky", "unlucky", "xwOBA gap", "ERA-FIP gap", "BABIP", "due for regression", or is deciding whether to trade for / trade away a player based on over- or under-performance.
npx skillsauth add lyndonkl/claude mlb-regression-flaggerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Scenario: User asks "Is Junior Caminero a buy-low candidate or am I chasing noise?"
Raw data gathered from Baseball Savant + FanGraphs (cite URLs):
Regression index calculation:
regression_index = (xwOBA - wOBA) x 500
= (.380 - .310) x 500
= +35
Secondary check — BABIP: .255 is below the .240 lower-outlier threshold for hitters only if we tighten further, but .255 plus elite contact quality confirms unlucky. Not a "will correct to .300" player, but unlikely to stay at .255 given the batted-ball profile.
Verdict: regression_index = +35 → BUY. Caminero has been unlucky; underlying contact quality is elite. Expect his surface stats to catch up over the next 30 days.
User-facing translation (per CLAUDE.md rule #5 — beginner writing):
"Junior Caminero's raw numbers look mediocre (.310 wOBA — that's a catch-all hitting stat), but the quality of his actual contact (how hard and at what angle he hits the ball) suggests he should be hitting .380. The gap is one of the biggest in the league. ADD if available, or OFFER a trade for him before his stats correct."
Signal file emission (per signal-framework.md):
---
type: regression
date: 2026-04-17
emitted_by: mlb-regression-flagger
player: Junior Caminero
regression_index: +35
direction: BUY
confidence: 0.78
source_urls:
- https://baseballsavant.mlb.com/savant-player/junior-caminero-...
- https://www.fangraphs.com/players/junior-caminero/...
---
Copy this checklist and track progress:
Regression Flagger Progress:
- [ ] Step 1: Define the candidate list (who to check)
- [ ] Step 2: Web-search Savant for expected stats (xwOBA, xERA, xBA)
- [ ] Step 3: Web-search FanGraphs for surface stats (wOBA, ERA, BABIP, HR/FB)
- [ ] Step 4: Compute regression_index per player
- [ ] Step 5: Apply secondary flags (BABIP, HR/FB)
- [ ] Step 6: Emit signal file + user-facing translation
Step 1: Define the candidate list
Who are we checking? Three entry points:
Step 2: Web-search Baseball Savant for expected stats
See resources/methodology.md for exact queries and URL patterns.
xwOBA, xBA, xSLG, Barrel %, Hard-Hit %xERA, Expected Batting Average against, Whiff %, Chase %source_urls for the signal fileStep 3: Web-search FanGraphs for surface stats
See resources/methodology.md for query patterns.
wOBA, BABIP, AVG, OBP, SLGERA, FIP, xFIP, HR/FB %, LOB %Step 4: Compute regression_index
See resources/methodology.md for the formulas.
regression_index = (xwOBA - wOBA) x 500, clamped to ±100regression_index = (FIP - ERA) x 50, clamped to ±100
Step 5: Apply secondary flags
regression_index. When they agree, confidence goes up; when they disagree, confidence drops and the player goes into a "watchlist" bucket instead of an actionable BUY/SELL.Step 6: Emit signal file + user-facing translation
signals/YYYY-MM-DD-regression.md with frontmatter per signal-framework.mdBUY / SELL / HOLD / ADD / DROP (per CLAUDE.md rule #6)Pattern 1: The Elite-Contact, Bad-Luck Hitter (classic BUY)
+35, BUY.Pattern 2: The Lucky Journeyman (classic SELL)
-22, SELL.Pattern 3: The Pitcher-Lucky Starter (SELL)
(FIP - ERA) x 50 = (4.20 - 2.50) x 50 = +85. But for pitchers a large FIP-ERA gap means he has been LUCKY → flip sign → -85, SELL. See methodology for sign convention.Pattern 4: The Pitcher-Unlucky Starter (BUY)
Pattern 5: Conflicting Signals (WATCHLIST, not actionable)
regression_index with reduced confidence (< 0.5) and place on watchlist for another week.Sample-size minimum: Do not emit a regression_index for a hitter with fewer than 80 PAs or a pitcher with fewer than 30 IP. Statcast expected stats are noisy below that. If below threshold, emit confidence: 0.3 and label too-early.
Sign convention for pitchers: (FIP - ERA) x 50 gives a raw number. A POSITIVE raw number means ERA < FIP → the pitcher has been LUCKY → negate to produce a NEGATIVE regression_index (SELL signal). A NEGATIVE raw number means ERA > FIP → UNLUCKY → negate to POSITIVE (BUY). Always negate. See methodology for the worked example. Hitters use the raw sign directly.
Clamp to ±100: Extreme xwOBA gaps (>.200) are almost always small-sample artifacts. Clamp hard. Do not report regression_index of +140.
Park and platoon adjustments: xwOBA from Savant is park-neutral but does not adjust for platoon splits. For a LHH playing in a tough-for-lefties park (e.g., Oracle) with many LHP starts ahead, the regression may be slower than the index suggests. Note as a caveat; do not recompute.
BABIP is secondary, not primary: A high BABIP alone is not a SELL signal if underlying contact quality is elite. Hitters with extreme exit velocity (e.g., Judge, Ohtani) sustain BABIPs above .340 for full seasons. Always cross-check BABIP against Hard-Hit % before flagging.
HR/FB normalization for pitchers: League-average HR/FB is ~12%. Pitchers regress toward their career HR/FB, not league average. A flyball pitcher's "normal" HR/FB is 14%; a groundball pitcher's is 9%. Use career or 3-year average when available; fall back to 12% only if no history.
Web-search every fact (per CLAUDE.md): Every number that enters the formula must come from a live web search with the URL recorded in source_urls:. Never fill in from memory or training data. If a search fails, degrade to confidence: 0.3 and flag in the red-team pass.
Translate for the beginner: The user has zero baseball knowledge. Every user-facing sentence that uses "xwOBA", "FIP", "BABIP" must include an inline translation on first use. See CLAUDE.md rule #5 and the Example above.
Core formulas:
HITTER: regression_index = clamp((xwOBA - wOBA) x 500, -100, +100)
positive = UNLUCKY (BUY); negative = LUCKY (SELL)
PITCHER: raw = (FIP - ERA) x 50
regression_index = clamp(-raw, -100, +100)
positive = UNLUCKY (BUY); negative = LUCKY (SELL)
SECONDARY (hitter): BABIP > .370 → lucky flag; BABIP < .240 → unlucky flag
SECONDARY (pitcher): HR/FB < 8% → lucky flag; HR/FB > 17% → unlucky flag
Action thresholds:
| regression_index | Direction | Fantasy action |
|---|---|---|
| ≥ +30 | Very unlucky | Aggressive BUY / ADD / high FAAB bid |
| +15 to +29 | Mildly unlucky | BUY if available cheaply |
| -14 to +14 | Noise | HOLD / no action |
| -29 to -15 | Mildly lucky | SELL if offered market-rate |
| ≤ -30 | Very lucky | Aggressive SELL / DROP / decline offers |
Data source map (per data-sources.md):
| Stat | Primary source | URL pattern | |---|---|---| | xwOBA, xBA, xSLG, Barrel %, Hard-Hit % | Baseball Savant | https://baseballsavant.mlb.com/savant-player/{slug}-{id} | | wOBA, BABIP (hitter) | FanGraphs | https://www.fangraphs.com/players/{slug}/{id} | | ERA, FIP, xFIP, HR/FB, LOB% | FanGraphs | same | | xERA | Baseball Savant | same |
Key resources:
Inputs required:
context/league-config.md and mlb-category-state-analyzer signals)Outputs produced:
regression_index per player (-100 to +100)BUY / SELL / HOLD / WATCHLISTsignals/YYYY-MM-DD-regression.mdtesting
Cluster a conference's event records into a small set of coarse themes with finer sub-clusters, an explicit outlier bucket, and soft (multi-membership) affinities — using the hybrid embed-then-label pipeline (embed abstracts, reduce, density-cluster, then LLM-label the clusters) when embedding libraries are available, and an LLM-reasoned hierarchical fallback when they are not. Embeddings do the grouping; the LLM only names the groups. Conference-agnostic. Use when turning structured event records into a navigable theme map for preference elicitation and scheduling, when you need 6-8 reasonable themes rather than 20 muddy ones, or when overlapping talks must belong to more than one theme. Trigger keywords - theme clustering, cluster talks, embed then label, soft membership, outlier talks, conference themes, topic map.
development
Build a personal conference schedule as a constraint-optimization problem — hard constraints (no time overlap, room-to-room travel time, capacity/registration, the attendee's own must-attends and blackouts) plus a user-owned weighted objective trading interest against breadth, pacing (maximize contiguous free time), and serendipity. Surfaces unbreakable conflicts (two high-value overlapping talks the model cannot rank) as decisions for the human rather than silently picking, and reports what each choice traded away. Conference-agnostic. Use to turn a preference profile plus a theme map into a day-by-day plan, to resolve overlapping sessions, or to balance a packed vs paced schedule. Trigger keywords - schedule optimization, conference schedule, constraint optimization, overlapping talks, contiguous free time, conflict surfacing, packed vs paced.
development
Parse a heterogeneous conference program (markdown, HTML, PDF-derived text, or JSON) into normalized event records with per-field confidence scores and independent classification axes (topic, depth, format, prerequisites, recorded, capacity). Detects the program's format before extracting, treats every inferred field as uncertain (present vs inferred vs missing), and flags thin or missing abstracts so downstream enrichment can target them. Conference-agnostic. Use when ingesting a conference or event schedule into a structured store, normalizing a talk/session list, or extracting per-session metadata with calibrated confidence. Trigger keywords - program ingestion, parse schedule, session extraction, event records, conference program, talk metadata, per-field confidence.
development
Build a personalized preference profile from a small number of well-chosen, cluster-grounded questions instead of a long survey. Represents the person's interests as an uncertainty region over the theme map, picks the single highest-information-gain choice-based question (contrasting real talks from different clusters), balances exploiting known interests against exploring uncertain ones, deliberately injects outlier probes to fight selection bias, and stops as soon as the schedule would be stable. Also elicits the user-owned objective weights and hard constraints. Interactive — runs where it can actually ask the person. Conference-agnostic. Use to turn a theme map into a preference profile, to decide what to ask a conference attendee, or to elicit scheduling priorities. Trigger keywords - preference elicitation, ask few questions, information gain, choice-based questions, selection bias probe, objective weights, attendee preferences.