medsci-skills 5.14.0 → 5.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +65 -9
  2. package/metadata/distribution_files.json +102 -2
  3. package/metadata/distribution_manifest.json +3 -1
  4. package/metadata/skills_catalog.json +22 -2
  5. package/package.json +1 -1
  6. package/skills/explainability/SKILL.md +109 -0
  7. package/skills/explainability/references/explainability_guide.md +66 -0
  8. package/skills/explainability/scripts/check_explainability_report.py +239 -0
  9. package/skills/explainability/scripts/check_explainability_report_challenge/expected/strong.txt +9 -0
  10. package/skills/explainability/scripts/check_explainability_report_challenge/expected/weak.txt +11 -0
  11. package/skills/explainability/scripts/check_explainability_report_challenge/fixture/report_strong.json +9 -0
  12. package/skills/explainability/scripts/check_explainability_report_challenge/fixture/report_weak.json +8 -0
  13. package/skills/explainability/scripts/check_explainability_report_challenge/problem.md +19 -0
  14. package/skills/explainability/scripts/check_explainability_report_challenge/verify.sh +37 -0
  15. package/skills/explainability/skill.yml +45 -0
  16. package/skills/explainability/tests/test_explainability_report.sh +88 -0
  17. package/skills/preprocess-imaging/SKILL.md +117 -0
  18. package/skills/preprocess-imaging/references/preprocessing_guide.md +69 -0
  19. package/skills/preprocess-imaging/scripts/check_preprocessing_leakage.py +294 -0
  20. package/skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/expected/clean.txt +9 -0
  21. package/skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/expected/leak.txt +12 -0
  22. package/skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/fixture/manifest_clean.json +16 -0
  23. package/skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/fixture/manifest_leak.json +17 -0
  24. package/skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/problem.md +20 -0
  25. package/skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/verify.sh +39 -0
  26. package/skills/preprocess-imaging/skill.yml +45 -0
  27. package/skills/preprocess-imaging/tests/test_preprocessing_leakage.sh +77 -0
  28. package/skills/self-review/scripts/check_scope_coherence.py +18 -1
  29. package/skills/self-review/tests/fixtures/scope_antipattern_list.md +13 -0
  30. package/skills/self-review/tests/test_scope_coherence.sh +14 -0
package/README.md CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  # MedSci Skills
4
4
 
5
- **51 skills that actually work.** Built by a physician-researcher, tested on real publications.
5
+ **53 skills that actually work.** Built by a physician-researcher, tested on real publications.
6
6
 
7
7
  *MedSci Skills is an end-to-end research tool for physician and medical-engineering researchers — design → scaffold → validate → publish — for the clinical manuscript and the medical-AI model behind it. Its moat is the compliance layer — 44 reporting guidelines and risk-of-bias tools, reference/citation verification, and deterministic integrity gates before peer review — now extended by a model-engineering lane that scaffolds reproducible, leakage-safe training repos and audits model validation. Clinical AI model research engineering is in scope; a general AI-scientist platform is not. It competes on clinical submission reliability, not skill count.*
