ml-best-practices
Skill240 starsChanged 5 months agoApache-2.0View on GitHub
CRITICAL RULE: You MUST use this skill whenever the task involves any machine learning tasks or data analysis. Use this skill if the user's prompt or requirements mention any of the following: * Clustering * Classification * Regression * Time series forecasting * Statistical testing * Model comparison * ML * Data analysis
4 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- sid-lakhani/agents-configword for word, first seen Oct 20, 2026
- imMamdouhaboammar/matts-skills-into-chatgpttheir own version, first seen Oct 17, 2026
- MortuisVMain/ai-agent-superpowersedited, first seen Sep 15, 2026
- matt-rabah/sf-ragword for word, first seen Jun 28, 2026
Other versions4 projects use a version of this.
Word for word · 2
- sid-lakhani/agents-config★ 2100% same
- matt-rabah/sf-rag★ 0100% same
Edited · 1
- MortuisVMain/ai-agent-superpowers★ 098% same
Wrote their own version · 1
- imMamdouhaboammar/matts-skills-into-chatgpt★ 8same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository39 other files it gives its agents.
- accidental-data-loss-preventionSkill
- bigquery-ai-mlSkill
- bigquery-bigframesSkill
- bigquery-data-transfer-serviceSkill
- bigquery-graph-authorSkill
- bigquery-graph-querySkill
- bigquery-observabilitySkill
- bigquery-optimizationSkill
- bigquery-troubleshootingSkill
- bigtable-basicsSkill
- building-data-appsSkill
- cloud-databases-onboardingSkill
- dak-setupSkill
- data-autocleaningSkill
- dataform-bigquerySkill
- dbt-bigquerySkill
- discovering-gcp-data-assetsSkill
- enforcing-resource-attributionSkill
- federate-lakehouse-catalogSkill
- gcp-composer-troubleshootingSkill
- gcp-dataflowSkill
- gcp-data-pipelinesSkill
- gcp-managed-airflow-dag-authoringSkill
- gcp-managed-airflow-migrationsSkill
- gcp-managed-airflow-recommendationsSkill
- gcp-managed-spark-upgradesSkill
- gcp-pipeline-orchestrationSkill
- gcp-pipeline-resource-provisioningSkill
- gcp-spark-observabilitySkill
- gcp-sparkSkill
- gcp-spark-troubleshootingSkill
- gcs-security-assessmentSkill
- google-cloud-storage-basicsSkill
- google-cloud-storage-bucket-architectSkill
- google-cloud-storage-fuseSkill
- managing-python-dependenciesSkill
- notebook-guidanceSkill
- resolving-mcp-region-configsSkill
- schema-mappingSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 11 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
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
- Distinctive: line 28
If there is a good match between the user's request and a corresponding example plan, then adapt the example plan to fully answer the …
- Distinctive: line 39
Before applying encoders, check if the dataset already contains pre-encoded features and prefer existing numerical representations.
- Distinctive: line 41
Prefer to keep data instead of dropping it when possible.
- Distinctive: line 47
Use dimensionality reduction (e.g., PCA) to project the data into two dimensions.
- Distinctive: line 63
Always perform a chronological split on the data to create training, validation, and test sets.
- Distinctive: line 107
Create features to represent when data are missing, if this is meaningful.
- Distinctive: line 116
If there is evidence of overfitting, regularize and retrain the model.
- Distinctive: line 117
If there is evidence of underfitting, consider adding or engineering features.
- Distinctive: line 163
Ensure rigorous validation: use identical, fixed data splits for all models and perform $k$-fold cross-validation.
- Distinctive: line 165
If data is temporal, use chronological splits for validation.
- Distinctive: line 168
Use bootstrapping to calculate 95% confidence intervals for key metrics to determine statistical significance.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ML Best Practices
I want to read a story about the data, not just run code. Ensure every code cell is followed by a markdown cell analyzing the results. End the notebook with a summary comprehensively answering the prompt.
If there is a good match between the user's request and a corresponding example plan, then adapt the example plan to fully answer the user's request:
Clustering:
Identify distinct groups based on their features.
- Understand the schema and field descriptions.
- Visualize features referenced in the prompt (e.g., with histograms, scatterplots).
- Transform dates into timestamps.
- Before applying encoders, check if the dataset already contains pre-encoded features and prefer existing numerical representations.
- Prefer to keep data instead of dropping it when possible.
- Transform ordinal data with an ordinal encoder.
- Transform nominal data with a one hot encoder.
- Standardize numerical features.
- Perform clustering with a range of values, and collect the silhouette score.
- Choose the optimal number of clusters based on the silhouette score.
- Use dimensionality reduction (e.g., PCA) to project the data into two dimensions.
- Scatterplot the samples in two dimensions with cluster labels as the hue.
- Scatterplot the samples in two dimensions with a discrete feature as the hue.
- Describe the clusters in text by feature distributions or typical feature values.
- Conclusion: comprehensively answer the prompt in a final markdown cell.
Time Series Forecasting:
Develop a predictive model to estimate future values based on historical trends. How might different modeling approaches impact the prediction accuracy?
- Understand the schema and field descriptions.
- Visualize the target feature over time at a reasonable granularity.
- Always perform a chronological split on the data to create training, validation, and test sets.
- Are there seasonal trends?
- Test for stationarity.
- Discuss possible modeling approaches. How might different modeling approaches impact the prediction accuracy?
- Train two time series forecasting models to predict the target feature. Use previous seasonality and stationarity information as model hyperparameters.
- Predict the target feature for the training and validation sets.
- Optionally, hypertune models with the validation set.
- Visualize the actual and predicted target feature vs time for each model on the training and validation sets.
- Evaluate the validation performance with error metrics.
- Select a model.
- Retrain the selected model on the test and validation sets.
- Predict the test values with the selected model.
- Visualize the average target feature and the predicted test values.
- Conclusion: comprehensively answer the prompt in a final markdown cell.
Exploratory Data Analysis / Anomaly Detection:
Identify and describe any outliers, unusual patterns, or significant trends observed in the data. Provide visualizations to support your findings.
- Understand the schema and field descriptions.
- Visualize the target feature distribution in a way that shows outliers.
- Identify and describe any outliers in the target feature.
- Visualize relationships between the target feature and other features.
- Identify and describe unusual patterns or significant trends.
- Visualize patterns and trends.
- Conclusion: comprehensively answer the prompt in a final markdown cell.
Classification:
Given the data, can we classify by the target feature?
- Understand the schema and field descriptions.
- Identify rows that don't make sense. How many are there and what do they contain?
- Identify rows without a target value. How many are there and what do they contain?
- Drop rows that don't match the schema or don't have the target value (if it is reasonable to do so).
- Split data into training, validation, and test sets.
- Create features to represent when data are missing, if this is meaningful.
- Handle missing data. Prefer to keep data instead of dropping it when possible.
- Before applying encoders, check if the dataset already contains pre-encoded features and prefer existing numerical representations.
- Transform ordinal data with an ordinal encoder.
- Transform nominal data with a one hot encoder.
- Standardize numerical features.
- Train multiple models.
- If there is evidence of overfitting, regularize and retrain the model.
- If there is evidence of underfitting, consider adding or engineering features.
- Evaluate the models.
- Create confusion matrices.
- Conclusion: comprehensively answer the prompt in a final markdown cell.
Regression:
Predict the continuous valued target feature.
- Understand the schema and field descriptions.
- Identify rows that don't make sense. How many are there and what do they contain?
- Identify rows without a target value. How many are there and what do they contain?
- Develop an understanding of the data and determine how to handle missing values. This should make sense in the business context.
- Identify any potential sources of group leakage. Aggregate where appropriate to prevent this.
- Visualize target feature.
- Split data into training, validation, and test sets.
- Handle missing data. Prefer to keep data instead of dropping it when possible.
- Before applying encoders, check if the dataset already contains pre-encoded features and prefer existing numerical representations.
- Transform ordinal data with an ordinal encoder.
- Transform nominal data with a one hot encoder. Restrict high cardinality categorical features to a tractable size.
- Standardize numerical features.
- Train multiple models.
- Visualize the actual vs predicted values on training and validation data.
- If there is evidence of overfitting, regularize and retrain the model.
- If there is evidence of underfitting, consider adding or engineering features.
- Evaluate the model error.
- Conclusion: comprehensively answer the prompt in a final markdown cell.
Comparing ML Models:
Evaluate and compare multiple models to determine which is most suitable for production based on predictive power, robustness, and viability.
- Understand the schema and align metrics with business goals (e.g., cost of false positives vs. false negatives).
- Establish baselines: define a naive baseline (majority class/mean) and a simple ML baseline (e.g., Logistic/Linear Regression).
- Ensure rigorous validation: use identical, fixed data splits for all models and perform $k$-fold cross-validation.
- If data is temporal, use chronological splits for validation.
- Select and report metrics beyond accuracy (e.g., F1-Score, PR-AUC, MAE, RMSE) that reflect business impact.
- Use bootstrapping to calculate 95% confidence intervals for key metrics to determine statistical significance.
- Perform slice-based error analysis: evaluate model performance across key subpopulations and demographics to identify bias or specific failure modes.
- Inspect and compare confusion matrices, residual plots, and calibration curves.
- Evaluate operational trade-offs: consider inference latency, training time, compute cost, and model size.
- Assess interpretability using tools like SHAP or LIME where transparency is required.
- Conclusion: Recommend the optimal model for the specific use case, justifying the choice with both performance and production viability.
No match:
- Understand the schema and field descriptions.
- Identify rows that don't make sense. How many are there and what do they contain?
- Identify rows without a target value. How many are there and what do they contain?
- Drop rows that don't match the schema or don't have the target value (if it is reasonable to do so).
- Create features to represent when data are missing, if this is meaningful.
- Handle missing data. Prefer to keep data instead of dropping it when possible.
- Before applying encoders, check if the dataset already contains pre-encoded features and prefer existing numerical representations.
- Transform ordinal data with an ordinal encoder.
- Transform nominal data with a one hot encoder.
- Standardize numerical features.
- Conclusion: comprehensively answer the prompt in a final markdown cell.
Essential ML Practices
[!IMPORTANT] ALWAYS follow these ML practices
- Strict Featurization Ordering: For supervised learning ALWAYS split the dataset into training and test data BEFORE fitting preprocessing pipelines (e.g. scaling, encoding). Fit the pipelines on the training data and test data independently.
- Handling Missing or NULL Values: ALWAYS check for and handle missing and NULL values. First, analyze their frequency. Then, decide whether to keep them, drop them or impute them with a contextually appropriate value, and explain your reasoning.
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
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.

