> Produce or audit the interpretability/explainability analysis of a medical-imaging model — Grad-CAM / Grad-CAM++ / attention-rollout / saliency / integrated-gradients — so it clears the rigor quantitative localisation metric against ground truth (IoU / pointing game / Dice) instead of eyeballed examples, a cohort-level result rather than cherry-picked cases, and attribution framing rather than "proof the model is correct". Emits an explainability-report manifest and a deterministic rigor gate. Integrates captum / pytorch-grad-cam; it does not reimplement them, and never runs a model on real patient data.
npx skills add https://github.com/Aperivue/medsci-skills --skill explainability
A saliency / Grad-CAM heat-map is the most over-interpreted artifact in medical-imaging AI: a
colourful map over the lesion is routinely presented as proof the model "looks at the right thing."
Adebayo et al. (*NeurIPS* 2018) showed many saliency methods produce visually convincing maps that are
independent of the model's learned weights and of the labels — so they explain nothing. This skill
produces an explainability analysis that clears the rigor bar, and audits an existing one, so the map
is trustworthy before it reaches a manuscript (CLAIM 2024 / TRIPOD+AI interpretability items).
It sits alongside evaluation in the lane: /architecture-zoo → /preprocess-imaging →
/model-scaffold → /model-validation → /model-evaluation + explainability →
/write-paper + /check-reporting. It integrates captum / pytorch-grad-cam (referenced in the
plan); it does not reimplement them and never runs a model on real patient data.
to the standard a reviewer expects.
/model-evaluation then /analyze-stats./model-validation / /preprocess-imaging./mllm-eval.relationship is causal. Frame it as "where signal is attributed", never as "the model is right".
that survives neither is uninterpretable; both axes are the minimum bar.
pointing game / Dice against ground-truth masks — do not eyeball a few examples.
Choose the method for the architecture (references/explainability_guide.md): Grad-CAM / Grad-CAM++
for CNNs, attention-rollout for ViTs, integrated-gradients / SHAP for attribution. Wire captum or
pytorch-grad-cam; do not write a new CAM implementation.
a faithful map degrades when the model/labels are randomised.
Dice) over the cohort — not a visual impression.
{
"method": "grad-cam++",
"n_examples": 200,
"cohort_level": true,
"localization_metric": "iou",
"localization_value": 0.63,
"sanity_checks": ["model_randomization", "data_randomization"],
"interpretation": "localization"
}
interpretation: attribution / localization / faithfulness (descriptive) — never
validation / causal (overclaim).
python3 scripts/check_explainability_report.py --manifest explainability_report.json --strict
Verdicts: SALIENCY_AS_VALIDATION, NO_SANITY_CHECK, NO_LOCALIZATION_METRIC (Major);
INSUFFICIENT_SANITY, CHERRY_PICKED_EXAMPLES, MISSING_METHOD (Minor). The verdict is reproduced
by rule on the manifest, never asserted from prose.
/model-evaluation — explainability accompanies the held-out metrics as a secondary analysis./self-review ai_overclaiming / image_synthesis probes audit saliency overclaiming in afinished manuscript; this skill *produces* the rigorous analysis they look for.
/check-reporting — the manifest documents the CLAIM 2024 / TRIPOD+AI interpretability items.manifest comes from the researcher's executed XAI code — never invented. This skill designs and
audits the analysis; it does not run a model on real patient data.
claiming it validates the model is the overclaim this skill exists to prevent (SALIENCY_AS_VALIDATION).
check_explainability_report.py. Therigor verdict is reproduced deterministically, never asserted from prose.
attribution implementation or claim results for one.
scripts/check_explainability_report_challenge/ ships a synthetic weak/strong report pair with a
network-free verify.sh wired into the skill's validation commands.
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
Access NCBI GEO for gene expression/genomics data. Search/download microarray and RNA-seq datasets (GSE, GSM, GPL), retrieve SOFT/Matrix files, for transcriptomics and expression analysis.
Bayesian modeling with PyMC. Build hierarchical models, MCMC (NUTS), variational inference, LOO/WAIC comparison, posterior checks, for probabilistic programming and inference.
Multi-objective optimization framework. NSGA-II, NSGA-III, MOEA/D, Pareto fronts, constraint handling, benchmarks (ZDT, DTLZ), for engineering design and optimization problems.
Statistical modeling toolkit. OLS, GLM, logistic, ARIMA, time series, hypothesis tests, diagnostics, AIC/BIC, for rigorous statistical inference and econometric analysis.
Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.
Convert PyTorch AT_DISPATCH macros to AT_DISPATCH_V2 format in ATen C++ code. Use when porting AT_DISPATCH_ALL_TYPES_AND*, AT_DISPATCH_FLOATING_TYPES*, or other dispatch macros to the new v2 API. For ATen kernel files, CUDA kernels, and native operator implementations.
Write docstrings for PyTorch functions and methods following PyTorch conventions. Use when writing or updating docstrings in PyTorch code.
Take aperivue/explainability from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.