Agent skill · Security

shap

Explain and audit machine-learning predictions with SHAP. Use for selecting SHAP explainers and maskers, computing and validating feature attributions, handling multi-output explanations, and producing local or global SHAP visualizations.

K-Dense-AIgithub.com/K-Dense-AIGitHub ↗
claude-codecan modify filesships scriptsMIT
Install
npx skills add K-Dense-AI/scientific-agent-skills --skill shap --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 10
SKILL.md size: 13 KB
Bundled scripts: yes
Version: 2.0
Allowed tools: ReadBash
Requires: Requires Python 3.12+ and uv for SHAP 0.52.0; model-specific libraries are optional.
Path: skills/shap/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 32,619
Language: Python
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# SHAP Use SHAP to describe how a fitted predictive model maps inputs to outputs. Work from the modern `shap.Explanation` API, make the explained output and background distribution explicit, and validate every explanation before interpreting it. This skill is aligned with **SHAP 0.52.0** (released 2026-05-28). That release requires Python 3.12 or newer. ## Operating Rules 1. Explain a fixed, evaluated model; do not use SHAP as a substitute for predictive validation. 2. Use held-out or clearly labeled analysis rows for explanations. Choose background rows only from an appropriate training or reference population. 3. State the explained output: regression value, raw margin, probability, log loss, logit, or another model method. 4. Keep explanations as `shap.Explanation` objects. Call `explainer(X)`; use `.shap_values(X)` only when maintaining legacy code. 5. For multi-output models, select one output before using tabular plots: `explanation[..., output_index]`. 6. Check `base_values + values.sum(...)` against the exact model output being explained. 7. Treat SHAP as a description of model behavior under a masking/background choice. It does not establish causality, fairness, recourse,

What's inside
Steps it walks through
  1. Operating Rules
  2. Install
  3. Standard Workflow
  4. 1. Define the explanation target
  5. 2. Select an explainer and masker
  6. 3. Compute a modern Explanation
  7. 4. Control tree output semantics when needed
  8. 5. Use a model-agnostic callable deliberately
  9. 6. Visualize the question, not merely the available plot
  10. 7. Report limitations with results
  11. Common Tasks
  12. Global and local analysis
  13. Multiclass models
  14. Cohorts, subgroup analysis, and fairness
Ships with 9 files
  • 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
Commands it runs
uv venv --python 3.12
source .venv/bin/activate
uv pip install "shap[plots]==0.52.0"
uv run --no-project --python 3.12 --with "shap[plots]==0.52.0" \
skills/shap/scripts/tabular_report.py --output-dir /tmp/shap-report
More from scientific-agent-skills
All skills →
About this skill
What does the shap skill do?

Explain and audit machine-learning predictions with SHAP. Use for selecting SHAP explainers and maskers, computing and validating feature attributions, handling multi-output explanations, and producing local or global SHAP visualizations.

How do I install it?

Run `npx skills add K-Dense-AI/scientific-agent-skills --skill shap --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From K-Dense-AI/scientific-agent-skills, a repository with 32,619 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going