agentleFS
noahowshnoahowsh/birdieapi-mcp/skills/feature-engineering/SKILL.md

feature-engineering

Skill0 starsChanged 29 days agoMITView on GitHub

Builds leak-free model features for golf from BirdieAPI data: ratings as of a date, rolling strokes versus the field, field-strength adjusted form, course history with shrinkage, par-type splits, field and event features, with rules for time order and target definition. Use when the user is building a golf model and asks what features to use, how to compute form, how to avoid leakage, or how to structure a training table per golfer per tournament. Do not use for validating the model -- see walk-forward-validation. Do not use for the rating explanation -- see strokes-vs-field. Do not use for simulating tournaments -- see outright-model.

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use mean-reversion and position-sizing.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • agiprolabsSkill

    mean-reversion

    Mean-reversion strategy tools including Hurst exponent, half-life estimation, z-score signals, ADF testing, and Ornstein-Uhlenbeck modeling

    Also in 3 projects that use this

  • Bhala-SrinivashSkill

    position-sizing

    Calculate optimal position sizes for NSE/BSE equity trades using fixed fractional, ATR-based, and Kelly criterion methods. Includes portfolio constraints and leverage adjustments.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the free tier is the budget, train on ratings and leaderboards only (2 credits each) and add rounds for a shortlist.

    line 133

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Feature Engineering

Default data tool: BirdieAPI (birdieapi-tool). get_player_results (5 credits per player) is the workhorse: every round with adj_vs_field. get_ratings (2) with as_of supplies point-in-time ratings. get_leaderboard (2) supplies finishes.

You are an expert in building point-in-time features for golf. Your goal is a training table where every feature for a golfer-tournament row was knowable before round 1 of that tournament, and where the target is something with enough observations to learn from.

When to Use

  • "What features should I use to predict who wins?"
  • "How do I compute form without leaking the future?"
  • "How should I lay out the training table?"
  • Deciding whether course history, par-type splits or recent form belong in the model

When NOT to Use

  • Splitting data and scoring -- see walk-forward-validation
  • Explaining the rating -- see strokes-vs-field
  • Running the simulation -- see outright-model

Commands Available

CommandWhat It DoesCredits
get_player_resultsRound-level strokes, field_avg, vs_field, adj_vs_field, finish, per tournament5
get_ratingsRating at as_of2
get_leaderboardThe whole field, finishing order, cut status, rounds2
get_course_historyRecord at an event or course5
get_player_statsSeason hole scoring, sg_par*, ball-striking lines5
list_tournamentsThe event calendar and start_date for time ordering1

Commands That Do NOT Exist

Not AvailableUse Instead
get_features, get_training_dataBuild the table yourself from the calls above
get_world_ranking_historyget_ratings at different as_of dates
get_weather, get_tee_times, get_waveNot available; do not feature them
get_field for a future eventNot available

The table

One row per golfer per tournament. Order by start_date.

ColumnSourceNote
rating_asofget_ratings with as_of = day before round 1the main feature
weighted_roundssameconfidence in the rating
form_8, form_24get_player_results, last 8 and 24 rounds before this eventadj_vs_field mean
form_trendform_8 - form_24
par3_split, par4_split, par5_splitget_player_stats for the prior seasonsg_par*, score-based
course_fitget_course_history, shrunk (see course-fit)only editions before this one
n_prior_starts_eventsame
days_since_lastlist_tournaments / results dates
field_mean_rating, field_sizethe field's ratingsevent feature, shared by all rows
is_major, tourlist_tournaments
targetsee below

Targets

Winners are rare: one per event. Train on targets with enough data, then convert.

  • Best: round-level adj_vs_field for each golfer-round. Thousands of rows per season. Predict the mean, estimate the spread, simulate winners (see outright-model).
  • Good: made cut (binary), top 10 (binary), finishing percentile.
  • Last: winner (binary). Fewer than one positive per hundred rows. Use only for evaluation, not training, unless you pool many events.

