Skip to content

SHAP Model Explainer

Explain why a machine-learning model made its predictions, with validated SHAP feature attributions and plots.

Stars
55,780
Licence
MIT
Files
10 files

What it does

This skill teaches an AI agent how to use SHAP, a standard method for showing which input features pushed a model's prediction up or down. Once installed, the agent follows a careful workflow: it states exactly what output is being explained, picks a suitable explainer and background dataset, checks that the numbers add up to the model's actual output, and then produces summary and per-prediction charts. It also includes a script that builds a sample tabular report using a built-in dataset.

Great for

  • Data scientists who need to explain a trained classifier or regressor to colleagues or stakeholders
  • Students learning how feature attribution works on tabular models
  • Analysts auditing whether a fitted model relies on sensible inputs, using held-out rows

Skip it if

  • Proving causation or fairness: the skill itself states SHAP describes model behaviour under a chosen background, not causality, fairness, or scientific mechanism
  • Explaining a model you have not validated or cannot reproduce, since the skill requires a fixed, evaluated model
  • Loading untrusted pickle, joblib or model files, which the skill itself warns can execute code

Try asking

  • “Explain the predictions of my random forest on held-out test rows and make a beeswarm plot of the top features”
  • “Show a waterfall chart for one patient's prediction and check that SHAP values add up to the predicted probability”
  • “Build a SHAP tabular report for my classifier using the included template script”
Step-by-step guide: how to use SHAP Model ExplainerInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 10 original files, the MIT licence and an attribution note.

    shap.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip shap.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip shap.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Always name the explained output (probability vs raw margin) and the background rows before reading any plot.
  • Use held-out rows for explanations and background rows from the training population; do not treat SHAP as proof of cause.
  • Run the bundled additivity check whenever you change preprocessing, model version or output index, and do not silence failures.

What's inside

  • references/data-maskers.md
  • references/explainers.md
  • references/migration.md
  • references/modalities.md
  • references/plots.md
  • references/theory.md
  • references/troubleshooting.md
  • references/workflows.md
  • scripts/tabular_report.py
  • SKILL.md

Redistributed unmodified from K-Dense-AI/scientific-agent-skills under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.