8
8
 
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
10
10
  [![Release](https://img.shields.io/github/v/release/Aperivue/medsci-skills?style=flat-square&color=blue)](https://github.com/Aperivue/medsci-skills/releases/latest)
11
11
  [![CI](https://img.shields.io/github/actions/workflow/status/Aperivue/medsci-skills/validate.yml?branch=main&style=flat-square&label=CI)](https://github.com/Aperivue/medsci-skills/actions/workflows/validate.yml)
12
- ![Skills](https://img.shields.io/badge/Skills-51-brightgreen?style=flat-square)
12
+ ![Skills](https://img.shields.io/badge/Skills-53-brightgreen?style=flat-square)
13
13
  [![npm](https://img.shields.io/npm/v/medsci-skills?style=flat-square&label=npm&color=cb3837)](https://www.npmjs.com/package/medsci-skills)
14
14
  [![Watch the 2-min intro](https://img.shields.io/badge/▶_Watch-2--min_intro-FF0000?style=flat-square&logo=youtube&logoColor=white)](https://youtu.be/MclQ_RIofpE)
15
15
  [![good first issues](https://img.shields.io/github/issues/Aperivue/medsci-skills/good%20first%20issue?style=flat-square&label=good%20first%20issues&color=7057ff)](https://github.com/Aperivue/medsci-skills/contribute)
@@ -285,6 +285,8 @@ The E2E pipeline (`orchestrate --e2e`) produces everything up to `qc/`. The `sub
285
285
 
286
286
  ## What's New
287
287
 
288
+ **v5.15** — model-engineering produce-side depth. Two new skills that *produce* what the review lane previously only audited: **`preprocess-imaging`** (DICOM/NIfTI data prep + a `check_preprocessing_leakage` gate that extends the split-leakage moat upstream to the data stage) and **`explainability`** (Grad-CAM / saliency held to the reviewer bar — Adebayo sanity checks, quantitative localisation vs ground truth, attribution-not-validation framing, via `check_explainability_report`). Plus a by-stage skill index, multi-host README/About (Claude Code · Codex · Cursor · Copilot), copy-paste citation ergonomics, and a real-project precision fix. Additive and backward-compatible; **53 skills / 44 guidelines / 48 integrity detectors / 22 domain-probe modules**. (See the [CHANGELOG](CHANGELOG.md) for v5.0–v5.14.)
289
+
288
290
  **v4.10** — reviewer-coverage expansion reverse-engineered from high-IF, CC-BY papers (learn-only under the `reverse_engineer/` license firewall), plus a clinician-friendly update path. Additive and backward-compatible; 45 skills / **44 guidelines** / 36 detectors / **15 domain-probe modules** (was 12):
289
291
 
290
292
  - **Three new reviewer domain-probe modules** (`/peer-review` + `/self-review`, vendored byte-identical): **Mendelian randomization** (MR1–MR8 — IV assumptions, pleiotropy-robust sensitivity suite, Steiger, sample overlap, NLMR, drug-target colocalization), **polygenic risk score** (PG1–PG8 — ancestry portability, base/target leakage, incremental value over the clinical model, screening-vs-discrimination, calibration), and **network meta-analysis** (NM1–NM8 — transitivity, incoherence, SUCRA over-interpretation, CINeMA/GRADE-NMA, component-NMA additivity). Plus observational **O17** (agnostic many-exposure-scan multiplicity: ExWAS/EWAS/MWAS).
@@ -447,6 +449,21 @@ ma-scout -> search-lit -> fulltext-retrieval -> design-study ──> write-proto
447
449
  └─────────────────────────────────────────────┘
448
450
  ```
449
451
 
452
+ ### By research stage
453
+
454
+ All 53 skills, grouped by where they fit in the clinical-manuscript and medical-AI lifecycle. Full descriptions are in the table below; one page per skill lives in the [per-skill reference](docs/skills/).
455
+
456
+ | Stage | Skills |
457
+ |-------|--------|
458
+ | 🔭 **Discover & scope** | `ma-scout` · `find-cohort-gap` · `search-lit` · `fulltext-retrieval` · `lit-sync` · `author-strategy` |
459
+ | 📐 **Design & plan** | `design-study` · `calc-sample-size` · `define-variables` · `write-protocol` · `fill-protocol` · `design-ai-benchmarking` |
460
+ | 🧹 **Data & analysis** | `deidentify` · `clean-data` · `generate-codebook` · `version-dataset` · `analyze-stats` · `batch-cohort` · `cross-national` · `replicate-study` |
461
+ | 🤖 **Medical-AI model engineering** | `preprocess-imaging` · `architecture-zoo` · `model-scaffold` · `model-validation` · `model-evaluation` · `explainability` · `model-card` · `mllm-eval` |
462
+ | ✍️ **Write & visualize** | `write-paper` · `make-figures` · `review-paper` · `present-paper` · `humanize` · `polish-language` · `academic-aio` |
463
+ | ✅ **Comply & verify** | `check-reporting` · `self-review` · `verify-refs` · `manage-refs` |
464
+ | 📤 **Submit & respond** | `find-journal` · `add-journal` · `sync-submission` · `revise` · `peer-review` · `fill-icmje-coi` |
465
+ | 🧭 **Orchestrate & manage** | `orchestrate` · `intake-project` · `manage-project` · `meta-analysis` · `grant-builder` · `publish-skill` · `render-pdf-doc` · `setup-medsci` |
466
+
450
467
  ### Available Now
451
468
 
452
469
  | Skill | What It Does |
@@ -463,10 +480,12 @@ ma-scout -> search-lit -> fulltext-retrieval -> design-study ──> write-proto
463
480
  | **design-study** | Study design review: identifies analysis unit, cohort logic, data leakage risks, comparator design, validation strategy, and reporting guideline fit. |
464
481
  | **design-ai-benchmarking** | Design and validity review for benchmarking AI system(s) against a human-expert panel: evaluation-question and arm definition, decoupled multi-dimensional rubrics with anchors, planted calibration probes (positive-control / known-bad / instability / mechanism-contradiction), reviewer-panel construction with per-reviewer randomization, inter-rater reliability targets with separate control-item reliability, LLM-as-judge vs human-as-judge adjudication, construct-independence guards, and a structured JSON rating-export schema. Locks the rubric before data collection. |
465
482
  | **model-validation** | Design or audit the clinical-validation study for an engineer-built medical-imaging model (segmentation / classification / detection): patient-level split disjointness and the data-leakage taxonomy, tuning-on-test, internal vs genuine external validation, comparator design, single-run vs multi-seed variance, task-correct metric selection (Metrics Reloaded), test-set sizing, and CLAIM 2024 / TRIPOD+AI / STARD-AI reporting fit. Ships a deterministic split-leakage gate that proves patient disjointness by set arithmetic on the emitted split table. Integrates with MONAI / nnU-Net — does not replace them. |
483
+ | **preprocess-imaging** | Design or audit the data-preparation stage of a medical-imaging model — DICOM/NIfTI intake, resampling, intensity normalization, and the augmentation plan — so the pipeline is leakage-safe before `model-scaffold` builds the training repo. Emits a declarative preprocessing manifest and a deterministic data-stage leakage gate (`check_preprocessing_leakage`) that catches what the split table cannot see: a dataset-level normaliser fit on non-train data (`NORMALIZATION_LEAKAGE`), a data-fitted transform run before the split (`PREPROCESS_BEFORE_SPLIT`), and a patient's slices crossing splits (`PATIENT_CROSS_SPLIT`). Integrates MONAI / TorchIO transforms; never reimplements them or touches real patient data. |
466
484
  | **model-scaffold** | Generate a reproducible, runnable PyTorch training repo for a medical-imaging task — segmentation (U-Net), classification, detection, image-to-image synthesis, or self-supervised pretraining — the missing middle link between choosing an architecture and validating a trained model. Emits a patient-level seed-locked split as an auditable artifact, a task-appropriate model, train/evaluate scripts that seed every RNG and infer under eval mode, a config, requirements, a reproducibility record, and a Methods stub with VERIFY placeholders (no fabricated numbers). Reproducibility holds by construction; ships a `check_training_hygiene` AST gate + a network-free build→validate challenge. Emits a minimal runnable default model for a forward-pass smoke test, and integrates with MONAI / nnU-Net / TorchIO / timm / torchvision for production-grade models. |
467
485
  | **architecture-zoo** | "Which architecture for which research question" decision tool: maps task (classification / segmentation / detection / transfer), modality, data scale, and class imbalance to a paper-grounded architecture shortlist. Curates the foundational curriculum (ResNet / DenseNet / EfficientNet / ViT / Swin; U-Net / 3-D U-Net / Attention & Residual U-Net / nnU-Net / Mask R-CNN; SAM/MedSAM / TotalSegmentator / BiomedCLIP / DINO / MAE / SimCLR) — each with core idea, when-to-use, medical-imaging use, reference implementation, validation setup, and the matching model-scaffold template. Advisory; teaches archetypes, not a live SOTA leaderboard. |
468
486
  | **model-card** | Generate the documentation an engineer-built medical-imaging model must carry — a Model Card (Mitchell et al. 2019), a Datasheet for its dataset (Gebru et al. 2021), and a METRIC-informed data-quality pass — filled from user-supplied facts (never fabricated), then verify every required section is present and non-empty with a deterministic completeness gate (`check_model_card_complete`). Model Card / Datasheet are documentation standards vendored as templates, not counted reporting checklists. |
469
487
  | **model-evaluation** | Compute and report task-correct held-out metrics for a trained medical-imaging model — segmentation (Dice + a boundary metric HD95/NSD, per structure), classification (AUROC + AUPRC + sensitivity/specificity with bootstrap CIs at the deployment prevalence), or detection (FROC/mAP with a stated IoU criterion) — plus calibration and subgroup slices. Emits a per-case table for analyze-stats and gates the metric choice against Metrics Reloaded / CLAIM 2024 (`check_metric_reporting`). Numbers come only from executed code. |
488
+ | **explainability** | 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 bar: mandatory Adebayo sanity checks (model- and data-randomisation), a quantitative localisation metric against ground truth (IoU / pointing game / Dice) instead of eyeballed examples, a cohort-level result, and attribution framing rather than "proof the model is correct". Emits an explainability-report manifest + a deterministic gate (`check_explainability_report`): `SALIENCY_AS_VALIDATION`, `NO_SANITY_CHECK`, `NO_LOCALIZATION_METRIC` (Major); `INSUFFICIENT_SANITY`, `CHERRY_PICKED_EXAMPLES`, `MISSING_METHOD` (Minor). Integrates captum / pytorch-grad-cam; never reimplements them or touches real patient data. |
470
489
  | **mllm-eval** | Model-agnostic evaluation harness (closed API or open weights) for an LLM/MLLM on a clinical task — radiology report generation, VQA, clinical text extraction — covering the adjudicated reference standard, clinical-efficacy metrics (RadGraph-F1 / CheXbert-F1 beyond BLEU/ROUGE), faithfulness/hallucination, pretraining-contamination, prompt sensitivity, and a reader study; gates the plan with `check_mllm_eval_completeness` and routes the reviewer audit to the MLLM probe. |
471
490
  | **intake-project** | Classifies new research projects, summarizes current state, identifies missing inputs, and recommends next steps. |
472
491
  | **grant-builder** | Structures grant proposals: significance, innovation, approach, milestones, and consortium roles. |
@@ -787,15 +806,44 @@ It helps other researchers find the toolkit — and we list it (with your permis
787
806
 
788
807
  ## Citation
789
808
 
790
- If you use MedSci Skills in your research, please cite the software via
791
- [`CITATION.cff`](CITATION.cff) (Zenodo concept DOI
792
- [10.5281/zenodo.20155321](https://doi.org/10.5281/zenodo.20155321)).
809
+ If MedSci Skills helped produce your manuscript, protocol, or analysis, please cite it
810
+ software citation is how a tool like this earns academic recognition, and it takes one line.
793
811
 
794
- The design and evaluation of the toolkit are described in a preprint:
812
+ **In your manuscript** (Methods or Acknowledgements cite the version you actually used):
795
813
 
796
- > Nam Y, Kim N. *Agentic Skills for Auditable and Reproducible Medical Research
797
- > Writing: An Integrity-gated Architecture for LLM-Assisted Clinical Manuscripts.*
798
- > arXiv:2606.09500 (2026). https://arxiv.org/abs/2606.09500
814
+ > Reporting-guideline compliance, reference verification, and pre-submission integrity checks
815
+ > were assisted by MedSci Skills (version X.Y.Z; https://github.com/Aperivue/medsci-skills;
816
+ > archived at Zenodo, https://doi.org/10.5281/zenodo.20155321).
817
+
818
+ **BibTeX** (the software, and the preprint describing its design):
819
+
820
+ ```bibtex
821
+ @software{nam_medsci_skills,
822
+ author = {Nam, Yoojin},
823
+ title = {{MedSci Skills: Claude Code Skills for the Medical Research Lifecycle}},
824
+ year = {2026},
825
+ publisher = {Zenodo},
826
+ doi = {10.5281/zenodo.20155321},
827
+ url = {https://github.com/Aperivue/medsci-skills}
828
+ }
829
+
830
+ @article{nam2026agentic,
831
+ author = {Nam, Yoojin and Kim, Namkug},
832
+ title = {{Agentic Skills for Auditable and Reproducible Medical Research Writing:
833
+ An Integrity-gated Architecture for LLM-Assisted Clinical Manuscripts}},
834
+ year = {2026},
835
+ journal = {arXiv preprint arXiv:2606.09500},
836
+ url = {https://arxiv.org/abs/2606.09500}
837
+ }
838
+ ```
839
+
840
+ The Zenodo **concept DOI** [10.5281/zenodo.20155321](https://doi.org/10.5281/zenodo.20155321)
841
+ always resolves to the latest release; [`CITATION.cff`](CITATION.cff) carries the machine-readable
842
+ metadata (GitHub's "Cite this repository" button reads it).
843
+
844
+ **Used it in published or in-review work?** Tell us via the
845
+ ["Used in research" issue template](https://github.com/Aperivue/medsci-skills/issues/new?template=used-in-research.yml)
846
+ — with your permission it is added to [`docs/citations.md`](docs/citations.md).
799
847
 
800
848
  ## Disclaimer
801
849
 
@@ -815,8 +863,16 @@ Bundled reporting guideline checklists retain their original Creative Commons li
815
863
 
816
864
  Optional dependency: `pdf_to_md.py` uses [pymupdf4llm](https://pymupdf.readthedocs.io) (AGPL-3.0). Not bundled -- installed separately by the user via `pip install pymupdf4llm`.
817
865
 
866
+ ## Star History
867
+
868
+ <a href="https://star-history.com/#Aperivue/medsci-skills&Date">
869
+ <img src="https://api.star-history.com/svg?repos=Aperivue/medsci-skills&type=Date" alt="MedSci Skills star history" width="640">
870
+ </a>
871
+
818
872
  ## About
819
873
 
820
874
  Built by [Aperivue](https://aperivue.com) -- tools for medical AI research and education.
821
875
 
876
+ **Runs anywhere the [Agent Skills standard](https://agentskills.io) is supported** -- not Claude Code alone. Claude Code, OpenAI Codex, Cursor, and GitHub Copilot are all verified against each host's own docs: one install, four hosts, no per-host fork ([host compatibility](docs/host_compatibility.md)).
877
+
822
878
  If you find this useful, consider giving it a star. It helps other researchers discover these tools.
@@ -1081,6 +1081,56 @@
1081
1081
  "size": 1411,
1082
1082
  "sha256": "3981d5da7734b90e6905ac329e996b145af82bd6a28ec2a8d42918e9ce077ee5"
1083
1083
  },
1084
+ {
1085
+ "path": "skills/explainability/SKILL.md",
1086
+ "size": 6474,
1087
+ "sha256": "4d1c082ad48393adb65203ffbedf63f772fdc521d873f657cbfc81150c7b36de"
1088
+ },
1089
+ {
1090
+ "path": "skills/explainability/references/explainability_guide.md",
1091
+ "size": 4203,
1092
+ "sha256": "24bc06181e54801b148f142f9312fe0eede9f540a4e57810701506681e254b4b"
1093
+ },
1094
+ {
1095
+ "path": "skills/explainability/scripts/check_explainability_report.py",
1096
+ "size": 10783,
1097
+ "sha256": "4071a93aacf509f73a44b2c7f6423b5722aab3d44c79e9a8680845454261d47d"
1098
+ },
1099
+ {
1100
+ "path": "skills/explainability/scripts/check_explainability_report_challenge/expected/strong.txt",
1101
+ "size": 391,
1102
+ "sha256": "317018eb7546f77b2de39ff1b73c9e82584a9d65c25eb91a940de76a4c7d2ec5"
1103
+ },
1104
+ {
1105
+ "path": "skills/explainability/scripts/check_explainability_report_challenge/expected/weak.txt",
1106
+ "size": 876,
1107
+ "sha256": "de5c090c1ee4c632d7d59bc0d5f20fac8d28342b74b68eb51066677658245451"
1108
+ },
1109
+ {
1110
+ "path": "skills/explainability/scripts/check_explainability_report_challenge/fixture/report_strong.json",
1111
+ "size": 238,
1112
+ "sha256": "b835871c1d98313f736575faf7f6adbb5cfabe4e3dfd1abe1279976c8c5f1867"
1113
+ },
1114
+ {
1115
+ "path": "skills/explainability/scripts/check_explainability_report_challenge/fixture/report_weak.json",
1116
+ "size": 163,
1117
+ "sha256": "dfde5db357a83660f941fdde957bb3a9af25f60d26300322f04b3981b13c429a"
1118
+ },
1119
+ {
1120
+ "path": "skills/explainability/scripts/check_explainability_report_challenge/problem.md",
1121
+ "size": 805,
1122
+ "sha256": "1b667c138ac54e38614e438efdb995adba208588007e95eed6f374233ff6dcdc"
1123
+ },
1124
+ {
1125
+ "path": "skills/explainability/scripts/check_explainability_report_challenge/verify.sh",
1126
+ "size": 2005,
1127
+ "sha256": "5246897dc616e04fa1260e9b20d9970e1499f95ebb52034bba59482d401c1156"
1128
+ },
1129
+ {
1130
+ "path": "skills/explainability/skill.yml",
1131
+ "size": 3569,
1132
+ "sha256": "5b3e135825470392867dc851627d9899bc512d9a5ee52556c205eea8fae4edb1"
1133
+ },
1084
1134
  {
1085
1135
  "path": "skills/fill-icmje-coi/SKILL.md",
1086
1136
  "size": 9997,
@@ -3181,6 +3231,56 @@
3181
3231
  "size": 1753,
3182
3232
  "sha256": "ce4996820b24c230584890c501860c8d37dfd07521195954077d2fdd1a26f419"
3183
3233
  },
3234
+ {
3235
+ "path": "skills/preprocess-imaging/SKILL.md",
3236
+ "size": 7068,
3237
+ "sha256": "e17b73b0760194d4e6e3924ec2a0452601adc27122e7455cc5f2993d5af1d0d0"
3238
+ },
3239
+ {
3240
+ "path": "skills/preprocess-imaging/references/preprocessing_guide.md",
3241
+ "size": 5023,
3242
+ "sha256": "fdab6d435ff6bce7b6787319acda9b0b160411bc2e1109e15154bbb8a68c8282"
3243
+ },
3244
+ {
3245
+ "path": "skills/preprocess-imaging/scripts/check_preprocessing_leakage.py",
3246
+ "size": 12992,
3247
+ "sha256": "dcce1493a29122ed4259adc116ed7ad239b11ee1f45a10f6f7eb94698b3efa67"
3248
+ },
3249
+ {
3250
+ "path": "skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/expected/clean.txt",
3251
+ "size": 370,
3252
+ "sha256": "bc1efcfc1d8575d78a0448752e60a3b58d654a5bc1a7b11360e4d9ba690665ac"
3253
+ },
3254
+ {
3255
+ "path": "skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/expected/leak.txt",
3256
+ "size": 1030,
3257
+ "sha256": "fe046c81f20b34a6ff3fd6858f7832e786106ed56635b39f7e413b4853d4b7e8"
3258
+ },
3259
+ {
3260
+ "path": "skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/fixture/manifest_clean.json",
3261
+ "size": 800,
3262
+ "sha256": "e01ff6d09aae6f76d3b2b1cd05c333d66fd53499a2a2d1296380eefde720c515"
3263
+ },
3264
+ {
3265
+ "path": "skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/fixture/manifest_leak.json",
3266
+ "size": 881,
3267
+ "sha256": "a55389654128c577e16eefb3c6b8f85d8a47bdc06a817619f13036a1e1ebe4b4"
3268
+ },
3269
+ {
3270
+ "path": "skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/problem.md",
3271
+ "size": 903,
3272
+ "sha256": "042ddd4736133ccf63192ea65c4faa714b2854ec9bb704f29ca2f401cd4658ee"
3273
+ },
3274
+ {
3275
+ "path": "skills/preprocess-imaging/scripts/check_preprocessing_leakage_challenge/verify.sh",
3276
+ "size": 2188,
3277
+ "sha256": "9201d264720627f7281f43bcf3b1093bf6940f67acd7c299c8b3ac64fb58b564"
3278
+ },
3279
+ {
3280
+ "path": "skills/preprocess-imaging/skill.yml",
3281
+ "size": 3518,
3282
+ "sha256": "c6edc7ac6421438d4e0b64cd416202ac9f91092870ea1cb8531ba15fda7d5c72"
3283
+ },
3184
3284
  {
3185
3285
  "path": "skills/present-paper/SKILL.md",
3186
3286
  "size": 33518,
@@ -3758,8 +3858,8 @@
3758
3858
  },
3759
3859
  {
3760
3860
  "path": "skills/self-review/scripts/check_scope_coherence.py",
3761
- "size": 11920,
3762
- "sha256": "e600e54fcbe308060a8dadd871ec274b6ae19f89456ae0194490e152c0d09a91"
3861
+ "size": 12989,
3862
+ "sha256": "2444bce9c5bd2fc088c43eae97c1fc5791ae4da44f428a2caa0559b976dbe622"
3763
3863
  },
3764
3864
  {
3765
3865
  "path": "skills/self-review/scripts/check_supplement_hygiene.py",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "version": "5.14.0",
3
+ "version": "5.15.0",
4
4
  "owned_skills": [
5
5
  "academic-aio",
6
6
  "add-journal",
@@ -16,6 +16,7 @@
16
16
  "deidentify",
17
17
  "design-ai-benchmarking",
18
18
  "design-study",
19
+ "explainability",
19
20
  "fill-icmje-coi",
20
21
  "fill-protocol",
21
22
  "find-cohort-gap",
@@ -39,6 +40,7 @@
39
40
  "orchestrate",
40
41
  "peer-review",
41
42
  "polish-language",
43
+ "preprocess-imaging",
42
44
  "present-paper",
43
45
  "publish-skill",
44
46
  "render-pdf-doc",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_comment": "AUTO-GENERATED by scripts/gen_skills_catalog_json.py from each skills/<slug>/SKILL.md + skill.yml. Machine-readable skill catalog (single source of truth) consumed by external surfaces such as the aperivue.com storefront to gate skill-list completeness. Do not hand-edit; CI gate: python3 scripts/gen_skills_catalog_json.py --check.",
3
- "skill_count": 51,
3
+ "skill_count": 53,
4
4
  "categories": [
5
5
  {
6
6
  "key": "literature_references",
@@ -32,11 +32,13 @@
32
32
  "label": "Model Engineering & Validation",
33
33
  "slugs": [
34
34
  "architecture-zoo",
35
+ "explainability",
35
36
  "mllm-eval",
36
37
  "model-card",
37
38
  "model-evaluation",
38
39
  "model-scaffold",
39
- "model-validation"
40
+ "model-validation",
41
+ "preprocess-imaging"
40
42
  ]
41
43
  },
42
44
  {
@@ -235,6 +237,15 @@
235
237
  "maturity": "official",
236
238
  "description": "Study design and validity review for radiology and medical AI research."
237
239
  },
240
+ {
241
+ "slug": "explainability",
242
+ "category": "model_engineering",
243
+ "category_label": "Model Engineering & Validation",
244
+ "layer": "D",
245
+ "owner_domain": "model_validation",
246
+ "maturity": "official",
247
+ "description": "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 bar a re…"
248
+ },
238
249
  {
239
250
  "slug": "fill-icmje-coi",
240
251
  "category": "submission_journals",
@@ -442,6 +453,15 @@
442
453
  "maturity": "official",
443
454
  "description": "Academic English consistency linting and non-native (ESL) language polish for medical manuscripts."
444
455
  },
456
+ {
457
+ "slug": "preprocess-imaging",
458
+ "category": "model_engineering",
459
+ "category_label": "Model Engineering & Validation",
460
+ "layer": "D",
461
+ "owner_domain": "model_validation",
462
+ "maturity": "official",
463
+ "description": "Design or audit the data-preparation stage of a medical-imaging model — DICOM/NIfTI intake, resampling and intensity normalisation, and the augmentation plan — so the pipeline is leakage-safe before m…"
464
+ },
445
465
  {
446
466
  "slug": "present-paper",
447
467
  "category": "presentation_tooling",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "medsci-skills",
3
- "version": "5.14.0",
3
+ "version": "5.15.0",
4
4
  "description": "MedSci Skills — a medical/scientific research skill suite for AI coding agents (Claude Code, Codex, Cursor, Copilot). The npm package is a terminal-friendly installer shortcut; the canonical distribution remains the GitHub repository and the Claude Code plugin marketplace.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://github.com/Aperivue/medsci-skills#readme",
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: explainability
3
+ description: >
4
+ Produce or audit the interpretability/explainability analysis of a medical-imaging model —
5
+ Grad-CAM / Grad-CAM++ / attention-rollout / saliency / integrated-gradients — so it clears the rigor
6
+ bar a reviewer expects: mandatory Adebayo sanity checks (model- and data-randomisation), a
7
+ quantitative localisation metric against ground truth (IoU / pointing game / Dice) instead of eyeballed
8
+ examples, a cohort-level result rather than cherry-picked cases, and attribution framing rather than
9
+ "proof the model is correct". Emits an explainability-report manifest and a deterministic rigor gate.
10
+ Integrates captum / pytorch-grad-cam; it does not reimplement them, and never runs a model on real
11
+ patient data.
12
+ triggers: explainability, interpretability, saliency, saliency map, grad-cam, gradcam, grad-cam++, attention map, attention rollout, integrated gradients, captum, pytorch-grad-cam, heatmap, class activation map, CAM, feature attribution, sanity check, Adebayo, model randomization, localization metric, pointing game, IoU with ground truth, XAI, explainable AI, model looks at, faithfulness
13
+ tools: Read, Write, Edit, Bash, Grep, Glob
14
+ model: inherit
15
+ ---
16
+
17
+ # Explainability Skill
18
+
19
+ ## Purpose
20
+
21
+ A saliency / Grad-CAM heat-map is the **most over-interpreted artifact** in medical-imaging AI: a
22
+ colourful map over the lesion is routinely presented as proof the model "looks at the right thing."
23
+ Adebayo et al. (*NeurIPS* 2018) showed many saliency methods produce visually convincing maps that are
24
+ **independent of the model's learned weights and of the labels** — so they explain nothing. This skill
25
+ produces an explainability analysis that clears the rigor bar, and audits an existing one, so the map
26
+ is trustworthy before it reaches a manuscript (CLAIM 2024 / TRIPOD+AI interpretability items).
27
+
28
+ It sits alongside evaluation in the lane: `/architecture-zoo` → `/preprocess-imaging` →
29
+ `/model-scaffold` → `/model-validation` → `/model-evaluation` + **explainability** →
30
+ `/write-paper` + `/check-reporting`. It **integrates** captum / pytorch-grad-cam (referenced in the
31
+ plan); it does not reimplement them and never runs a model on real patient data.
32
+
33
+ ## When to use
34
+ - You produced (or are about to produce) saliency / Grad-CAM / attention maps and want them reported
35
+ to the standard a reviewer expects.
36
+ - You want to audit an explainability analysis for the four failure modes below.
37
+
38
+ ## When NOT to use
39
+ - Discrimination / calibration metrics → `/model-evaluation` then `/analyze-stats`.
40
+ - Split or preprocessing leakage → `/model-validation` / `/preprocess-imaging`.
41
+ - LLM/MLLM faithfulness & hallucination → `/mllm-eval`.
42
+ - Reimplementing captum / pytorch-grad-cam → out of scope (this skill wires and audits them).
43
+
44
+ ## The four failure modes (what the gate enforces)
45
+ 1. **Saliency as validation.** A map is *attribution*, not proof the model is correct or that the
46
+ relationship is causal. Frame it as "where signal is attributed", never as "the model is right".
47
+ 2. **No sanity check.** Run the Adebayo **model-randomisation** and **data-randomisation** tests. A map
48
+ that survives neither is uninterpretable; both axes are the minimum bar.
49
+ 3. **No quantitative localisation.** If you claim the map localises the finding, measure it — IoU /
50
+ pointing game / Dice against ground-truth masks — do not eyeball a few examples.
51
+ 4. **Cherry-picked examples.** Report a cohort-level result, not a handful of hand-picked cases.
52
+
53
+ ## Workflow
54
+
55
+ ### Phase 1 — Produce the maps (integrate, don't reimplement)
56
+ Choose the method for the architecture (`references/explainability_guide.md`): Grad-CAM / Grad-CAM++
57
+ for CNNs, attention-rollout for ViTs, integrated-gradients / SHAP for attribution. Wire captum or
58
+ pytorch-grad-cam; do not write a new CAM implementation.
59
+
60
+ ### Phase 2 — Sanity-check and quantify
61
+ - Run the **model-parameter randomisation** and **data (label) randomisation** tests (Adebayo 2018);
62
+ a faithful map degrades when the model/labels are randomised.
63
+ - Compute a **quantitative localisation metric** against ground-truth masks (IoU / pointing game /
64
+ Dice) over the cohort — not a visual impression.
65
+
66
+ ### Phase 3 — Emit the explainability-report manifest
67
+ ```json
68
+ {
69
+ "method": "grad-cam++",
70
+ "n_examples": 200,
71
+ "cohort_level": true,
72
+ "localization_metric": "iou",
73
+ "localization_value": 0.63,
74
+ "sanity_checks": ["model_randomization", "data_randomization"],
75
+ "interpretation": "localization"
76
+ }
77
+ ```
78
+ `interpretation`: `attribution` / `localization` / `faithfulness` (descriptive) — never
79
+ `validation` / `causal` (overclaim).
80
+
81
+ ### Phase 4 — Gate the report (deterministic)
82
+ ```bash
83
+ python3 scripts/check_explainability_report.py --manifest explainability_report.json --strict
84
+ ```
85
+ Verdicts: `SALIENCY_AS_VALIDATION`, `NO_SANITY_CHECK`, `NO_LOCALIZATION_METRIC` (Major);
86
+ `INSUFFICIENT_SANITY`, `CHERRY_PICKED_EXAMPLES`, `MISSING_METHOD` (Minor). The verdict is reproduced
87
+ by rule on the manifest, never asserted from prose.
88
+
89
+ ## Integration
90
+ - **`/model-evaluation`** — explainability accompanies the held-out metrics as a secondary analysis.
91
+ - **`/self-review`** `ai_overclaiming` / `image_synthesis` probes audit saliency overclaiming in a
92
+ finished manuscript; this skill *produces* the rigorous analysis they look for.
93
+ - **`/check-reporting`** — the manifest documents the CLAIM 2024 / TRIPOD+AI interpretability items.
94
+
95
+ ## Anti-Hallucination
96
+
97
+ - **Never fabricate saliency maps, localisation metrics, or sanity-check results.** Every value in the
98
+ manifest comes from the researcher's executed XAI code — never invented. This skill designs and
99
+ audits the analysis; it does not run a model on real patient data.
100
+ - **Never present a saliency map as proof of model correctness or causation.** A map is attribution;
101
+ claiming it validates the model is the overclaim this skill exists to prevent (`SALIENCY_AS_VALIDATION`).
102
+ - **Never report an explainability-audit "pass" without running `check_explainability_report.py`.** The
103
+ rigor verdict is reproduced deterministically, never asserted from prose.
104
+ - **Integrate, don't reimplement.** Reference captum / pytorch-grad-cam; do not write a new CAM /
105
+ attribution implementation or claim results for one.
106
+
107
+ ## Reproducible challenge
108
+ `scripts/check_explainability_report_challenge/` ships a synthetic weak/strong report pair with a
109
+ network-free `verify.sh` wired into the skill's validation commands.
@@ -0,0 +1,66 @@
1
+ # Medical-imaging explainability — method, sanity, localisation
2
+
3
+ Companion to `explainability`. This is *produce* knowledge: which XAI method fits which architecture,
4
+ the sanity checks a faithful map must pass, how to measure localisation quantitatively, and how to
5
+ frame the result honestly. It wires captum / pytorch-grad-cam by name; it does not reimplement them.
6
+
7
+ ## 1. Method by architecture
8
+
9
+ | Model | Method | Library | Note |
10
+ |---|---|---|---|
11
+ | CNN (ResNet/DenseNet/EfficientNet) | **Grad-CAM / Grad-CAM++** | `pytorch-grad-cam`, `captum` (`LayerGradCam`) | Target the last conv block; Grad-CAM++ handles multiple instances |
12
+ | CNN, fine attribution | **Integrated Gradients**, **SHAP** | `captum` (`IntegratedGradients`), `shap` | Needs a baseline (black/blurred image, not zeros for CT) |
13
+ | Vision Transformer (ViT/Swin) | **Attention rollout**, **Grad-CAM on tokens** | `captum`, custom rollout | Raw attention ≠ explanation; rollout aggregates across layers |
14
+ | Segmentation (U-Net) | Region-level attribution; per-class Grad-CAM | `captum` `LayerGradCam` on the decoder | The mask *is* the localisation; explain the classification head if any |
15
+ | Any | **Occlusion / perturbation** | `captum` (`Occlusion`) | Model-agnostic sanity cross-check for a gradient method |
16
+
17
+ Pick one primary method and, where feasible, a second of a different family (gradient vs perturbation)
18
+ as a cross-check — agreement between families is stronger evidence than one pretty map.
19
+
20
+ ## 2. Sanity checks (mandatory — Adebayo et al. 2018)
21
+
22
+ A saliency method can produce a convincing map that is **independent of the model and the labels**.
23
+ Before trusting any map, run both:
24
+
25
+ - **Model-parameter randomisation test** — progressively randomise the trained weights (top layer →
26
+ all layers). A *faithful* map degrades toward noise; a map that is unchanged is an edge detector, not
27
+ an explanation.
28
+ - **Data (label) randomisation test** — retrain on permuted labels. A faithful method's maps should
29
+ differ from the correctly-trained model's; if identical, the map reflects the input, not the learned
30
+ function.
31
+
32
+ Report the outcome (e.g. rank correlation of the map before/after randomisation). Declaring
33
+ `sanity_checks: ["model_randomization", "data_randomization"]` in the manifest is the gate's minimum;
34
+ one axis alone raises `INSUFFICIENT_SANITY`.
35
+
36
+ ## 3. Quantitative localisation (don't eyeball)
37
+
38
+ If you claim the map "focuses on the lesion", measure it against ground-truth masks/boxes over the
39
+ cohort — not a few examples:
40
+
41
+ | Metric | What it measures | Range |
42
+ |---|---|---|
43
+ | **IoU / Dice** (thresholded map vs GT mask) | Overlap of the salient region with the finding | 0–1 |
44
+ | **Pointing game** | Does the map's peak fall inside the GT box? (hit rate over cohort) | 0–1 |
45
+ | **Energy-based pointing game** | Fraction of map energy inside the GT mask | 0–1 |
46
+
47
+ Report the metric **with a denominator** (n cases) and, ideally, a CI. A single annotated example is an
48
+ illustration, not evidence — the gate raises `CHERRY_PICKED_EXAMPLES` when `cohort_level` is not set.
49
+
50
+ ## 4. Framing (attribution, not validation)
51
+
52
+ - **Say:** "Grad-CAM attributed the prediction to the perihilar region in X% of true positives (IoU
53
+ 0.6)." → `interpretation: localization` / `attribution`.
54
+ - **Do not say:** "The saliency map confirms the model is correct / uses clinically valid features /
55
+ proves causation." A map shows *where signal is attributed under this method*, not that the decision
56
+ is right or that the feature is causal. This framing raises `SALIENCY_AS_VALIDATION` (Major).
57
+ - A map that localises well can still accompany a wrong prediction, and a correct prediction can have a
58
+ diffuse map — localisation and correctness are separate axes.
59
+
60
+ ## 5. Common reviewer objections this pre-empts
61
+
62
+ 1. "Did you sanity-check the saliency method?" → §2, both axes.
63
+ 2. "Is the localisation quantified or just shown on one case?" → §3, cohort metric.
64
+ 3. "You claim the map validates the model — it doesn't." → §4, reframe as attribution.
65
+ 4. "Which layer / baseline / method version?" → declare `method` (and layer/baseline in notes);
66
+ missing method raises `MISSING_METHOD`.