How It Works

Step 1: Choose the unit and the clock. The clock is the tournament start_date. Every feature for a row uses data strictly before it.

Step 2: Rolling form with a shift.

import pandas as pd

# rounds: one row per golfer-round, columns: player_id, start_date, round, adj_vs_field
rounds = rounds.sort_values(["player_id", "start_date", "round"])
g = rounds.groupby("player_id")["adj_vs_field"]
rounds["form_8"] = g.transform(lambda s: s.shift(1).rolling(8, min_periods=4).mean())

shift(1) is the leakage guard: a round's own score is never in its own feature. But within a tournament, round 3 can see round 2 of the same event, which is not available before round 1 of a pre-tournament model. For pre-tournament features, aggregate by tournament first and shift by tournament:

per_event = rounds.groupby(["player_id", "start_date"])["adj_vs_field"].mean().reset_index()
per_event["form_2ev"] = (per_event.groupby("player_id")["adj_vs_field"]
                         .transform(lambda s: s.shift(1).rolling(2, min_periods=1).mean()))

Step 3: Point-in-time ratings. Pull get_ratings with as_of for each event date, keyed to the day before round 1. One call returns up to 500 players, so one call per event. For 30 events that is 60 credits.

get_ratings {"as_of": "2024-04-04", "limit": 500, "min_rounds": 20}

Step 4: Course history inside the clock. For event edition E, include only editions before E. The summary returned by get_course_history covers every edition, so do not use summary for training rows; recompute from editions filtered to earlier dates.

Step 5: Season-level stats. get_player_stats returns a full season. For an event in April 2024 use 2023, not 2024. The 2024 line already contains the event.

Step 6: Field features. Field mean rating and size are event-level. For the cut and for the winner probability, the strength of the competition matters as much as a golfer's own number.

Leakage checklist

LeakHow it happensFix
Today's rating on a past rowget_ratings without as_ofas_of day before
Season stats for the same seasonget_player_stats season = event yearuse the prior season
get_course_history summaryIncludes the target editionrebuild from editions
Rolling window without shiftRow includes its own roundshift(1) and tournament-level shifts
Random splitSame tournament in train and testsplit by date
Field proxy from resultsUsing the finished leaderboard as the pre-event fieldthe priced list or the user's list

Cross-tour features

Ids are shared across tours, so a LIV golfer's PGA Tour history joins on player_id. Ratings are not comparable across tours. Add tour as a feature, or fit separately, and treat cross-tour golfers with wider uncertainty.

Credit Usage

OperationCreditsNotes
Ratings for 30 events60one call per event
Rounds for 100 golfers500one call per golfer; exceeds the free tier
Course history for the top 20 in one event100

If the free tier is the budget, train on ratings and leaderboards only (2 credits each) and add rounds for a shortlist.

Anti-patterns

What Claude Might DoWhy It's WrongDo This Instead
Predict the winner label directlyAbout 1 positive per 100 rowsPredict round scores, simulate
Use finishing position as the targetDepends on field sizeUse strokes versus the field or percentile
Hand-pick features after seeing test resultsSelection leakageFix the list before the test period
Standardise on the full datasetTest statistics leak into trainFit scalers in the training window
Many highly correlated form windowsOverfit with few tournamentsTwo or three windows

Output Format

Training table: <N> golfer-events, <first season>-<last season>, one row per golfer per event
Features: rating_asof, weighted_rounds, form_8, form_24, par5_split, course_fit (shrunk), field_mean_rating
Target: mean adj_vs_field per round (regression), winners kept for evaluation
Leakage checks: ratings as_of day before round 1; season stats from prior season; no random split

What to Do Next

What You BuiltNext ActionSkill
A feature tableValidate in time orderwalk-forward-validation
A modelSimulate winnersoutright-model
ProbabilitiesCheck calibrationprobability-calibration

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.