Designs ML features with leakage-safe pipelines, correct categorical encoding by cardinality, numeric transforms, and validation that a feature earns its place. Use when someone asks "how should I encode this high-cardinality column", "why does my model score great offline and fail in production", "what features should I build from this table", or "should I scale these inputs". Do NOT use for building the serving infrastructure that stores and versions features across models - use feature-store-design instead; for detecting when live feature distributions shift after deployment - use data-drift-monitor instead; for initial dataset exploration and profiling - use eda-playbook instead.
Click to play with sound.
---
name: Feature Engineering
description: Designs ML features with leakage-safe pipelines, correct categorical encoding by cardinality, numeric transforms, and validation that a feature earns its place. Use when someone asks "how should I encode this high-cardinality column", "why does my model score great offline and fail in production", "what features should I build from this table", or "should I scale these inputs". Do NOT use for building the serving infrastructure that stores and versions features across models - use feature-store-design instead; for detecting when live feature distributions shift after deployment - use data-drift-monitor instead; for initial dataset exploration and profiling - use eda-playbook instead.
---
# Feature Engineering
Most "amazing offline, useless in production" models are not modeling failures - they are leakage failures introduced during feature engineering. This skill builds features that improve cross-validated performance without smuggling the target into the inputs, and rejects features that only look good because they cheated.
## Operating procedure
Leakage prevention comes first because every later step (encoding, aggregation, imputation) is a leakage opportunity; validation comes last because a feature that does not move the cross-validated metric does not ship.
### Step 1: Gather inputs
Collect before writing transforms; label unknowns as guesses.
1. Prediction task and the exact prediction time: what is known at the moment the model must predict? Everything else is off-limits.
2. Target definition and how it was produced - features derived from the same process as the label are proxy-leakage suspects.
3. Data shape: row count, column list with dtypes, entity keys, and whether rows have a time dimension.
4. Model family (linear, tree ensemble, neural) - it determines which transforms are necessary and which are wasted work.
5. Serving constraints: will these features be computable at inference time with the same code and latency budget?
### Step 2: Lock the leakage rules
… install to load the full skill