SHAP Model Explanation Assistant
A skill that guides Claude through choosing SHAP explainers and maskers, computing, validating, and visualizing feature attributions on SHAP 0.52.
Data & AnalyticsAdvanced★ 33,030⑂ 3,248AI score 9/10Last updated: Aug 9, 2026
What it does
- Provides a decision table for picking the right explainer and masker: tree ensembles, linear models, deep nets, text, and images.
- Enforces the modern
shap.ExplanationAPI and a mandatory additivity check thatbase_values + values.sum()matches the exact model output being explained. - Covers multi-output (multiclass) slicing, probability/log-loss output modes for trees, and question-driven plot selection (bar, beeswarm, waterfall, scatter, heatmap, text, image).
- Supplies a reporting checklist: output units, reference population, masker, approximation diagnostics, and an explicit non-causal disclaimer.
- Ships a deterministic example script (
scripts/tabular_report.py) plus eight reference docs (explainers, maskers, plots, workflows, modalities, migration, theory, troubleshooting).
Who it's for
- Data scientists and ML engineers producing explanation reports for audits or compliance.
- Anyone whose SHAP code broke after upgrading (e.g., legacy
values[class_index]patterns). - Practitioners debugging additivity failures, shape mismatches, pipelines, or categorical handling.
Example uses
- "Compute SHAP for the positive-class probability of my RandomForest with a 100-row background and verify additivity" → generates TreeExplainer setup with
np.testing.assert_allclose. - "Compare per-class attributions for my multiclass model" → shows
explanation[..., "class_name"]slicing and the rule against averaging signed values across classes. - "Why can't I get probability-space tree explanations?" → points to
feature_perturbation="interventional"plus background data, and walks the troubleshooting order.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/HEAD/skills/shap/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the skills/shap folder from the GitHub repo K-Dense-AI/scientific-agent-skills into my ~/.claude/skills/shap/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/K-Dense-AI/scientific-agent-skills.git && mkdir -p ~/.claude/skills && cp -r scientific-agent-skills/skills/shap ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal.
- Clone the repo:
git clone https://github.com/K-Dense-AI/scientific-agent-skills.git - Create the skills folder:
mkdir -p ~/.claude/skills - Copy the skill:
cp -r scientific-agent-skills/skills/shap ~/.claude/skills/ - Set up Python (uv required):
uv venv --python 3.12 && source .venv/bin/activate && uv pip install "shap[plots]==0.52.0" - Restart Claude Code and ask something like "Explain this model's predictions with SHAP" to trigger the skill.
- Smoke test:
uv run --no-project --python 3.12 --with "shap[plots]==0.52.0" ~/.claude/skills/shap/scripts/tabular_report.py --output-dir /tmp/shap-report
View source on GitHub ↗License: MIT