Guide · Agent skill
How to use the SHAP Model Explainer agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The shap agent skill teaches an AI agent how to explain a trained machine-learning model using SHAP, a standard method that shows which input features pushed a prediction up or down. It is aimed at data scientists, students and analysts who want the agent to produce careful, checked explanations rather than quick plots. After this guide you will know what the skill does, how to install it, how to ask for it in natural language and what to check in its output.
Quick start
- 1Download and unzip. Download the ZIP from this page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder.
- 2Or upload in the Claude apps. Go to Settings → Capabilities → Skills and upload the skill there.
- 3Create the environment. Run uv venv --python 3.12, activate it, then install shap[plots]==0.52.0.
- 4Confirm the versions. Print the Python and SHAP versions to check the environment before debugging.
- 5Make a natural request. Ask for an explanation of your fitted model on held-out rows, naming the output you care about.
- 6Check the additivity. Confirm that base values plus attributions match the model's output before reading any chart.
What does the shap skill make the agent do?
Once installed, the agent follows a defined workflow for explaining a fitted model. It states exactly which output is being explained (for example a regression value, a raw margin or a probability), chooses a suitable explainer and background dataset, and checks that the feature attributions add up to the model's actual output before interpreting anything.
It then produces summary and per-prediction charts. The skill also includes a script, scripts/tabular_report.py, that builds a sample tabular report using a built-in dataset.
- Records the model version, evaluation rows, background population and output units
- Selects an explainer such as TreeExplainer, LinearExplainer or PermutationExplainer
- Validates that base values plus attributions match the model output
- Creates global summary plots and local per-row plots
How do you install the shap skill?
Download the ZIP from this page and unzip it into one of these locations: ~/.claude/skills/ for personal use across projects, or .claude/skills/ inside a specific project folder. Alternatively, upload the skill in the Claude apps under Settings → Capabilities → Skills.
The skill itself needs a Python environment. The SKILL.md installation guidance uses uv to create an isolated environment and pins the documented SHAP release.
- Option 1: unzip into ~/.claude/skills/ for all your projects
- Option 2: unzip into a project's .claude/skills/ folder for that project only
- Option 3: upload through Settings → Capabilities → Skills in the Claude apps
uv venv --python 3.12
source .venv/bin/activate
uv pip install "shap[plots]==0.52.0"How do you trigger the skill with natural requests?
You do not need special syntax. Describe the job in plain words that mention predictions, features or explanations, and the agent should pick up the skill from its description. Good requests name the model, the data split and the kind of chart you want.
Be explicit about the held-out rows you want explained and which class or output matters, because the skill requires you to state the explained output.
- "Explain which features drive my random forest's predictions on the held-out test rows."
- "Make a SHAP beeswarm plot for my classifier and check the values add up to predict_proba."
- "Explain one prediction from my regression model as a waterfall chart."
- "Which explainer should I use for my XGBoost model, and what background data should I pick?"
What do example explanations look like?
The SKILL.md includes a complete binary-classification example on the breast-cancer dataset. It fits a random forest, samples a background from the training rows, selects output index 1 and asserts that the reconstructed values match the model's predicted probability. In that dataset class 1 means benign, so positive values increase predicted benign probability, not cancer risk.
The reference files cover explainers, data and maskers, plots, workflows and troubleshooting, so the agent can look up details when a case is unusual.
- Beeswarm plot: shows feature effects across many rows
- Waterfall plot: explains one row from base value to final output
- Multi-output selection: use explanation[..., output_index] for tabular plots
What does the skill need to run?
The skill requires Python 3.12 or newer, uv (recommended for environment setup), SHAP 0.52.0 with the plots extra, and scikit-learn, pandas, NumPy and matplotlib, which the examples and script use. Model-specific libraries such as XGBoost or PyTorch are optional and only needed for those integrations.
You also need a fixed, evaluated model. The skill is not meant for models you have not validated or cannot reproduce.
- Python 3.12 or newer
- uv (recommended)
- shap[plots]==0.52.0, scikit-learn, pandas, NumPy, matplotlib
- Optional: XGBoost or PyTorch for those integrations
What are the safety notes for scripts and network use?
The skill runs scripts: yes. Its script builds a sample report on a built-in dataset. The skill does not use the network. The skill warns never to load untrusted pickle, joblib, model or explainer files, because those formats can execute code during loading.
The skill also states that SHAP describes model behaviour under a chosen background. It does not prove causation, fairness or scientific mechanism.
- Runs scripts: yes (scripts/tabular_report.py)
- Uses network: no
- Do not load untrusted pickle, joblib or model files
- Treat SHAP output as a description of model behaviour, not causality or fairness
What tips help you get reliable results?
Keep the background data drawn from an appropriate training or reference population, and use held-out rows for the explanations. If the additivity check fails, do not silence it; check input shape, preprocessing, model version, output space and row order first.
For tree classifiers that output probabilities, the skill recommends stating model_output and using an interventional masker explicitly.
- Use held-out rows and label the explained output
- Check the additivity assertion before interpreting plots
- Select one output with explanation[..., index] for multi-output models
- Read references/troubleshooting.md when an API mismatch appears
What people use it for
- Explaining a trained random forest classifier to colleagues with a beeswarm summary plot
- Producing a waterfall chart for one surprising prediction from a regression model
- Auditing whether a fitted tabular model relies on sensible inputs using held-out rows
- Learning how feature attribution works on a built-in breast-cancer dataset
Frequently asked questions
How do I install the shap agent skill?
Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use or a project's .claude/skills/ folder. You can also upload it in the Claude apps under Settings → Capabilities → Skills.
What do I need to run the shap skill?
You need Python 3.12 or newer, uv recommended for setup, and SHAP 0.52.0 with the plots extra. scikit-learn, pandas, NumPy and matplotlib are used by the examples and script, while XGBoost or PyTorch are only needed for those integrations.
Is the shap skill free?
The skill is released under the MIT licence, as stated on this page. The source does not mention pricing for the Claude apps, so check those terms separately.
Does the shap skill use the internet?
No. The skill is listed as not using the network, but it does run scripts, so review scripts/tabular_report.py before running it.
Does SHAP show that a feature causes a prediction?
No. The skill states that SHAP describes model behaviour under a chosen background. It does not establish causality, fairness or scientific mechanism.
Can I load a saved model with this skill?
Only load model, pickle or joblib files you trust. The skill warns that these formats can execute code during deserialization.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Choose this skill if you are a data scientist, student or analyst who needs a careful, checked explanation of a trained tabular model for colleagues or an audit. Pick something else if you need causal, fairness or legal conclusions, or if your model is unvalidated or cannot be reproduced.
Download the skill