SHAP Model Explanation Skill
Guides Claude through choosing SHAP explainers, computing and validating attributions, and plotting them correctly.
Data & AnalyticsAdvanced★ 33,030⑂ 3,248AI score 9/10Last updated: Aug 9, 2026
What it does
A disciplined playbook for explaining and auditing machine-learning predictions with SHAP, built to prevent the most common misuses.
- Decision table for explainer and masker selection (tree, linear, exact, permutation, partition, deep, kernel)
- Modern
shap.ExplanationAPI patterns, including correct multi-output slicing (exp[..., 1]instead of legacyvalues[class_index]) - An additivity check: verify
base_values + values.sum(axis=1)against the exact model output - Forces you to state the explained output space — probability, raw margin, log-loss, logit
- Question-to-plot mapping: bar, beeswarm, waterfall, scatter, heatmap, cohorts, text/image
- Fixed troubleshooting order plus a mandatory limitations checklist (explicit non-causal statement)
- Safety rules: never deserialize untrusted pickle/joblib model artifacts
Who it's for
- Data scientists whose explanations end up in reports, model risk reviews, or regulatory filings
- Anyone repeatedly tripped up by SHAP array shapes in multiclass problems
- Practitioners needing probability-space tree explanations and interventional vs tree-path-dependent semantics
- NLP/vision engineers applying SHAP with text and image maskers
Examples
- "Compute SHAP values for my RandomForest binary classifier on the test set, select the positive class, run the additivity assertion, then plot beeswarm and a waterfall for row 0."
- "I need probability-space explanations for an XGBoost model — how should I set background data and feature_perturbation?"
- "Compare SHAP attributions across cohorts for a multiclass model and draft the limitations paragraph so it isn't read as a fairness test."
· · · Install guide · · ·
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 /tmp/scientific-agent-skills && mkdir -p ~/.claude/skills && cp -r /tmp/scientific-agent-skills/skills/shap ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal.
- Create the skills directory if needed:
mkdir -p ~/.claude/skills - Clone the repository:
git clone https://github.com/K-Dense-AI/scientific-agent-skills.git /tmp/scientific-agent-skills - Copy just this skill:
cp -r /tmp/scientific-agent-skills/skills/shap ~/.claude/skills/ - Verify with
ls ~/.claude/skills/shap— you should see SKILL.md and a references folder. - Set up Python:
uv venv --python 3.12 && source .venv/bin/activate && uv pip install "shap[plots]". If the documented 0.52.0 pin does not resolve, runpip index versions shapand install the latest real release. - Restart Claude Code and ask something like "Use SHAP to explain this model's predictions" to trigger the skill.
View source on GitHub ↗License: MIT