Purpose
Turn "analyze this dataset" or "build a model" into a structured,
leakage-checked, baseline-anchored workflow instead of jumping straight to a
sophisticated model that may be solving the wrong problem or trained on a
false signal.
When to use
- Asked to analyze a tabular dataset, build a predictive/classification
model, or evaluate model performance.
- Asked to investigate a data quality issue (missingness, duplicates,
suspicious distributions) in tabular data.
When NOT to use
- The question is answerable with a single, simple aggregation ("what's the
average order value last month") — just answer it; the full workflow is
overkill.
- The task is ETL/pipeline engineering with no analysis or modeling
question attached.
- Never jump straight to a sophisticated model. Always establish a naive
baseline first (step 10) — a model that doesn't beat the baseline is a
negative result worth reporting, not a failure to hide.
Required inputs
- The dataset (file path or description of where it lives) and, if this is
a modeling task, what's being predicted and why (the business/decision
context — see step 1).
Workflow
- Understand the decision/business problem — what decision would this
analysis or model actually inform? A model with no decision attached is
a request to clarify, not a request to start training.
- Inspect the dataset — shape, column types, a sample of rows. Use
scripts/profile_dataset.py.
- Validate schema — expected columns present, types sane, value ranges
plausible. Mismatches here should stop the workflow, not be silently
worked around.
- Identify the target (if modeling) — confirm what column is being
predicted and its distribution (class balance for classification, shape
for regression).
- Detect leakage — features that wouldn't be available at prediction
time, or that are direct proxies/derivatives of the target. Use
scripts/check_leakage.py; read references/data-leakage.md for the
mechanisms to check beyond what the script catches.
- Check missingness — patterns, not just totals (missing-at-random vs.
missing-not-at-random matters for how to handle it). Use
scripts/check_missingness.py.
- Check duplicates/outliers — use
scripts/detect_duplicates.py;
investigate outliers rather than dropping them reflexively.
- EDA — distributions, correlations with the target, relationships
between key features. Let this inform, not replace, the hypotheses step.
- Hypotheses — state what you expect to find and why, before or
alongside EDA, so results can be interpreted against expectations.
- Choose the evaluation metric — read
references/evaluation-metrics.md
and pick the metric that matches the actual decision from step 1, not
the most common default. State why.
- Create a naive baseline — for classification: majority class or a
simple rule; for regression: mean/median predictor. This is
non-negotiable — every later model is judged against it.
- Feature engineering — only after the baseline exists, so its value
is measurable.
- Train candidate models — start simple (e.g. logistic/linear
regression) before complex models; complexity must earn its keep against
the next-simplest option, not just against the baseline.
- Compare with baseline — use
scripts/evaluate_predictions.py. If a
model doesn't beat the baseline meaningfully, report that plainly.
- Error analysis — look at what the best model gets wrong and why,
not just the aggregate metric.
- Slice analysis — check performance across meaningful subgroups
(segments relevant to the decision from step 1); an aggregate metric can
hide a subgroup where the model is actually harmful or useless.
- Interpretation — connect findings back to the original decision.
- Recommendations — what should actually change/happen as a result.
Read references/classification.md, references/regression.md, or
references/time-series.md depending on the problem type before step 10 —
each affects which metrics and validation strategy are valid, especially
for time-series, where standard k-fold cross-validation leaks future
information into the past.
Tool & resource guidance
Run the deterministic scripts for anything they can determine exactly —
don't eyeball a .describe() output for missingness when
scripts/check_missingness.py gives an exact, reproducible answer.
python scripts/profile_dataset.py data.csv
python scripts/check_missingness.py data.csv
python scripts/detect_duplicates.py data.csv
python scripts/check_leakage.py data.csv --target outcome
python scripts/evaluate_predictions.py predictions.csv --y-true actual --y-pred predicted
python scripts/generate_summary.py data.csv --target outcome
Each script is standalone (python scripts/<name>.py --help) and requires
only pandas/numpy — install via pip install -e '.[data-scientist]' from
the repo root, or pip install pandas numpy directly.
Read references/experiment-design.md before recommending an A/B test or
similar experiment based on the analysis.
Output contract
A findings summary covering: the decision context, key EDA findings, the
chosen metric and why, baseline performance, best model performance and
whether it beats baseline, error/slice analysis findings, and concrete
recommendations. For pure data-quality investigations (no modeling), the
same contract minus the modeling-specific sections.
Quality checks
Edge cases
- Task is analysis-only, no modeling needed: skip steps 10-16, keep
1-9 and 17-18. Say explicitly that modeling wasn't warranted and why.
- Dataset too small for a train/test split: say so, use
cross-validation or report the limitation rather than presenting an
overfit single-split result as reliable.
- Time-series data: standard random train/test splitting leaks future
data into training — read
references/time-series.md before choosing a
validation strategy.
- Severe class imbalance: accuracy is misleading as a metric here —
read
references/evaluation-metrics.md and references/classification.md.
References
See examples/customer-churn-walkthrough.md for a full worked example of
this workflow end to end.
1---2name: data-scientist3description: Runs an end-to-end structured tabular data science workflow: problem framing, schema/leakage/missingness checks, EDA, baseline before modeling, feature engineering, model comparison against the baseline, and error/slice analysis. Use when asked to analyze a dataset, build a predictive model, evaluate a model's performance, or investigate a data quality issue in tabular data. Do not use for pure data engineering/ETL with no analysis or modeling question, for unstructured data (images/audio/free text at scale) without a tabular framing, or when the task is answerable by a single summary statistic with no need for the full workflow — say so and just answer it.4license: MIT5---67# Purpose89Turn "analyze this dataset" or "build a model" into a structured,10leakage-checked, baseline-anchored workflow instead of jumping straight to a11sophisticated model that may be solving the wrong problem or trained on a12false signal.1314# When to use1516- Asked to analyze a tabular dataset, build a predictive/classification17 model, or evaluate model performance.18- Asked to investigate a data quality issue (missingness, duplicates,19 suspicious distributions) in tabular data.2021# When NOT to use2223- The question is answerable with a single, simple aggregation ("what's the24 average order value last month") — just answer it; the full workflow is25 overkill.26- The task is ETL/pipeline engineering with no analysis or modeling27 question attached.28- **Never jump straight to a sophisticated model.** Always establish a naive29 baseline first (step 10) — a model that doesn't beat the baseline is a30 negative result worth reporting, not a failure to hide.3132# Required inputs3334- The dataset (file path or description of where it lives) and, if this is35 a modeling task, what's being predicted and why (the business/decision36 context — see step 1).3738# Workflow39401. **Understand the decision/business problem** — what decision would this41 analysis or model actually inform? A model with no decision attached is42 a request to clarify, not a request to start training.432. **Inspect the dataset** — shape, column types, a sample of rows. Use44 `scripts/profile_dataset.py`.453. **Validate schema** — expected columns present, types sane, value ranges46 plausible. Mismatches here should stop the workflow, not be silently47 worked around.484. **Identify the target** (if modeling) — confirm what column is being49 predicted and its distribution (class balance for classification, shape50 for regression).515. **Detect leakage** — features that wouldn't be available at prediction52 time, or that are direct proxies/derivatives of the target. Use53 `scripts/check_leakage.py`; read `references/data-leakage.md` for the54 mechanisms to check beyond what the script catches.556. **Check missingness** — patterns, not just totals (missing-at-random vs.56 missing-not-at-random matters for how to handle it). Use57 `scripts/check_missingness.py`.587. **Check duplicates/outliers** — use `scripts/detect_duplicates.py`;59 investigate outliers rather than dropping them reflexively.608. **EDA** — distributions, correlations with the target, relationships61 between key features. Let this inform, not replace, the hypotheses step.629. **Hypotheses** — state what you expect to find and why, before or63 alongside EDA, so results can be interpreted against expectations.6410. **Choose the evaluation metric** — read `references/evaluation-metrics.md`65 and pick the metric that matches the actual decision from step 1, not66 the most common default. State why.6711. **Create a naive baseline** — for classification: majority class or a68 simple rule; for regression: mean/median predictor. This is69 non-negotiable — every later model is judged against it.7012. **Feature engineering** — only after the baseline exists, so its value71 is measurable.7213. **Train candidate models** — start simple (e.g. logistic/linear73 regression) before complex models; complexity must earn its keep against74 the next-simplest option, not just against the baseline.7514. **Compare with baseline** — use `scripts/evaluate_predictions.py`. If a76 model doesn't beat the baseline meaningfully, report that plainly.7715. **Error analysis** — look at what the best model gets wrong and why,78 not just the aggregate metric.7916. **Slice analysis** — check performance across meaningful subgroups80 (segments relevant to the decision from step 1); an aggregate metric can81 hide a subgroup where the model is actually harmful or useless.8217. **Interpretation** — connect findings back to the original decision.8318. **Recommendations** — what should actually change/happen as a result.8485Read `references/classification.md`, `references/regression.md`, or86`references/time-series.md` depending on the problem type before step 10 —87each affects which metrics and validation strategy are valid, especially88for time-series, where standard k-fold cross-validation leaks future89information into the past.9091# Tool & resource guidance9293Run the deterministic scripts for anything they can determine exactly —94don't eyeball a `.describe()` output for missingness when95`scripts/check_missingness.py` gives an exact, reproducible answer.9697```98python scripts/profile_dataset.py data.csv99python scripts/check_missingness.py data.csv100python scripts/detect_duplicates.py data.csv101python scripts/check_leakage.py data.csv --target outcome102python scripts/evaluate_predictions.py predictions.csv --y-true actual --y-pred predicted103python scripts/generate_summary.py data.csv --target outcome104```105106Each script is standalone (`python scripts/<name>.py --help`) and requires107only pandas/numpy — install via `pip install -e '.[data-scientist]'` from108the repo root, or `pip install pandas numpy` directly.109110Read `references/experiment-design.md` before recommending an A/B test or111similar experiment based on the analysis.112113# Output contract114115A findings summary covering: the decision context, key EDA findings, the116chosen metric and why, baseline performance, best model performance and117whether it beats baseline, error/slice analysis findings, and concrete118recommendations. For pure data-quality investigations (no modeling), the119same contract minus the modeling-specific sections.120121# Quality checks122123- [ ] A baseline was established before any "sophisticated" model, and the124 final comparison is against that baseline explicitly.125- [ ] Leakage was actively checked, not assumed absent.126- [ ] The chosen metric matches the actual decision, and that match is stated.127- [ ] Slice analysis was performed on at least one meaningful subgroup, not128 only an aggregate metric reported.129- [ ] If the task didn't actually need modeling, that was recognized and130 modeling was skipped rather than forced.131132# Edge cases133134- **Task is analysis-only, no modeling needed**: skip steps 10-16, keep135 1-9 and 17-18. Say explicitly that modeling wasn't warranted and why.136- **Dataset too small for a train/test split**: say so, use137 cross-validation or report the limitation rather than presenting an138 overfit single-split result as reliable.139- **Time-series data**: standard random train/test splitting leaks future140 data into training — read `references/time-series.md` before choosing a141 validation strategy.142- **Severe class imbalance**: accuracy is misleading as a metric here —143 read `references/evaluation-metrics.md` and `references/classification.md`.144145# References146147See `examples/customer-churn-walkthrough.md` for a full worked example of148this workflow end to end.