medsci-skills 4.1.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 (702) hide show
  1. package/LICENSE +50 -0
  2. package/README.md +602 -0
  3. package/README_FIRST.md +27 -0
  4. package/bin/medsci-skills.js +159 -0
  5. package/installers/install-macos.command +19 -0
  6. package/installers/install-windows.cmd +26 -0
  7. package/installers/install-windows.ps1 +17 -0
  8. package/installers/install.py +218 -0
  9. package/metadata/skills_catalog.json +452 -0
  10. package/package.json +48 -0
  11. package/skills/academic-aio/SKILL.md +408 -0
  12. package/skills/academic-aio/references/case_studies/kjr_mllm_2025.md +82 -0
  13. package/skills/academic-aio/references/checklists/AIO_GENERAL.md +354 -0
  14. package/skills/academic-aio/references/journal_summarybox_templates.yaml +126 -0
  15. package/skills/academic-aio/references/oac_funding_checklist.yaml +129 -0
  16. package/skills/academic-aio/references/reporting_guideline_mapping.md +39 -0
  17. package/skills/academic-aio/references/schema_markup_templates/CodeRepository.jsonld +32 -0
  18. package/skills/academic-aio/references/schema_markup_templates/Dataset.jsonld +36 -0
  19. package/skills/academic-aio/references/schema_markup_templates/Person.jsonld +30 -0
  20. package/skills/academic-aio/references/schema_markup_templates/README.md +43 -0
  21. package/skills/academic-aio/references/schema_markup_templates/ScholarlyArticle.jsonld +55 -0
  22. package/skills/academic-aio/scripts/batch_metadata_audit.py +169 -0
  23. package/skills/academic-aio/scripts/validate_schema.py +118 -0
  24. package/skills/academic-aio/skill.yml +36 -0
  25. package/skills/academic-aio/templates/aio_audit_checklist.md.j2 +108 -0
  26. package/skills/add-journal/SKILL.md +482 -0
  27. package/skills/add-journal/skill.yml +33 -0
  28. package/skills/analyze-stats/SKILL.md +598 -0
  29. package/skills/analyze-stats/references/analysis_guides/missing_data.md +109 -0
  30. package/skills/analyze-stats/references/analysis_guides/nhis_icd10_mapping.md +247 -0
  31. package/skills/analyze-stats/references/analysis_guides/propensity_score.md +132 -0
  32. package/skills/analyze-stats/references/analysis_guides/regression.md +115 -0
  33. package/skills/analyze-stats/references/analysis_guides/repeated_measures.md +160 -0
  34. package/skills/analyze-stats/references/analysis_guides/survey_weighted.md +366 -0
  35. package/skills/analyze-stats/references/analysis_guides/test_selection.md +86 -0
  36. package/skills/analyze-stats/references/style/figure_style.mplstyle +69 -0
  37. package/skills/analyze-stats/references/style/theme_publication.R +147 -0
  38. package/skills/analyze-stats/references/table-standards/journal-profiles/ajr.yaml +51 -0
  39. package/skills/analyze-stats/references/table-standards/journal-profiles/european_radiology.yaml +55 -0
  40. package/skills/analyze-stats/references/table-standards/journal-profiles/jama.yaml +66 -0
  41. package/skills/analyze-stats/references/table-standards/journal-profiles/lancet.yaml +57 -0
  42. package/skills/analyze-stats/references/table-standards/journal-profiles/nejm.yaml +51 -0
  43. package/skills/analyze-stats/references/table-standards/journal-profiles/radiology.yaml +66 -0
  44. package/skills/analyze-stats/references/table-standards/table-standards.md +287 -0
  45. package/skills/analyze-stats/references/table-standards/table-types/diagnostic_accuracy.md +36 -0
  46. package/skills/analyze-stats/references/table-standards/table-types/meta_analysis.md +58 -0
  47. package/skills/analyze-stats/references/table-standards/table-types/model_comparison.md +36 -0
  48. package/skills/analyze-stats/references/table-standards/table-types/regression_results.md +50 -0
  49. package/skills/analyze-stats/references/table-standards/table-types/table1_demographics.md +51 -0
  50. package/skills/analyze-stats/references/table-standards/tool-comparison.md +79 -0
  51. package/skills/analyze-stats/references/templates/agreement_analysis.py +436 -0
  52. package/skills/analyze-stats/references/templates/dca_plot.R +237 -0
  53. package/skills/analyze-stats/references/templates/diagnostic_accuracy.py +401 -0
  54. package/skills/analyze-stats/references/templates/dta_meta_analysis.R +384 -0
  55. package/skills/analyze-stats/references/templates/forest_plot.py +412 -0
  56. package/skills/analyze-stats/references/templates/likert_summary.py +356 -0
  57. package/skills/analyze-stats/references/templates/meta_analysis.R +365 -0
  58. package/skills/analyze-stats/references/templates/propensity_score.py +478 -0
  59. package/skills/analyze-stats/references/templates/regression.py +425 -0
  60. package/skills/analyze-stats/references/templates/repeated_measures.py +434 -0
  61. package/skills/analyze-stats/references/templates/sample_size.R +382 -0
  62. package/skills/analyze-stats/references/templates/survey_weighted_analysis.py +411 -0
  63. package/skills/analyze-stats/references/templates/survival_analysis.py +325 -0
  64. package/skills/analyze-stats/references/templates/table1_demographics.py +287 -0
  65. package/skills/analyze-stats/scripts/check_generated_code.py +335 -0
  66. package/skills/analyze-stats/skill.yml +38 -0
  67. package/skills/analyze-stats/tests/fixtures/gen_bad.R +16 -0
  68. package/skills/analyze-stats/tests/fixtures/gen_bad.py +24 -0
  69. package/skills/analyze-stats/tests/fixtures/gen_clean.py +21 -0
  70. package/skills/analyze-stats/tests/test_generated_code.sh +59 -0
  71. package/skills/analyze-stats/tests/test_survival_template.sh +53 -0
  72. package/skills/author-strategy/SKILL.md +117 -0
  73. package/skills/author-strategy/analyze_patterns.py +303 -0
  74. package/skills/author-strategy/fetch_pubmed.py +374 -0
  75. package/skills/author-strategy/skill.yml +34 -0
  76. package/skills/batch-cohort/SKILL.md +223 -0
  77. package/skills/batch-cohort/references/base_template_knhanes.R +210 -0
  78. package/skills/batch-cohort/references/batch_template_generator.R +222 -0
  79. package/skills/batch-cohort/references/variable_coding_registry.md +136 -0
  80. package/skills/batch-cohort/skill.yml +35 -0
  81. package/skills/calc-sample-size/SKILL.md +491 -0
  82. package/skills/calc-sample-size/references/formulas.md +655 -0
  83. package/skills/calc-sample-size/references/observational_cohort.md +49 -0
  84. package/skills/calc-sample-size/skill.yml +51 -0
  85. package/skills/check-reporting/SKILL.md +534 -0
  86. package/skills/check-reporting/references/LICENSES.md +41 -0
  87. package/skills/check-reporting/references/checklists/AMSTAR2.md +54 -0
  88. package/skills/check-reporting/references/checklists/ARRIVE_2.md +234 -0
  89. package/skills/check-reporting/references/checklists/CARE.md +102 -0
  90. package/skills/check-reporting/references/checklists/CLAIM_2024.md +128 -0
  91. package/skills/check-reporting/references/checklists/CLEAR.md +113 -0
  92. package/skills/check-reporting/references/checklists/CONSORT.md +86 -0
  93. package/skills/check-reporting/references/checklists/COSMIN_RoB.md +136 -0
  94. package/skills/check-reporting/references/checklists/GRRAS.md +61 -0
  95. package/skills/check-reporting/references/checklists/MI_CLEAR_LLM.md +167 -0
  96. package/skills/check-reporting/references/checklists/MOOSE.md +85 -0
  97. package/skills/check-reporting/references/checklists/NOS.md +88 -0
  98. package/skills/check-reporting/references/checklists/PRISMA_2020.md +135 -0
  99. package/skills/check-reporting/references/checklists/PRISMA_DTA.md +36 -0
  100. package/skills/check-reporting/references/checklists/PRISMA_P.md +56 -0
  101. package/skills/check-reporting/references/checklists/PROBAST.md +75 -0
  102. package/skills/check-reporting/references/checklists/PROBAST_AI.md +130 -0
  103. package/skills/check-reporting/references/checklists/QUADAS2.md +77 -0
  104. package/skills/check-reporting/references/checklists/QUADAS_C.md +131 -0
  105. package/skills/check-reporting/references/checklists/ROBINS_E.md +179 -0
  106. package/skills/check-reporting/references/checklists/ROBINS_I.md +87 -0
  107. package/skills/check-reporting/references/checklists/ROBIS.md +114 -0
  108. package/skills/check-reporting/references/checklists/ROB_ME.md +126 -0
  109. package/skills/check-reporting/references/checklists/RoB2.md +79 -0
  110. package/skills/check-reporting/references/checklists/RoB_NMA.md +96 -0
  111. package/skills/check-reporting/references/checklists/SPIRIT.md +112 -0
  112. package/skills/check-reporting/references/checklists/SQUIRE_2.md +68 -0
  113. package/skills/check-reporting/references/checklists/STARD.md +129 -0
  114. package/skills/check-reporting/references/checklists/STARD_AI.md +211 -0
  115. package/skills/check-reporting/references/checklists/STROBE.md +80 -0
  116. package/skills/check-reporting/references/checklists/SWiM.md +33 -0
  117. package/skills/check-reporting/references/checklists/TRIPOD.md +157 -0
  118. package/skills/check-reporting/references/checklists/TRIPOD_AI.md +140 -0
  119. package/skills/check-reporting/references/step4c_registration_timing.md +93 -0
  120. package/skills/check-reporting/references/step4d_prisma_figure_audit.md +137 -0
  121. package/skills/check-reporting/scripts/check_checklist_exists.py +183 -0
  122. package/skills/check-reporting/scripts/check_checklist_version.py +168 -0
  123. package/skills/check-reporting/scripts/check_framework_naming.py +206 -0
  124. package/skills/check-reporting/scripts/check_prisma_figure.py +209 -0
  125. package/skills/check-reporting/scripts/prisma_cascade_check.py +274 -0
  126. package/skills/check-reporting/skill.yml +41 -0
  127. package/skills/check-reporting/tests/fixtures/framework_bad.md +8 -0
  128. package/skills/check-reporting/tests/fixtures/framework_clean.md +7 -0
  129. package/skills/check-reporting/tests/test_checklist_fail_fast.sh +77 -0
  130. package/skills/check-reporting/tests/test_checklist_version.sh +72 -0
  131. package/skills/check-reporting/tests/test_framework_naming.sh +45 -0
  132. package/skills/check-reporting/tests/test_prisma_cascade.sh +104 -0
  133. package/skills/clean-data/SKILL.md +180 -0
  134. package/skills/clean-data/references/cleaning_patterns.md +299 -0
  135. package/skills/clean-data/references/profiling_template.py +304 -0
  136. package/skills/clean-data/scripts/check_structural_zero.py +174 -0
  137. package/skills/clean-data/skill.yml +35 -0
  138. package/skills/clean-data/tests/fixtures/smoking.csv +8 -0
  139. package/skills/clean-data/tests/test_structural_zero.sh +49 -0
  140. package/skills/cross-national/SKILL.md +264 -0
  141. package/skills/cross-national/skill.yml +37 -0
  142. package/skills/define-variables/SKILL.md +146 -0
  143. package/skills/define-variables/references/common_definitions.md +190 -0
  144. package/skills/define-variables/skill.yml +34 -0
  145. package/skills/define-variables/templates/variable_operationalization.md +64 -0
  146. package/skills/deidentify/SKILL.md +203 -0
  147. package/skills/deidentify/deidentify.py +1224 -0
  148. package/skills/deidentify/locales/_template.json +45 -0
  149. package/skills/deidentify/locales/au.json +43 -0
  150. package/skills/deidentify/locales/ca.json +44 -0
  151. package/skills/deidentify/locales/cn.json +47 -0
  152. package/skills/deidentify/locales/de.json +48 -0
  153. package/skills/deidentify/locales/fr.json +48 -0
  154. package/skills/deidentify/locales/in.json +48 -0
  155. package/skills/deidentify/locales/jp.json +48 -0
  156. package/skills/deidentify/locales/kr.json +48 -0
  157. package/skills/deidentify/locales/uk.json +45 -0
  158. package/skills/deidentify/locales/us.json +43 -0
  159. package/skills/deidentify/references/date_shift_guide.md +82 -0
  160. package/skills/deidentify/references/hipaa_18_identifiers.md +48 -0
  161. package/skills/deidentify/references/korean_phi_patterns.md +135 -0
  162. package/skills/deidentify/skill.yml +43 -0
  163. package/skills/deidentify/tests/README.md +26 -0
  164. package/skills/deidentify/tests/test_clean.csv +16 -0
  165. package/skills/deidentify/tests/test_edge_cases.csv +11 -0
  166. package/skills/deidentify/tests/test_phi_korean.csv +11 -0
  167. package/skills/design-ai-benchmarking/SKILL.md +214 -0
  168. package/skills/design-ai-benchmarking/references/benchmark_export_schema.json +69 -0
  169. package/skills/design-ai-benchmarking/references/elicitation_rubric_template.md +37 -0
  170. package/skills/design-ai-benchmarking/skill.yml +38 -0
  171. package/skills/design-study/SKILL.md +298 -0
  172. package/skills/design-study/skill.yml +33 -0
  173. package/skills/fill-icmje-coi/SKILL.md +216 -0
  174. package/skills/fill-icmje-coi/scripts/fill_icmje_coi.py +140 -0
  175. package/skills/fill-icmje-coi/skill.yml +35 -0
  176. package/skills/fill-icmje-coi/templates/icmje_coi_seed_synthetic.docx +0 -0
  177. package/skills/fill-protocol/SKILL.md +248 -0
  178. package/skills/fill-protocol/examples/example_irb_template.yaml +53 -0
  179. package/skills/fill-protocol/references/best_practices.md +121 -0
  180. package/skills/fill-protocol/scripts/doc_to_docx.py +111 -0
  181. package/skills/fill-protocol/scripts/fill_form.py +611 -0
  182. package/skills/fill-protocol/scripts/inspect_template.py +61 -0
  183. package/skills/fill-protocol/setup.sh +162 -0
  184. package/skills/fill-protocol/skill.yml +37 -0
  185. package/skills/find-cohort-gap/SKILL.md +309 -0
  186. package/skills/find-cohort-gap/references/cohort_profile_template.md +93 -0
  187. package/skills/find-cohort-gap/references/onepager_template.md +84 -0
  188. package/skills/find-cohort-gap/references/pattern_scoring_rubric.md +169 -0
  189. package/skills/find-cohort-gap/references/saturation_query_templates.md +143 -0
  190. package/skills/find-cohort-gap/skill.yml +35 -0
  191. package/skills/find-journal/POLICY.md +87 -0
  192. package/skills/find-journal/SKILL.md +340 -0
  193. package/skills/find-journal/references/journal_profiles/AJNR.md +29 -0
  194. package/skills/find-journal/references/journal_profiles/AJR.md +30 -0
  195. package/skills/find-journal/references/journal_profiles/Abdominal_Radiology.md +30 -0
  196. package/skills/find-journal/references/journal_profiles/Academic_Radiology.md +30 -0
  197. package/skills/find-journal/references/journal_profiles/Annals_of_Internal_Medicine.md +33 -0
  198. package/skills/find-journal/references/journal_profiles/Artificial_Intelligence_in_Medicine.md +28 -0
  199. package/skills/find-journal/references/journal_profiles/BMC_Medicine.md +31 -0
  200. package/skills/find-journal/references/journal_profiles/British_Journal_of_Radiology.md +39 -0
  201. package/skills/find-journal/references/journal_profiles/CVIR.md +30 -0
  202. package/skills/find-journal/references/journal_profiles/Chest.md +39 -0
  203. package/skills/find-journal/references/journal_profiles/Clinical_Radiology.md +30 -0
  204. package/skills/find-journal/references/journal_profiles/Clinical_and_Molecular_Hepatology.md +32 -0
  205. package/skills/find-journal/references/journal_profiles/Diabetes_Metabolism_Journal.md +36 -0
  206. package/skills/find-journal/references/journal_profiles/Diagnostic_and_Interventional_Radiology.md +32 -0
  207. package/skills/find-journal/references/journal_profiles/Endocrinology_and_Metabolism.md +37 -0
  208. package/skills/find-journal/references/journal_profiles/European_Journal_of_Preventive_Cardiology.md +39 -0
  209. package/skills/find-journal/references/journal_profiles/European_Radiology.md +29 -0
  210. package/skills/find-journal/references/journal_profiles/Hepatology_Communications.md +40 -0
  211. package/skills/find-journal/references/journal_profiles/Hepatology_International.md +37 -0
  212. package/skills/find-journal/references/journal_profiles/IEEE_JBHI.md +28 -0
  213. package/skills/find-journal/references/journal_profiles/IEEE_TMI.md +28 -0
  214. package/skills/find-journal/references/journal_profiles/INSI.md +29 -0
  215. package/skills/find-journal/references/journal_profiles/Investigative_Radiology.md +25 -0
  216. package/skills/find-journal/references/journal_profiles/JACC_Advances.md +41 -0
  217. package/skills/find-journal/references/journal_profiles/JACC_Asia.md +30 -0
  218. package/skills/find-journal/references/journal_profiles/JACR.md +28 -0
  219. package/skills/find-journal/references/journal_profiles/JAMA.md +40 -0
  220. package/skills/find-journal/references/journal_profiles/JAMA_Network_Open.md +30 -0
  221. package/skills/find-journal/references/journal_profiles/JCSM.md +39 -0
  222. package/skills/find-journal/references/journal_profiles/JKMS.md +32 -0
  223. package/skills/find-journal/references/journal_profiles/JMIR.md +29 -0
  224. package/skills/find-journal/references/journal_profiles/JMIR_Medical_Education.md +29 -0
  225. package/skills/find-journal/references/journal_profiles/JNIS.md +35 -0
  226. package/skills/find-journal/references/journal_profiles/JVIR.md +31 -0
  227. package/skills/find-journal/references/journal_profiles/Journal_of_Biomedical_Informatics.md +29 -0
  228. package/skills/find-journal/references/journal_profiles/Journal_of_Clinical_Endocrinology_and_Metabolism.md +40 -0
  229. package/skills/find-journal/references/journal_profiles/Journal_of_Magnetic_Resonance_Imaging.md +30 -0
  230. package/skills/find-journal/references/journal_profiles/Journal_of_Nuclear_Medicine.md +31 -0
  231. package/skills/find-journal/references/journal_profiles/Journal_of_Stroke.md +32 -0
  232. package/skills/find-journal/references/journal_profiles/KJR.md +38 -0
  233. package/skills/find-journal/references/journal_profiles/Korean_Circulation_Journal.md +38 -0
  234. package/skills/find-journal/references/journal_profiles/Korean_Journal_of_Internal_Medicine.md +36 -0
  235. package/skills/find-journal/references/journal_profiles/Lancet_Diabetes_and_Endocrinology.md +40 -0
  236. package/skills/find-journal/references/journal_profiles/Lancet_Gastroenterology_and_Hepatology.md +49 -0
  237. package/skills/find-journal/references/journal_profiles/Lancet_Infectious_Diseases.md +38 -0
  238. package/skills/find-journal/references/journal_profiles/Lancet_Neurology.md +39 -0
  239. package/skills/find-journal/references/journal_profiles/Lancet_Oncology.md +40 -0
  240. package/skills/find-journal/references/journal_profiles/Lancet_Psychiatry.md +38 -0
  241. package/skills/find-journal/references/journal_profiles/Lancet_Public_Health.md +30 -0
  242. package/skills/find-journal/references/journal_profiles/Lancet_Respiratory_Medicine.md +39 -0
  243. package/skills/find-journal/references/journal_profiles/Liver_International.md +33 -0
  244. package/skills/find-journal/references/journal_profiles/Medical_Image_Analysis.md +28 -0
  245. package/skills/find-journal/references/journal_profiles/NEJM.md +33 -0
  246. package/skills/find-journal/references/journal_profiles/Nature_Machine_Intelligence.md +31 -0
  247. package/skills/find-journal/references/journal_profiles/Nature_Medicine.md +39 -0
  248. package/skills/find-journal/references/journal_profiles/Neuroradiology.md +31 -0
  249. package/skills/find-journal/references/journal_profiles/Nutrition_Metabolism_and_Cardiovascular_Diseases.md +39 -0
  250. package/skills/find-journal/references/journal_profiles/PLOS_Medicine.md +32 -0
  251. package/skills/find-journal/references/journal_profiles/RYAI.md +28 -0
  252. package/skills/find-journal/references/journal_profiles/Radiology.md +29 -0
  253. package/skills/find-journal/references/journal_profiles/Skeletal_Radiology.md +31 -0
  254. package/skills/find-journal/references/journal_profiles/Stroke.md +37 -0
  255. package/skills/find-journal/references/journal_profiles/The_BMJ.md +31 -0
  256. package/skills/find-journal/references/journal_profiles/The_Lancet.md +31 -0
  257. package/skills/find-journal/references/journal_profiles/The_Lancet_Digital_Health.md +29 -0
  258. package/skills/find-journal/references/journal_profiles/World_Journal_of_Hepatology.md +53 -0
  259. package/skills/find-journal/references/journal_profiles/npj_Digital_Medicine.md +29 -0
  260. package/skills/find-journal/skill.yml +34 -0
  261. package/skills/fulltext-retrieval/SKILL.md +174 -0
  262. package/skills/fulltext-retrieval/fetch_oa.py +433 -0
  263. package/skills/fulltext-retrieval/pdf_to_md.py +160 -0
  264. package/skills/fulltext-retrieval/skill.yml +41 -0
  265. package/skills/generate-codebook/SKILL.md +155 -0
  266. package/skills/generate-codebook/references/codebook_schema.md +76 -0
  267. package/skills/generate-codebook/scripts/generate_codebook.py +278 -0
  268. package/skills/generate-codebook/skill.yml +35 -0
  269. package/skills/generate-codebook/tests/test_generate_codebook.sh +76 -0
  270. package/skills/grant-builder/SKILL.md +251 -0
  271. package/skills/grant-builder/skill.yml +34 -0
  272. package/skills/humanize/SKILL.md +251 -0
  273. package/skills/humanize/references/ai_patterns.md +571 -0
  274. package/skills/humanize/skill.yml +33 -0
  275. package/skills/intake-project/SKILL.md +264 -0
  276. package/skills/intake-project/skill.yml +34 -0
  277. package/skills/lit-sync/SKILL.md +448 -0
  278. package/skills/lit-sync/references/locale/ko/note_templates.md +110 -0
  279. package/skills/lit-sync/skill.yml +52 -0
  280. package/skills/lit-sync/tests/test_poll_logic.sh +92 -0
  281. package/skills/ma-scout/SKILL.md +640 -0
  282. package/skills/ma-scout/references/project_readme_template.md +95 -0
  283. package/skills/ma-scout/references/project_readme_template_ko.md +82 -0
  284. package/skills/ma-scout/skill.yml +33 -0
  285. package/skills/make-figures/SKILL.md +957 -0
  286. package/skills/make-figures/references/critic_rubrics/data_plot.md +166 -0
  287. package/skills/make-figures/references/critic_rubrics/flow_diagram.md +169 -0
  288. package/skills/make-figures/references/design_principles.md +181 -0
  289. package/skills/make-figures/references/exemplar_diagrams/README.md +65 -0
  290. package/skills/make-figures/references/exemplar_diagrams/consort/README.md +15 -0
  291. package/skills/make-figures/references/exemplar_diagrams/consort/template_input.yaml +37 -0
  292. package/skills/make-figures/references/exemplar_diagrams/consort/template_output.pdf +0 -0
  293. package/skills/make-figures/references/exemplar_diagrams/consort/template_output.png +0 -0
  294. package/skills/make-figures/references/exemplar_diagrams/consort/template_output_600.png +0 -0
  295. package/skills/make-figures/references/exemplar_diagrams/other/other_02.meta.yaml +4 -0
  296. package/skills/make-figures/references/exemplar_diagrams/other/other_02.png +0 -0
  297. package/skills/make-figures/references/exemplar_diagrams/other/other_02_why.md +13 -0
  298. package/skills/make-figures/references/exemplar_diagrams/pipeline/README.md +15 -0
  299. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_01.meta.yaml +4 -0
  300. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_01.png +0 -0
  301. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_01_why.md +13 -0
  302. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_03.meta.yaml +4 -0
  303. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_03.png +0 -0
  304. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_03_why.md +13 -0
  305. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_04.meta.yaml +4 -0
  306. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_04.png +0 -0
  307. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_04_why.md +13 -0
  308. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_05.meta.yaml +4 -0
  309. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_05.png +0 -0
  310. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_05_why.md +13 -0
  311. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_06.meta.yaml +4 -0
  312. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_06.png +0 -0
  313. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_06_why.md +13 -0
  314. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_07.meta.yaml +4 -0
  315. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_07.png +0 -0
  316. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_07_why.md +13 -0
  317. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_08.meta.yaml +4 -0
  318. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_08.png +0 -0
  319. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_08_why.md +13 -0
  320. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_09.meta.yaml +4 -0
  321. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_09.png +0 -0
  322. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_09_why.md +13 -0
  323. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_10.meta.yaml +4 -0
  324. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_10.png +0 -0
  325. package/skills/make-figures/references/exemplar_diagrams/pipeline/pipeline_10_why.md +13 -0
  326. package/skills/make-figures/references/exemplar_diagrams/prisma/README.md +15 -0
  327. package/skills/make-figures/references/exemplar_diagrams/prisma/template_input.yaml +47 -0
  328. package/skills/make-figures/references/exemplar_diagrams/prisma/template_output.pdf +0 -0
  329. package/skills/make-figures/references/exemplar_diagrams/prisma/template_output.png +0 -0
  330. package/skills/make-figures/references/exemplar_diagrams/prisma/template_output_600.png +0 -0
  331. package/skills/make-figures/references/exemplar_diagrams/stard/README.md +15 -0
  332. package/skills/make-figures/references/exemplar_diagrams/stard/template_input.yaml +40 -0
  333. package/skills/make-figures/references/exemplar_diagrams/stard/template_output.pdf +0 -0
  334. package/skills/make-figures/references/exemplar_diagrams/stard/template_output.png +0 -0
  335. package/skills/make-figures/references/exemplar_diagrams/stard/template_output_600.png +0 -0
  336. package/skills/make-figures/references/exemplar_diagrams/strobe/template_input.yaml +43 -0
  337. package/skills/make-figures/references/exemplar_diagrams/strobe/template_input_pptx.yaml +43 -0
  338. package/skills/make-figures/references/exemplar_diagrams/strobe/template_output.pdf +0 -0
  339. package/skills/make-figures/references/exemplar_diagrams/strobe/template_output.png +0 -0
  340. package/skills/make-figures/references/exemplar_diagrams/strobe/template_output.pptx +0 -0
  341. package/skills/make-figures/references/exemplar_diagrams/strobe/template_output_600.png +0 -0
  342. package/skills/make-figures/references/figure_specs.md +291 -0
  343. package/skills/make-figures/references/flow_diagram_lessons.md +164 -0
  344. package/skills/make-figures/references/jacc_central_illustration_principles.md +91 -0
  345. package/skills/make-figures/references/medical_illustration_sources.md +98 -0
  346. package/skills/make-figures/references/pipeline_concepts_medical_ai.md +240 -0
  347. package/skills/make-figures/references/reporting_guideline_figure_map.md +104 -0
  348. package/skills/make-figures/references/visual_abstract_templates/european_radiology.pptx +0 -0
  349. package/skills/make-figures/references/visual_abstract_templates/jacc_central_illustration.pptx +0 -0
  350. package/skills/make-figures/references/visual_abstract_templates/medsci_default.pptx +0 -0
  351. package/skills/make-figures/references/visual_abstract_templates/template_guide.md +114 -0
  352. package/skills/make-figures/scripts/build_jacc_template.py +77 -0
  353. package/skills/make-figures/scripts/build_prisma2020_template.py +371 -0
  354. package/skills/make-figures/scripts/build_strobe_template.py +351 -0
  355. package/skills/make-figures/scripts/critic_figure.py +264 -0
  356. package/skills/make-figures/scripts/derive_figure_legend_counts.py +138 -0
  357. package/skills/make-figures/scripts/extract_exemplar_from_pdf.py +186 -0
  358. package/skills/make-figures/scripts/fetch_official_templates.sh +88 -0
  359. package/skills/make-figures/scripts/fill_prisma_template.py +142 -0
  360. package/skills/make-figures/scripts/generate_flow_diagram.R +133 -0
  361. package/skills/make-figures/scripts/generate_image.py +99 -0
  362. package/skills/make-figures/scripts/generate_visual_abstract.py +438 -0
  363. package/skills/make-figures/scripts/validate_pptx_mac_compat.py +233 -0
  364. package/skills/make-figures/skill.yml +52 -0
  365. package/skills/make-figures/templates/official/NOTES.md +62 -0
  366. package/skills/make-figures/templates/official/consort2010/CONSORT_2025_editable_checklist.docx +0 -0
  367. package/skills/make-figures/templates/official/consort2010/CONSORT_2025_flow_diagram.docx +0 -0
  368. package/skills/make-figures/templates/official/prisma2020/PRISMA_2020_flow_new_v1.pptx +0 -0
  369. package/skills/make-figures/templates/official/prisma2020/PRISMA_2020_flow_new_v2.pptx +0 -0
  370. package/skills/make-figures/templates/official/prisma2020/PRISMA_2020_flow_updated_v2.pptx +0 -0
  371. package/skills/make-figures/templates/official/spirit2013/SPIRIT_2025_editable_checklist.docx +0 -0
  372. package/skills/make-figures/templates/official/spirit2013/SPIRIT_2025_participant_timeline.docx +0 -0
  373. package/skills/make-figures/templates/official/stard2015/STARD_2015_checklist.docx +0 -0
  374. package/skills/make-figures/templates/official/stard2015/STARD_2015_flow_diagram.pdf +0 -0
  375. package/skills/make-figures/tests/fixtures/figure1_flow.yaml +8 -0
  376. package/skills/make-figures/tests/fixtures/manuscript_ok.md +9 -0
  377. package/skills/make-figures/tests/fixtures/manuscript_stale.md +4 -0
  378. package/skills/make-figures/tests/test_legend_reconcile.sh +36 -0
  379. package/skills/manage-project/SKILL.md +358 -0
  380. package/skills/manage-project/references/pre_submission_checklist.md +53 -0
  381. package/skills/manage-project/references/project_state_template.json +37 -0
  382. package/skills/manage-project/references/scaffold_templates.md +118 -0
  383. package/skills/manage-project/references/status_output_format.md +44 -0
  384. package/skills/manage-project/references/timeline_example.md +20 -0
  385. package/skills/manage-project/skill.yml +36 -0
  386. package/skills/manage-project/templates/SSOT.yaml.template +41 -0
  387. package/skills/manage-refs/LICENSE.zotero-mcp +21 -0
  388. package/skills/manage-refs/NOTICE.md +29 -0
  389. package/skills/manage-refs/SKILL.md +289 -0
  390. package/skills/manage-refs/citation_styles/README.md +40 -0
  391. package/skills/manage-refs/citation_styles/american-journal-of-roentgenology.csl +211 -0
  392. package/skills/manage-refs/citation_styles/cardiovascular-and-interventional-radiology.csl +19 -0
  393. package/skills/manage-refs/citation_styles/european-radiology.csl +19 -0
  394. package/skills/manage-refs/citation_styles/journal-of-cachexia-sarcopenia-and-muscle.csl +150 -0
  395. package/skills/manage-refs/citation_styles/journal-of-korean-medical-science-strict.csl +533 -0
  396. package/skills/manage-refs/citation_styles/journal-of-korean-medical-science.csl +16 -0
  397. package/skills/manage-refs/citation_styles/korean-journal-of-radiology.csl +155 -0
  398. package/skills/manage-refs/citation_styles/nature.csl +189 -0
  399. package/skills/manage-refs/citation_styles/nlm-citation-sequence.csl +535 -0
  400. package/skills/manage-refs/citation_styles/radiology.csl +228 -0
  401. package/skills/manage-refs/citation_styles/springer-basic-brackets.csl +187 -0
  402. package/skills/manage-refs/citation_styles/springer-vancouver-brackets.csl +276 -0
  403. package/skills/manage-refs/citation_styles/vancouver-superscript.csl +536 -0
  404. package/skills/manage-refs/citation_styles/vancouver.csl +535 -0
  405. package/skills/manage-refs/references/REFERENCE_STYLE_SPECS.md +59 -0
  406. package/skills/manage-refs/references/check_xref_symptoms.md +35 -0
  407. package/skills/manage-refs/scripts/_vendor_citation_writer.py +600 -0
  408. package/skills/manage-refs/scripts/check_citation_keys.py +112 -0
  409. package/skills/manage-refs/scripts/check_csl_render.py +102 -0
  410. package/skills/manage-refs/scripts/check_xref.py +633 -0
  411. package/skills/manage-refs/scripts/fill_journal_abbrev.py +104 -0
  412. package/skills/manage-refs/scripts/inject_zotero_cwyw.py +133 -0
  413. package/skills/manage-refs/scripts/md_marker_convert.py +193 -0
  414. package/skills/manage-refs/scripts/pre_submission_gate.sh +238 -0
  415. package/skills/manage-refs/scripts/render_pandoc.sh +88 -0
  416. package/skills/manage-refs/skill.yml +70 -0
  417. package/skills/manage-refs/tests/fixtures/pre_submission_gate/README.md +32 -0
  418. package/skills/manage-refs/tests/fixtures/pre_submission_gate/manuscript.md +10 -0
  419. package/skills/manage-refs/tests/fixtures/pre_submission_gate/refs.bib +34 -0
  420. package/skills/manage-refs/tests/fixtures/pre_submission_gate/run.sh +117 -0
  421. package/skills/manage-refs/tests/test_vN_docx_check.sh +145 -0
  422. package/skills/meta-analysis/SKILL.md +739 -0
  423. package/skills/meta-analysis/references/LICENSES.md +21 -0
  424. package/skills/meta-analysis/references/PROSPERO_template.md +221 -0
  425. package/skills/meta-analysis/references/ai_pre_screening_template.py +245 -0
  426. package/skills/meta-analysis/references/checklists/JBI_Case_Series.md +45 -0
  427. package/skills/meta-analysis/references/checklists/NOS.md +88 -0
  428. package/skills/meta-analysis/references/checklists/PRISMA_DTA.md +36 -0
  429. package/skills/meta-analysis/references/checklists/PROBAST.md +75 -0
  430. package/skills/meta-analysis/references/checklists/QUADAS2.md +77 -0
  431. package/skills/meta-analysis/references/checklists/ROBINS_I.md +87 -0
  432. package/skills/meta-analysis/references/checklists/RoB2.md +79 -0
  433. package/skills/meta-analysis/references/data_integrity_checklist.md +57 -0
  434. package/skills/meta-analysis/references/icmje_coi_guide.md +181 -0
  435. package/skills/meta-analysis/references/phase10_recovery.md +136 -0
  436. package/skills/meta-analysis/references/phase4_km_composite.md +58 -0
  437. package/skills/meta-analysis/references/phase6_statistical_synthesis.md +148 -0
  438. package/skills/meta-analysis/references/phase9_circulation.md +84 -0
  439. package/skills/meta-analysis/references/post_submission_release_ops.md +41 -0
  440. package/skills/meta-analysis/references/r_templates.md +132 -0
  441. package/skills/meta-analysis/references/review_orchestration.md +40 -0
  442. package/skills/meta-analysis/references/submission_package_drift.md +71 -0
  443. package/skills/meta-analysis/scripts/check_pool_consistency.py +201 -0
  444. package/skills/meta-analysis/scripts/cohort_overlap_check.py +242 -0
  445. package/skills/meta-analysis/scripts/dta_extraction_qc.py +137 -0
  446. package/skills/meta-analysis/scripts/screening_reconcile.py +160 -0
  447. package/skills/meta-analysis/skill.yml +47 -0
  448. package/skills/meta-analysis/templates/FINAL_POOL_LOCK.yaml.template +70 -0
  449. package/skills/meta-analysis/templates/extraction_form_v2.md +129 -0
  450. package/skills/meta-analysis/templates/supplementary_8file_checklist.md +94 -0
  451. package/skills/meta-analysis/tests/test_pool_consistency.sh +123 -0
  452. package/skills/orchestrate/SKILL.md +501 -0
  453. package/skills/orchestrate/references/dialogue_nodes.md +196 -0
  454. package/skills/orchestrate/references/report_template.md +109 -0
  455. package/skills/orchestrate/references/report_template_ko.md +88 -0
  456. package/skills/orchestrate/skill.yml +44 -0
  457. package/skills/peer-review/SKILL.md +381 -0
  458. package/skills/peer-review/references/aczel_2021_reviewer2_patterns.md +88 -0
  459. package/skills/peer-review/references/domain-probes/ai_overclaiming.md +47 -0
  460. package/skills/peer-review/references/domain-probes/narrative_review.md +44 -0
  461. package/skills/peer-review/references/domain-probes/observational_confounding.md +48 -0
  462. package/skills/peer-review/references/domain-probes/radiomics.md +38 -0
  463. package/skills/peer-review/references/domain-probes/sr_ma.md +87 -0
  464. package/skills/peer-review/references/domain-probes/survival_prognostic.md +68 -0
  465. package/skills/peer-review/references/exemplar_reviews/README.md +43 -0
  466. package/skills/peer-review/references/exemplar_reviews/ai_overclaiming.md +47 -0
  467. package/skills/peer-review/references/exemplar_reviews/calibration_missing.md +44 -0
  468. package/skills/peer-review/references/exemplar_reviews/data_leakage.md +48 -0
  469. package/skills/peer-review/references/exemplar_reviews/reference_standard_validity.md +45 -0
  470. package/skills/peer-review/references/narrative_review_audit.md +67 -0
  471. package/skills/peer-review/references/reviewer_calibration/README.md +34 -0
  472. package/skills/peer-review/references/reviewer_calibration/compliance_floor.md +52 -0
  473. package/skills/peer-review/references/reviewer_profiles/AJR.md +82 -0
  474. package/skills/peer-review/references/reviewer_profiles/EURE.md +64 -0
  475. package/skills/peer-review/references/reviewer_profiles/INSI.md +57 -0
  476. package/skills/peer-review/references/reviewer_profiles/KJR.md +100 -0
  477. package/skills/peer-review/references/reviewer_profiles/README.md +32 -0
  478. package/skills/peer-review/references/reviewer_profiles/RYAI.md +86 -0
  479. package/skills/peer-review/skill.yml +39 -0
  480. package/skills/present-paper/SKILL.md +675 -0
  481. package/skills/present-paper/references/critic_rubrics/slide.md +155 -0
  482. package/skills/present-paper/references/generate_pptx_templates.py +604 -0
  483. package/skills/present-paper/references/medical_presentation_templates.md +277 -0
  484. package/skills/present-paper/references/slide_design_principles.md +202 -0
  485. package/skills/present-paper/references/slide_visual_styles/nature_lancet.md +168 -0
  486. package/skills/present-paper/references/workflow-checklist.md +109 -0
  487. package/skills/present-paper/scripts/extract_pdf_figures.py +243 -0
  488. package/skills/present-paper/scripts/inject_pronunciation_notes.py +178 -0
  489. package/skills/present-paper/scripts/inject_speaker_notes.py +133 -0
  490. package/skills/present-paper/scripts/strip_notes_for_sharing.py +140 -0
  491. package/skills/present-paper/scripts/trim_caption.py +271 -0
  492. package/skills/present-paper/skill.yml +41 -0
  493. package/skills/present-paper/templates/build_pptx_nature_lancet.py +688 -0
  494. package/skills/publish-skill/SKILL.md +370 -0
  495. package/skills/publish-skill/references/license-compatibility-matrix.md +132 -0
  496. package/skills/publish-skill/references/pii-patterns.md +130 -0
  497. package/skills/publish-skill/scripts/audit_skill.sh +278 -0
  498. package/skills/publish-skill/skill.yml +35 -0
  499. package/skills/render-pdf-doc/SKILL.md +146 -0
  500. package/skills/render-pdf-doc/references/known_pitfalls.md +53 -0
  501. package/skills/render-pdf-doc/references/pandoc_korean_cheatsheet.md +77 -0
  502. package/skills/render-pdf-doc/scripts/check_deps.sh +42 -0
  503. package/skills/render-pdf-doc/scripts/infer_colwidths.py +164 -0
  504. package/skills/render-pdf-doc/scripts/render_pdf.sh +98 -0
  505. package/skills/render-pdf-doc/skill.yml +57 -0
  506. package/skills/render-pdf-doc/templates/anchor-doc.md +27 -0
  507. package/skills/render-pdf-doc/templates/anchor-doc_ko.md +25 -0
  508. package/skills/render-pdf-doc/templates/briefing-handout.md +33 -0
  509. package/skills/render-pdf-doc/templates/briefing-handout_ko.md +31 -0
  510. package/skills/render-pdf-doc/templates/proposal-cover.md +33 -0
  511. package/skills/render-pdf-doc/templates/proposal-cover_ko.md +31 -0
  512. package/skills/render-pdf-doc/templates/reference-table.md +22 -0
  513. package/skills/render-pdf-doc/templates/reference-table_ko.md +20 -0
  514. package/skills/replicate-study/SKILL.md +150 -0
  515. package/skills/replicate-study/references/harmonization_3country.csv +47 -0
  516. package/skills/replicate-study/references/harmonization_knhanes_nhanes.csv +68 -0
  517. package/skills/replicate-study/references/methodology_extraction_template.md +134 -0
  518. package/skills/replicate-study/skill.yml +37 -0
  519. package/skills/review-paper/SKILL.md +104 -0
  520. package/skills/review-paper/references/macro_skeleton.md +6 -0
  521. package/skills/review-paper/skill.yml +25 -0
  522. package/skills/revise/SKILL.md +515 -0
  523. package/skills/revise/references/r2r_voice.md +346 -0
  524. package/skills/revise/skill.yml +43 -0
  525. package/skills/search-lit/SKILL.md +443 -0
  526. package/skills/search-lit/references/parse_pubmed.py +326 -0
  527. package/skills/search-lit/references/pubmed_eutils.sh +111 -0
  528. package/skills/search-lit/skill.yml +46 -0
  529. package/skills/self-review/SKILL.md +1045 -0
  530. package/skills/self-review/references/domain-probes/ai_overclaiming.md +47 -0
  531. package/skills/self-review/references/domain-probes/narrative_review.md +44 -0
  532. package/skills/self-review/references/domain-probes/observational_confounding.md +48 -0
  533. package/skills/self-review/references/domain-probes/radiomics.md +38 -0
  534. package/skills/self-review/references/domain-probes/sr_ma.md +87 -0
  535. package/skills/self-review/references/domain-probes/survival_prognostic.md +68 -0
  536. package/skills/self-review/references/exemplar_findings/README.md +43 -0
  537. package/skills/self-review/references/exemplar_findings/cohort_arithmetic_mismatch.md +35 -0
  538. package/skills/self-review/references/exemplar_findings/estimand_drift_posthoc_primary.md +39 -0
  539. package/skills/self-review/references/exemplar_findings/scope_overreach_cross_sectional.md +35 -0
  540. package/skills/self-review/references/exemplar_findings/unadjusted_confounder.md +36 -0
  541. package/skills/self-review/references/panel_review_template.md +177 -0
  542. package/skills/self-review/scripts/check_artifact_coverage.py +301 -0
  543. package/skills/self-review/scripts/check_claim_artifact.py +248 -0
  544. package/skills/self-review/scripts/check_classical_style.py +185 -0
  545. package/skills/self-review/scripts/check_cohort_arithmetic.py +481 -0
  546. package/skills/self-review/scripts/check_confounding_completeness.py +287 -0
  547. package/skills/self-review/scripts/check_panel_diversity.py +336 -0
  548. package/skills/self-review/scripts/check_reference_adequacy.py +392 -0
  549. package/skills/self-review/scripts/check_reviewer_team_consistency.py +412 -0
  550. package/skills/self-review/scripts/check_scope_coherence.py +177 -0
  551. package/skills/self-review/skill.yml +47 -0
  552. package/skills/self-review/tests/fixtures/claim_manuscript.md +17 -0
  553. package/skills/self-review/tests/fixtures/claim_prereg.md +6 -0
  554. package/skills/self-review/tests/fixtures/cohort_bad.md +21 -0
  555. package/skills/self-review/tests/fixtures/cohort_clean.md +21 -0
  556. package/skills/self-review/tests/fixtures/cohort_partition.csv +5 -0
  557. package/skills/self-review/tests/fixtures/coverage_analysis/31_delong_nested_added_value.csv +3 -0
  558. package/skills/self-review/tests/fixtures/coverage_analysis/table1_demographics.csv +3 -0
  559. package/skills/self-review/tests/fixtures/coverage_clean.md +13 -0
  560. package/skills/self-review/tests/fixtures/coverage_manuscript.md +11 -0
  561. package/skills/self-review/tests/fixtures/panel_collapse.json +27 -0
  562. package/skills/self-review/tests/fixtures/panel_good.json +32 -0
  563. package/skills/self-review/tests/fixtures/panel_monoculture.json +32 -0
  564. package/skills/self-review/tests/fixtures/refadeq_letter.md +13 -0
  565. package/skills/self-review/tests/fixtures/refadeq_original_fixed.md +42 -0
  566. package/skills/self-review/tests/fixtures/refadeq_original_uncited.md +40 -0
  567. package/skills/self-review/tests/fixtures/scope_bad.md +9 -0
  568. package/skills/self-review/tests/fixtures/scope_clean.md +8 -0
  569. package/skills/self-review/tests/fixtures/scope_surrogate.md +8 -0
  570. package/skills/self-review/tests/fixtures/style_bad.md +13 -0
  571. package/skills/self-review/tests/fixtures/style_clean.md +11 -0
  572. package/skills/self-review/tests/fixtures/table1_by_exposure.csv +11 -0
  573. package/skills/self-review/tests/test_artifact_coverage.sh +44 -0
  574. package/skills/self-review/tests/test_claim_artifact.sh +50 -0
  575. package/skills/self-review/tests/test_classical_style.sh +44 -0
  576. package/skills/self-review/tests/test_cohort_arithmetic.sh +49 -0
  577. package/skills/self-review/tests/test_confounding_completeness.sh +66 -0
  578. package/skills/self-review/tests/test_panel_diversity.sh +55 -0
  579. package/skills/self-review/tests/test_panel_mode.sh +69 -0
  580. package/skills/self-review/tests/test_reference_adequacy.sh +68 -0
  581. package/skills/self-review/tests/test_reviewer_team_consistency.sh +138 -0
  582. package/skills/self-review/tests/test_scope_coherence.sh +46 -0
  583. package/skills/setup-medsci/SKILL.md +110 -0
  584. package/skills/setup-medsci/references/setup-checklist.md +51 -0
  585. package/skills/setup-medsci/skill.yml +30 -0
  586. package/skills/sync-submission/SKILL.md +382 -0
  587. package/skills/sync-submission/scripts/author_registry_example.yaml +36 -0
  588. package/skills/sync-submission/scripts/blind_sweep.py +203 -0
  589. package/skills/sync-submission/scripts/check_asset_anonymization.py +300 -0
  590. package/skills/sync-submission/scripts/check_cross_artifact_stale.py +211 -0
  591. package/skills/sync-submission/scripts/cover_letter_drift_check.py +451 -0
  592. package/skills/sync-submission/scripts/cross_document_n_check.py +486 -0
  593. package/skills/sync-submission/scripts/detect_copy_divergence.py +136 -0
  594. package/skills/sync-submission/scripts/preflight_gate.py +458 -0
  595. package/skills/sync-submission/scripts/scope_drift_check.py +362 -0
  596. package/skills/sync-submission/scripts/sync_submission.py +169 -0
  597. package/skills/sync-submission/skill.yml +43 -0
  598. package/skills/sync-submission/tests/fixtures/copy_ok.md +5 -0
  599. package/skills/sync-submission/tests/fixtures/copy_stale.md +5 -0
  600. package/skills/sync-submission/tests/fixtures/ssot.md +5 -0
  601. package/skills/sync-submission/tests/test_asset_anonymization.sh +99 -0
  602. package/skills/sync-submission/tests/test_copy_divergence.sh +44 -0
  603. package/skills/sync-submission/tests/test_cross_artifact_stale.sh +80 -0
  604. package/skills/sync-submission/tests/test_cross_document_n.sh +132 -0
  605. package/skills/sync-submission/tests/test_preflight_gate.sh +112 -0
  606. package/skills/sync-submission/tests/test_scope_drift.sh +122 -0
  607. package/skills/sync-submission/tests/test_vN_docx_assertion.sh +51 -0
  608. package/skills/verify-refs/SKILL.md +177 -0
  609. package/skills/verify-refs/references/manual_checkpoint_guide.md +100 -0
  610. package/skills/verify-refs/scripts/verify_cli.sh +62 -0
  611. package/skills/verify-refs/scripts/verify_refs.py +782 -0
  612. package/skills/verify-refs/skill.yml +44 -0
  613. package/skills/verify-refs/tests/fixtures/pagination_placeholder.bib +17 -0
  614. package/skills/verify-refs/tests/test_pagination_placeholder.sh +42 -0
  615. package/skills/version-dataset/SKILL.md +143 -0
  616. package/skills/version-dataset/references/manifest_schema.md +72 -0
  617. package/skills/version-dataset/scripts/version_dataset.py +242 -0
  618. package/skills/version-dataset/skill.yml +35 -0
  619. package/skills/version-dataset/tests/test_version_dataset.sh +52 -0
  620. package/skills/write-paper/SKILL.md +1148 -0
  621. package/skills/write-paper/references/exemplar_methods/README.md +38 -0
  622. package/skills/write-paper/references/exemplar_methods/ai_validation_tripod_claim.md +47 -0
  623. package/skills/write-paper/references/exemplar_methods/diagnostic_accuracy_stard.md +50 -0
  624. package/skills/write-paper/references/exemplar_methods/observational_cohort_strobe.md +43 -0
  625. package/skills/write-paper/references/journal_profiles/AJNR.md +185 -0
  626. package/skills/write-paper/references/journal_profiles/AJR.md +149 -0
  627. package/skills/write-paper/references/journal_profiles/Abdominal_Radiology.md +139 -0
  628. package/skills/write-paper/references/journal_profiles/Academic_Radiology.md +90 -0
  629. package/skills/write-paper/references/journal_profiles/Annals_of_Internal_Medicine.md +150 -0
  630. package/skills/write-paper/references/journal_profiles/Artificial_Intelligence_in_Medicine.md +82 -0
  631. package/skills/write-paper/references/journal_profiles/British_Journal_of_Radiology.md +161 -0
  632. package/skills/write-paper/references/journal_profiles/CVIR.md +157 -0
  633. package/skills/write-paper/references/journal_profiles/Chest.md +270 -0
  634. package/skills/write-paper/references/journal_profiles/Clinical_Radiology.md +160 -0
  635. package/skills/write-paper/references/journal_profiles/Clinical_and_Molecular_Hepatology.md +147 -0
  636. package/skills/write-paper/references/journal_profiles/Diabetes_Metabolism_Journal.md +163 -0
  637. package/skills/write-paper/references/journal_profiles/Diagnostic_and_Interventional_Radiology.md +216 -0
  638. package/skills/write-paper/references/journal_profiles/Endocrinology_and_Metabolism.md +167 -0
  639. package/skills/write-paper/references/journal_profiles/European_Journal_of_Preventive_Cardiology.md +192 -0
  640. package/skills/write-paper/references/journal_profiles/European_Radiology.md +159 -0
  641. package/skills/write-paper/references/journal_profiles/Hepatology_Communications.md +110 -0
  642. package/skills/write-paper/references/journal_profiles/Hepatology_International.md +106 -0
  643. package/skills/write-paper/references/journal_profiles/IEEE_TMI.md +180 -0
  644. package/skills/write-paper/references/journal_profiles/INSI.md +163 -0
  645. package/skills/write-paper/references/journal_profiles/Investigative_Radiology.md +86 -0
  646. package/skills/write-paper/references/journal_profiles/JACC_Advances.md +197 -0
  647. package/skills/write-paper/references/journal_profiles/JACC_Asia.md +168 -0
  648. package/skills/write-paper/references/journal_profiles/JACR.md +87 -0
  649. package/skills/write-paper/references/journal_profiles/JAMA.md +188 -0
  650. package/skills/write-paper/references/journal_profiles/JAMA_Network_Open.md +170 -0
  651. package/skills/write-paper/references/journal_profiles/JCSM.md +266 -0
  652. package/skills/write-paper/references/journal_profiles/JKMS.md +201 -0
  653. package/skills/write-paper/references/journal_profiles/JMIR.md +88 -0
  654. package/skills/write-paper/references/journal_profiles/JMIR_Medical_Education.md +86 -0
  655. package/skills/write-paper/references/journal_profiles/JNIS.md +227 -0
  656. package/skills/write-paper/references/journal_profiles/JVIR.md +158 -0
  657. package/skills/write-paper/references/journal_profiles/Journal_of_Clinical_Endocrinology_and_Metabolism.md +191 -0
  658. package/skills/write-paper/references/journal_profiles/Journal_of_Stroke.md +176 -0
  659. package/skills/write-paper/references/journal_profiles/KJR.md +185 -0
  660. package/skills/write-paper/references/journal_profiles/Korean_Circulation_Journal.md +184 -0
  661. package/skills/write-paper/references/journal_profiles/Korean_Journal_of_Internal_Medicine.md +178 -0
  662. package/skills/write-paper/references/journal_profiles/Lancet_Gastroenterology_and_Hepatology.md +127 -0
  663. package/skills/write-paper/references/journal_profiles/Liver_International.md +165 -0
  664. package/skills/write-paper/references/journal_profiles/Medical_Image_Analysis.md +147 -0
  665. package/skills/write-paper/references/journal_profiles/NEJM.md +147 -0
  666. package/skills/write-paper/references/journal_profiles/Nature_Medicine.md +181 -0
  667. package/skills/write-paper/references/journal_profiles/Neuroradiology.md +151 -0
  668. package/skills/write-paper/references/journal_profiles/Nutrition_Metabolism_and_Cardiovascular_Diseases.md +184 -0
  669. package/skills/write-paper/references/journal_profiles/PLOS_Medicine.md +166 -0
  670. package/skills/write-paper/references/journal_profiles/RYAI.md +124 -0
  671. package/skills/write-paper/references/journal_profiles/Radiology.md +173 -0
  672. package/skills/write-paper/references/journal_profiles/Skeletal_Radiology.md +135 -0
  673. package/skills/write-paper/references/journal_profiles/Stroke.md +210 -0
  674. package/skills/write-paper/references/journal_profiles/The_BMJ.md +121 -0
  675. package/skills/write-paper/references/journal_profiles/The_Lancet.md +112 -0
  676. package/skills/write-paper/references/journal_profiles/The_Lancet_Digital_Health.md +104 -0
  677. package/skills/write-paper/references/journal_profiles/World_Journal_of_Hepatology.md +106 -0
  678. package/skills/write-paper/references/journal_profiles/npj_Digital_Medicine.md +93 -0
  679. package/skills/write-paper/references/paper_types/ai_validation.md +270 -0
  680. package/skills/write-paper/references/paper_types/animal_study.md +194 -0
  681. package/skills/write-paper/references/paper_types/case_report.md +237 -0
  682. package/skills/write-paper/references/paper_types/cross_national.md +328 -0
  683. package/skills/write-paper/references/paper_types/letter.md +127 -0
  684. package/skills/write-paper/references/paper_types/meta_analysis.md +181 -0
  685. package/skills/write-paper/references/paper_types/nhis_cohort.md +297 -0
  686. package/skills/write-paper/references/paper_types/original_article.md +221 -0
  687. package/skills/write-paper/references/paper_types/technical_note.md +131 -0
  688. package/skills/write-paper/references/section_guides/discussion.md +155 -0
  689. package/skills/write-paper/references/section_guides/introduction.md +108 -0
  690. package/skills/write-paper/references/section_guides/methods.md +144 -0
  691. package/skills/write-paper/references/section_guides/results.md +113 -0
  692. package/skills/write-paper/references/section_guides/step7_1_classical_qc.md +67 -0
  693. package/skills/write-paper/references/section_guides/step7_4a_audit_recovery.md +74 -0
  694. package/skills/write-paper/references/section_guides/title_abstract.md +123 -0
  695. package/skills/write-paper/references/section_templates/methods_statistical.md +147 -0
  696. package/skills/write-paper/scripts/check_placeholders.py +182 -0
  697. package/skills/write-paper/skill.yml +48 -0
  698. package/skills/write-paper/tests/test_placeholders.sh +107 -0
  699. package/skills/write-protocol/SKILL.md +243 -0
  700. package/skills/write-protocol/references/ethics_checklist.md +150 -0
  701. package/skills/write-protocol/references/protocol_template.md +304 -0
  702. package/skills/write-protocol/skill.yml +34 -0
@@ -0,0 +1,957 @@
1
+ ---
2
+ name: make-figures
3
+ description: Generate publication-ready figures and visual abstracts for medical research papers. Supports ROC curves, forest plots, CONSORT/STARD/PRISMA flow diagrams, calibration plots, Kaplan-Meier curves, Bland-Altman plots, confusion matrices, pipeline diagrams, and journal-specific visual/graphical abstracts (python-pptx template-based).
4
+ triggers: figure, plot, graph, diagram, ROC curve, forest plot, flow diagram, CONSORT diagram, PRISMA flow, visualization, chart, visual abstract, graphical abstract, key message, figure design, figure planning, effective figure, cognitive load
5
+ tools: Read, Write, Edit, Bash, Grep, Glob
6
+ model: inherit
7
+ ---
8
+
9
+ # Make-Figures Skill
10
+
11
+ You are helping a medical researcher generate publication-ready figures for medical research
12
+ manuscripts. Every figure must meet journal specifications for dimensions, resolution, fonts, and
13
+ color accessibility. Produce clean, data-focused visuals with no chartjunk.
14
+
15
+ ## Credits
16
+
17
+ The Critic Loop (Step 4b) in this skill is inspired by PaperBanana (Zhu et al., *Automating
18
+ Academic Illustration for AI Scientists*, arXiv:2601.23265, 2025) and by prior self-refinement
19
+ research — Self-Refine (Madaan et al., 2023), Reflexion (Shinn et al., 2023), and Constitutional
20
+ AI (Anthropic, 2022). This is a clean-room reconstruction specialized for medical publication
21
+ figures (STARD / CONSORT / PRISMA, journal-specific specs, Wong colorblind palette). No code,
22
+ prompts, or configurations are derived from PaperBanana's repository.
23
+
24
+ ## Communication Rules
25
+
26
+ - Communicate with the user in their preferred language.
27
+ - All figure text (labels, legends, annotations) must be in English.
28
+ - Medical terminology is always in English.
29
+
30
+ ## Data Privacy Check
31
+
32
+ Before reading any data file, check whether it might contain Protected Health Information (PHI):
33
+
34
+ 1. If `*_deidentified.*` files exist in the working directory, use those preferentially.
35
+ 2. If only raw CSV/Excel files exist (no `*_deidentified.*` counterpart), warn the user (ask in the user's preferred language):
36
+ > "Does this data contain patient identifiers (names, national ID / RRN, contact details, etc.)?
37
+ > If so, please de-identify it first with the `/deidentify` skill."
38
+ 3. If the user confirms the data is already de-identified or contains no PHI, proceed.
39
+
40
+ ## Reference Files
41
+
42
+ - **Figure specifications**: `${CLAUDE_SKILL_DIR}/references/figure_specs.md`
43
+ - **Figure style**: `${CLAUDE_SKILL_DIR}/../analyze-stats/references/style/figure_style.mplstyle` (or project's CLAUDE.md if available)
44
+ - **Project data**: See CLAUDE.md for data locations under `2_Data/`
45
+
46
+ Read `figure_specs.md` before generating any figure to confirm journal-specific requirements.
47
+
48
+ ---
49
+
50
+ ## Journal AI-Image Policies (CRITICAL — check BEFORE generation)
51
+
52
+ > Synced with the user's global rule `~/.claude/rules/journal-ai-image-policies.md`. The table below is the local copy used during autonomous workflow; the global rule is authoritative when conflicts arise.
53
+
54
+
55
+ | Journal family | Policy on AI-generated images | Disclosure required |
56
+ |---|---|---|
57
+ | **JACC family (incl. JACC: Asia, JACC Imaging, JACC EP, JACC BTS)** | **Prohibited without prior Editor-in-Chief permission** ([JACC pathway, PMC10167500](https://pmc.ncbi.nlm.nih.gov/articles/PMC10167500/)) | Cover-letter pre-submission inquiry + ICMJE-style declaration |
58
+ | NEJM | AI image generation prohibited | N/A |
59
+ | Radiology / Radiology AI | Allowed with disclosure | Manuscript disclosure block |
60
+ | Nature family | Allowed with disclosure + license check | Methods + figure legend |
61
+ | Lancet family | Disclosure required, generation discouraged | Manuscript disclosure |
62
+ | Default (target unknown) | Treat as prohibited until confirmed | N/A |
63
+
64
+ **Hard rule**: For JACC, NEJM, or any "unknown" target journal, **never** use Gemini / DALL-E / Midjourney / Stable Diffusion / Nano Banana to create images that will appear in figures, Central Illustrations, or graphical abstracts. AI text-editing of the manuscript prose remains acceptable subject to standard disclosure.
65
+
66
+ ### Default workflow when AI images are not allowed
67
+
68
+ 1. **SMART Servier Medical Art** — https://smart.servier.com/, CC BY 4.0, free, 3,000+ vector medical icons (anatomy, organs, ethnicity-specific human figures, drugs, devices). Commercial / journal use allowed. **Required attribution** (1 line in figure legend OR methods):
69
+ > Anatomical icons modified from SMART Servier Medical Art (CC BY 4.0).
70
+ 2. **NIAID BioArt** (https://bioart.niaid.nih.gov) — public domain (US Govt), microbiology / immunology / lab-tech focus.
71
+ 3. **BioRender** (https://www.biorender.com) — institutional license usually required; use the exported "Publication-ready" PNG/TIFF and cite per BioRender publication policy.
72
+ 4. For "diseased" variants not directly available (e.g., calcified vessel from a clean vessel): reuse the healthy asset and overlay disease markers via matplotlib `scatter` / `Circle` / `PathPatch`. Keeps the entire pipeline non-AI and reproducible.
73
+
74
+ ### Asset directory convention
75
+
76
+ ```
77
+ manuscript/figures/_assets_servier/ # CC BY 4.0 source PNGs
78
+ manuscript/figures/_assets_servier/CITATION.md # source URL + download date per asset
79
+ manuscript/figures/_assets_data/ # data-driven raster (R / matplotlib heat maps, KM, etc.)
80
+ manuscript/figures/_legacy/ # archived prior versions
81
+ ```
82
+
83
+ Composition scripts should load only from `_assets_servier/` and `_assets_data/`. If a script imports from `_assets_ai/`, treat it as a policy violation for JACC/NEJM/unknown targets.
84
+
85
+ When a figure is produced by a data-driven `.py`/`.R` script (ROC, forest, KM, calibration, heat maps), lint that script before finalizing with the `/analyze-stats` code-quality gate (`check_generated_code.py {script} --strict`): it catches a missing plotting seed for any bootstrapped CI band, a hardcoded absolute data path, or a hand-typed data literal that should have been read from the analysis CSV.
86
+
87
+ ### Decoration vs information
88
+
89
+ Even when AI images are allowed, AI-generated illustrations are immediately recognizable to experienced reviewers (small decorative icons that add no information, overly uniform layouts, generic clip-art style). For high-impact submissions, prefer Servier / BioArt / BioRender + matplotlib overlays over AI.
90
+
91
+ ---
92
+
93
+ ## DPI and Resolution Guide
94
+
95
+ | Output | Minimum DPI | Notes |
96
+ |--------|------------|-------|
97
+ | Journal halftone (photos, screenshots) | 300 | Standard for most journals |
98
+ | Journal line art (diagrams, graphs) | 600 | Required by Radiology, most Elsevier journals |
99
+ | Poster presentation | 150-200 | Lower is acceptable for large-format prints |
100
+ | Screen/web only | 72-150 | Not for print submission |
101
+
102
+ **Practical workflow for screen captures**:
103
+ - Use HyperSnap or similar tool with DPI pre-set to the journal requirement
104
+ - Compose the figure in PPT at high zoom → capture at target DPI → save as TIFF/PNG
105
+ - Verify final file dimensions match journal column width requirements
106
+
107
+ ---
108
+
109
+ ## Visual Abstract / Graphical Abstract
110
+
111
+ Many journals now require or strongly encourage visual abstracts. European Radiology made
112
+ graphical abstracts mandatory for all Original Articles from first revision (Jan 2025).
113
+ Submitting one voluntarily signals effort and can improve editorial impression.
114
+
115
+ ### Journal Requirements
116
+
117
+ | Status | Example Journals |
118
+ |--------|-----------------|
119
+ | **Mandatory** | European Radiology (from 1st revision, all Original Articles) |
120
+ | **Encouraged** | Abdominal Radiology, JCO, Annals of Internal Medicine |
121
+ | **Voluntary** | Most other journals — improves social media visibility |
122
+
123
+ Check the target journal profile (`write-paper/references/journal_profiles/`) for specific
124
+ visual abstract requirements before starting.
125
+
126
+ ### Workflow
127
+
128
+ 1. **Check journal template.** Look for an official PPTX template in
129
+ `${CLAUDE_SKILL_DIR}/references/visual_abstract_templates/{journal}.pptx`.
130
+ If no journal-specific template exists, use `medsci_default.pptx`.
131
+ 2. **Extract content from the manuscript:**
132
+ - **Title:** Full article title
133
+ - **Hypothesis/Question:** Derived from Key Point 1 or study objective (max 1 sentence)
134
+ - **Methodology:** Brief flowchart or ≤3 bullets, <6 words each
135
+ - **Visual element:** Study's own figure (ROC curve, flow diagram, representative image)
136
+ - **Badges:** Patient cohort (N=...) | Modality/organ | Single/Multi-center
137
+ - **Main finding:** Derived from Key Point 3 (<20 words)
138
+ - **Citation:** Journal (year) Authors; DOI
139
+ 3. **Select visual element** (priority order — no API needed for top options):
140
+ 1. Study's own figures (ROC, flow diagram, representative image) — **always preferred**
141
+ 2. Free illustration from Servier Medical Art or NIAID BioArt
142
+ (see `${CLAUDE_SKILL_DIR}/references/medical_illustration_sources.md`)
143
+ 3. Manual drawing in PPT/Keynote/Figma
144
+ 4. AI generation via `generate_image.py --style medical` (only if GEMINI_API_KEY set)
145
+ 4. **Generate using the script:**
146
+ ```bash
147
+ python ${CLAUDE_SKILL_DIR}/scripts/generate_visual_abstract.py \
148
+ --template european_radiology \
149
+ --title "Article Title" \
150
+ --hypothesis "Research question" \
151
+ --methods "Method 1|Method 2|Method 3" \
152
+ --finding "Main finding statement" \
153
+ --citation "Eur Radiol (2026) Author A et al; DOI:..." \
154
+ --visual figures/fig1_roc_curve.png \
155
+ --badges "N=450|CT chest|Multi-center" \
156
+ --output figures/visual_abstract.pptx
157
+ ```
158
+ 5. **Review with user.** Open the PPTX to verify layout and content. Iterate.
159
+ 6. **Export.** PPTX is the primary deliverable. For PNG: open in PowerPoint/Keynote → export,
160
+ or use LibreOffice CLI (`soffice --headless --convert-to png`).
161
+
162
+ ### Design Principles
163
+
164
+ - One page, landscape (16:9) or per journal template specification
165
+ - Three sections: Study question → Key method → Main result
166
+ - Use the study's actual figures rather than generic graphics
167
+ - Minimize text — let visuals carry the message
168
+ - Every visual element must serve a purpose (no decorative clip-art)
169
+
170
+ ### Available Templates
171
+
172
+ | Template | File | Use When |
173
+ |----------|------|----------|
174
+ | European Radiology | `european_radiology.pptx` | Submitting to Eur Radiol |
175
+ | MedSci Default | `medsci_default.pptx` | Any journal without official template |
176
+ | JACC Central Illustration | `jacc_central_illustration.pptx` | JACC family journals (use `--type central-illustration`) |
177
+
178
+ To add a new journal template: see `${CLAUDE_SKILL_DIR}/references/visual_abstract_templates/template_guide.md`.
179
+
180
+ ---
181
+
182
+ ## Central Illustration vs Visual Abstract
183
+
184
+ A Central Illustration (CI) is **not** a Visual Abstract (VA). They serve different purposes and follow different rules. JACC family journals (JACC, JACC: Asia, JACC: Cardiovascular Imaging, JACC: Heart Failure, JACC: CardioOncology, JACC: Clinical Electrophysiology, JACC: Basic to Translational Science) require a Central Illustration with every Original Article. Reference: Fuster V, Mann DL. *JACC.* 2019;74(22):2816–2820.
185
+
186
+ | Aspect | Central Illustration | Visual Abstract |
187
+ |---|---|---|
188
+ | Purpose | Single key finding / take-home message | Methods + Results pictorial summary |
189
+ | Where in paper | End of Results / start of Discussion | Beginning of paper |
190
+ | Methods content | **None** | Required |
191
+ | Audience | Cardiovascular clinicians + journal-issue readers | Broad including non-specialists / social media |
192
+ | Used by | All JACC family + JACC: Asia | Originally JACC: Basic to Translational Science |
193
+ | Text density | Minimal (graphical priority) | More allowed (methods labels) |
194
+ | Bar graphs | OK if they capture entire message | Avoid — use ↑↓ arrows |
195
+ | Default complexity | 1–3 visual zones | Q→M→R three blocks |
196
+
197
+ ### Fuster-Mann five rules (CI must pass all)
198
+
199
+ 1. **Know the message.** One finding, not study design + multiple findings.
200
+ 2. **Convey graphically, not textually.** Even a simple KM curve is OK.
201
+ 3. **Avoid using too much text.** Replace with icons or arrows.
202
+ 4. **Avoid secondary messages.** ≤ 5 seconds for a viewer to state the main finding.
203
+ 5. **Simplicity is superior.** Default to fewer panels.
204
+
205
+ Full guidance and validation thresholds: `${CLAUDE_SKILL_DIR}/references/jacc_central_illustration_principles.md`.
206
+
207
+ ### CI mode invocation
208
+
209
+ ```bash
210
+ python ${CLAUDE_SKILL_DIR}/scripts/generate_visual_abstract.py \
211
+ --type central-illustration \
212
+ --visual figures/central_illustration_v2.png \
213
+ --citation "FirstAuthor Last et al. Journal Name 2026; vol(issue):pages." \
214
+ --output submission/jacc_asia/central_illustration.pptx \
215
+ --ci-zones 3 --ci-label-words 22 --ci-numerical-points 2 \
216
+ --ci-raw-text "warranty drops to 3 years in age 45+ with cardiometabolic burden; MASLD HR 1.77"
217
+ ```
218
+
219
+ CI mode validates before rendering and rejects (exit 2) if any of: zones > 3, label words > 30, numerical points > 4, or methodology terms (cohort flow / inclusion / exclusion / study design / enrollment / randomized / sample size / CONSORT / PRISMA / STARD) appear in `--ci-raw-text`. Override individual rules with `--ci-allow {zones|words|numerical|methods}` only when you have a defensible reason.
220
+
221
+ The JACC submission PPTX is a 10×7.5 in slide with 4 placeholders (citation textbox, content picture, footer textbox reserved, JACC logo). The red border + blue "CENTRAL ILLUSTRATION:" header are applied by JACC editorial after acceptance — authors submit only the content figure + citation.
222
+
223
+ ---
224
+
225
+ ## Workflow
226
+
227
+ ### Step 1: Specify
228
+
229
+ **Before specifying figure type, read `${CLAUDE_SKILL_DIR}/references/design_principles.md`** —
230
+ identify (1) the one-sentence key message, (2) audience and reading-time budget, and
231
+ (3) whether a figure is the right vehicle (vs a small table or in-line text). The
232
+ five strategies in that file shift Step 1 from "which chart fits the data" to
233
+ "what should the reader remember 10 seconds later." Skip only when the figure
234
+ is mandated by a reporting guideline (e.g., PRISMA / CONSORT flow), and even
235
+ then apply the cognitive-load checklist.
236
+
237
+ **For reporting-guideline figures**, also load
238
+ `${CLAUDE_SKILL_DIR}/references/reporting_guideline_figure_map.md` — the
239
+ 14-row table tells you which guideline mandates which figures and whether
240
+ this skill ships an official template (✅), generic flow only (⚠️), or
241
+ needs manual production (❌). Critical for AI-extension guidelines
242
+ (CONSORT-AI, STARD-AI, TRIPOD+AI, CLAIM 2024, DECIDE-AI).
243
+
244
+ **For medical AI / engineering pipeline figures** (DICOM workflow,
245
+ annotation pipeline, federated learning topology, model architecture),
246
+ also load `${CLAUDE_SKILL_DIR}/references/pipeline_concepts_medical_ai.md` —
247
+ canonical layouts, required annotations, and tool selection per type.
248
+
249
+ **Optional flags:**
250
+ - `--study-type <type>`: One of: `diagnostic-accuracy`, `ai-validation`, `meta-analysis`, `dta-meta-analysis`, `observational-cohort`, `rct`. When set, auto-generate the full figure set from the Study-Type Figure Sets table below without prompting for individual figure types.
251
+ - `--data-dir <path>`: Directory containing analysis outputs (CSVs, `_analysis_outputs.md`). Default: current working directory.
252
+
253
+ Ask the user for:
254
+ 1. **Figure type** (from the supported types below) — skipped when `--study-type` is provided
255
+ 2. **Data source** (file path, DataFrame, or manual values)
256
+ 3. **Target journal** (for dimension/font requirements)
257
+ 4. **Panel layout** (single panel, multi-panel, or let you decide)
258
+ 5. **Any special requests** (annotations, highlights, reference lines)
259
+ 6. **Study type** (if not passed via `--study-type`): determines the required figure set
260
+
261
+ If the user provides enough context, infer missing parameters and confirm before proceeding.
262
+
263
+ ### Step 2: Configure
264
+
265
+ 1. Load the figure style file:
266
+ ```python
267
+ import matplotlib.pyplot as plt
268
+ import os
269
+ style_path = os.path.join(os.environ.get('CLAUDE_SKILL_DIR', '.'), '../analyze-stats/references/style/figure_style.mplstyle')
270
+ if os.path.exists(style_path):
271
+ plt.style.use(style_path)
272
+ ```
273
+ 2. Look up journal-specific dimensions from `${CLAUDE_SKILL_DIR}/references/figure_specs.md`.
274
+ 3. Set the colorblind-safe palette (Wong palette by default).
275
+ 4. Configure font sizes per element type (title, axis label, tick label, legend, annotation).
276
+
277
+ ### Step 3: Generate
278
+
279
+ Create the figure using Python (matplotlib/seaborn as primary, with specialized libraries as needed).
280
+
281
+ **Script structure:**
282
+ ```python
283
+ """
284
+ Figure: {description}
285
+ Date: {YYYY-MM-DD}
286
+ Target: {journal}
287
+ Dimensions: {width} x {height} inches @ {DPI} DPI
288
+ """
289
+ import numpy as np
290
+ import matplotlib.pyplot as plt
291
+ import os
292
+
293
+ style_path = os.path.join(os.environ.get('CLAUDE_SKILL_DIR', '.'), '../analyze-stats/references/style/figure_style.mplstyle')
294
+ if os.path.exists(style_path):
295
+ plt.style.use(style_path)
296
+
297
+ # Wong colorblind-safe palette
298
+ WONG = ['#000000', '#E69F00', '#56B4E9', '#009E73',
299
+ '#F0E442', '#0072B2', '#D55E00', '#CC79A7']
300
+
301
+ np.random.seed(42)
302
+ ```
303
+
304
+ ### Step 4: Review
305
+
306
+ Present the figure to the user and ask:
307
+ - Does the layout work?
308
+ - Are labels and annotations correct?
309
+ - Any adjustments to colors, sizing, or emphasis?
310
+
311
+ Iterate until the user approves.
312
+
313
+ ### Step 4b: Critic Loop (self-critique before final export)
314
+
315
+ Before Step 5 Export, run the automated Critic Loop. This is two stages —
316
+ deterministic quantitative checks via Python, then qualitative review by
317
+ Claude itself — and the combined output tells us whether to re-render or
318
+ hand off to the user.
319
+
320
+ **Stage 1: Quantitative checks (`critic_figure.py`)**
321
+
322
+ ```bash
323
+ python ${CLAUDE_SKILL_DIR}/scripts/critic_figure.py \
324
+ figures/fig1_stard.png \
325
+ --type stard \
326
+ --spec-min-dpi 600 \
327
+ --spec-width-in 7.0 \
328
+ --source-text figures/fig1_stard.txt \ # optional: expected strings for OCR coverage
329
+ --out figures/fig1_stard.critique.json
330
+ ```
331
+
332
+ This produces a JSON report covering:
333
+ - DPI and physical width vs. journal spec
334
+ - Dominant-color breakdown and out-of-Wong-palette fraction
335
+ - OCR-detected word count, minimum text height, and (if a source-text file
336
+ was provided) source-word coverage
337
+
338
+ **Stage 2: Qualitative review (Claude session)**
339
+
340
+ 1. Use the Read tool to load the generated PNG.
341
+ 2. Read the corresponding rubric file:
342
+ - Flow diagrams: `${CLAUDE_SKILL_DIR}/references/critic_rubrics/flow_diagram.md`
343
+ (sections A–G; section G adds cognitive-load and template-fidelity checks)
344
+ - Data plots: `${CLAUDE_SKILL_DIR}/references/critic_rubrics/data_plot.md`
345
+ (sections A–G; section G adds calibration / fairness / colorblind+redundant /
346
+ dataset-flow / decision-curve checks for medical AI papers)
347
+ - For PRISMA / CONSORT / STARD / STROBE specifically, also read
348
+ `${CLAUDE_SKILL_DIR}/references/flow_diagram_lessons.md` — five
349
+ production lessons covering official-template fidelity, PDF export
350
+ fidelity (VML fallback), docx XML escape, sequential placeholder
351
+ mapping, and frozen-version sync with the manuscript.
352
+ - For AI-extension guidelines (CONSORT-AI, STARD-AI, TRIPOD+AI,
353
+ CLAIM 2024, DECIDE-AI), also read
354
+ `${CLAUDE_SKILL_DIR}/references/reporting_guideline_figure_map.md` —
355
+ the row for the target guideline lists mandatory figures and which
356
+ ones this skill cannot template (production path documented per
357
+ row).
358
+ - For medical-AI pipeline / DICOM / federated / architecture figures,
359
+ also read `${CLAUDE_SKILL_DIR}/references/pipeline_concepts_medical_ai.md`.
360
+ 3. If exemplars exist in `${CLAUDE_SKILL_DIR}/references/exemplar_diagrams/{type}/`,
361
+ Read 1–3 of them plus their `_why.md` notes.
362
+ 4. Score every rubric item as PASS / PARTIAL / FAIL with a one-line note,
363
+ using the format at the bottom of the rubric file.
364
+ 5. Emit a **"Required edits before next render"** list of concrete
365
+ source-code changes (D2 node renames, count corrections, matplotlib
366
+ parameter tweaks).
367
+
368
+ **Refinement loop**
369
+
370
+ - If all items are PASS → proceed to Step 5 Export with `critic_pass: yes`.
371
+ - If any item is FAIL → apply the required edits to the source (D2 file or
372
+ matplotlib script), re-render, and re-run Stage 1 + Stage 2. Default
373
+ maximum is **T=2 rounds**; the user may request up to T=3.
374
+ - If after the max rounds some items remain PARTIAL, proceed with
375
+ `critic_pass: partial` and record the residual items in the manifest's
376
+ `critic_notes` field.
377
+
378
+ Record the final state in `_figure_manifest.md` (see the manifest format
379
+ below) so downstream steps (`/write-paper` Phase 2 embedding and Phase 7
380
+ DOCX build) and future critic passes can see the history.
381
+
382
+ ### Step 5: Export
383
+
384
+ Save final outputs:
385
+ - **PDF** (vector format, preferred for journal submission)
386
+ - **PNG** (300 DPI raster, for review and presentation)
387
+ - **TIFF** (if the journal requires it, 300 DPI LZW compression)
388
+
389
+ Name files descriptively: `fig1_roc_curve.pdf`, `fig2_consort_flow.pdf`, etc.
390
+
391
+ **For PPTX outputs (visual abstract, central illustration, or any deck the figure
392
+ will live in)**: run the Mac-compatibility validator before delivery. PowerPoint
393
+ Mac silently drops TIFF, renders `<a:sp3d>` 3-D bevels as red outlines that PDF
394
+ export does not show, and refuses to open files whose `app.xml` slide count
395
+ disagrees with the actual slide XML files. This script catches all four classes
396
+ of defect codified in `~/.claude/rules/pptx-mac-compatibility.md`:
397
+
398
+ ```bash
399
+ python ${CLAUDE_SKILL_DIR}/scripts/validate_pptx_mac_compat.py \
400
+ figures/visual_abstract.pptx \
401
+ --json figures/visual_abstract.mac_compat.json \
402
+ --strict
403
+ ```
404
+
405
+ Exit code 1 means at least one FAIL — fix per the `fix:` field in the JSON
406
+ report and re-render the PPTX before delivery. Exit code 0 with WARN is
407
+ acceptable. Skip this step when the figure is PNG/PDF only (no PPTX).
408
+
409
+ ### Step 6: Design QC Checklist
410
+
411
+ Before delivering the final figure, verify all items:
412
+
413
+ - [ ] **Font**: Sans-serif (Arial/Helvetica), minimum 7pt, axis labels ≥ 9pt
414
+ - [ ] **Color**: Wong/Okabe-Ito colorblind-safe palette used
415
+ - [ ] **Colorblind test**: Would the figure work for deuteranopia? (no red-green only distinctions)
416
+ - [ ] **Grayscale test**: Information preserved when printed in black & white
417
+ - [ ] **Alignment**: All elements on a consistent grid; panels aligned
418
+ - [ ] **Vector output**: PDF/SVG saved (not just PNG)
419
+ - [ ] **Resolution**: ≥ 300 DPI for raster elements, ≥ 600 DPI for line art
420
+ - [ ] **Journal specs**: Dimensions, font, and format match target journal requirements
421
+ - [ ] **No chartjunk**: No 3D effects, unnecessary gridlines, gradient fills, or decorative elements
422
+ - [ ] **Caption**: Drafted with key finding, abbreviations, statistical details, and sample size
423
+
424
+ ---
425
+
426
+ ## Study-Type Figure Sets
427
+
428
+ When the study type is known (from `/write-paper` Phase 0 or user specification), auto-detect and generate the complete required figure set without asking for each figure individually.
429
+
430
+ | Study Type (Guideline) | Required Figures |
431
+ |---|---|
432
+ | Diagnostic accuracy (STARD) | STARD flow diagram, ROC curve, confusion matrix, calibration plot |
433
+ | AI validation (TRIPOD+AI / CLAIM) | Flow diagram, ROC curve, confusion matrix, calibration plot, feature importance or SHAP, Grad-CAM (if imaging) |
434
+ | Meta-analysis (PRISMA) | PRISMA flow diagram, forest plot, funnel plot |
435
+ | DTA meta-analysis (PRISMA-DTA) | PRISMA flow diagram, paired forest plot (Se + Sp), SROC curve, Deeks funnel plot |
436
+ | Observational cohort (STROBE) | Flow diagram, Kaplan-Meier curves (if survival endpoint) |
437
+ | RCT (CONSORT) | CONSORT flow diagram, primary endpoint figure |
438
+
439
+ After generating all figures, create a structured manifest file at `figures/_figure_manifest.md`:
440
+
441
+ ```markdown
442
+ # Figure Manifest
443
+ Generated: {YYYY-MM-DD}
444
+ Study type: {study type or "custom"}
445
+
446
+ | Figure | Path | Type | Tool | Critic | Rounds | Description |
447
+ |--------|------|------|------|--------|--------|-------------|
448
+ | Figure 1 | figures/fig1_stard_flow.svg | flow-diagram | D2 | yes | 2 | STARD participant flow diagram |
449
+ | Figure 2 | figures/fig2_roc.pdf | roc-curve | matplotlib | yes | 1 | ROC curves for Model A vs B |
450
+ | Figure 3 | figures/fig3_calibration.pdf | calibration | matplotlib | partial | 3 | Calibration plot; legend still crowded (see notes) |
451
+
452
+ ## Critic notes
453
+ - Figure 3: after 3 rounds, legend placement remains crowded at the
454
+ double-column width. Candidate remediations documented but not applied
455
+ to avoid reducing data-point visibility.
456
+ ```
457
+
458
+ **Manifest field definitions:**
459
+ - **Path**: Relative path from project root
460
+ - **Type**: One of: `flow-diagram`, `roc-curve`, `forest-plot`, `funnel-plot`, `calibration`, `km-curve`, `bland-altman`, `confusion-matrix`, `box-violin`, `bar-chart`, `heatmap`, `pipeline`, `visual-abstract`, `sroc-curve`, `other`
461
+ - **Tool**: Tool used to generate (`matplotlib`, `D2`, `python-pptx`, `seaborn`, etc.)
462
+ - **Critic**: `yes` (all rubric items PASS) / `partial` (some PARTIAL after max rounds) / `no` (never critiqued — avoid for submission figures) / `skip` (deliberately bypassed, e.g., panel figure assembled externally)
463
+ - **Rounds**: Number of Critic Loop rounds executed (0 if skipped)
464
+ - **Description**: One-line description suitable for figure legend context
465
+
466
+ A `## Critic notes` section at the bottom of the manifest records any
467
+ residual PARTIAL items and the rationale for accepting them.
468
+
469
+ This manifest is consumed by `/write-paper` Phase 2 (figure embedding) and Phase 7 (DOCX build). It **MUST** exist after figure generation completes. Verify the file is non-empty before finishing.
470
+
471
+ **Flow diagram generation rule:** STARD/CONSORT/PRISMA/STROBE flow diagrams **MUST** use the standardized R pipeline `scripts/generate_flow_diagram.R` (DiagrammeR + Graphviz dot + rsvg). This is the single canonical tool for all four reporting-guideline flow diagrams. Do NOT use matplotlib `FancyBboxPatch` (manual coordinates break when text changes, and patches distort when embedded in DOCX). Do NOT use D2 for new flow diagrams (font control is weak, overlap requires manual post-processing). The legacy D2 recipe remains documented below as a fallback only when R is unavailable.
472
+
473
+ **R flow diagram recipe (mandatory for all flow diagrams):**
474
+
475
+ The pipeline reads a YAML config describing nodes/edges and produces: a true vector PDF (journal submission), a 300 dpi PNG (review copy), and a 600 dpi PNG (RSNA/Eur Radiol line-art). Default style is single-color black outline with white fill in Arial, overriding D2's colored defaults and matplotlib's manual coordinates.
476
+
477
+ ```bash
478
+ # 1. One-time system dependency:
479
+ brew install librsvg
480
+ Rscript -e 'install.packages(c("DiagrammeR","DiagrammeRsvg","rsvg","yaml"))'
481
+
482
+ # 2. Author a YAML config. Templates for each type live at
483
+ # references/exemplar_diagrams/{strobe,consort,prisma,stard}/template_input.yaml
484
+ # 3. Render:
485
+ Rscript ${CLAUDE_SKILL_DIR}/scripts/generate_flow_diagram.R \
486
+ --type {strobe|consort|prisma|stard} \
487
+ --config path/to/counts.yaml \
488
+ --out figures/figure1_flow
489
+ # Outputs: figure1_flow.pdf, figure1_flow.png (300 dpi), figure1_flow_600.png
490
+ ```
491
+
492
+ **YAML schema highlights:**
493
+ - `rankdir: TB` (top-down, default) or `LR` (left-to-right).
494
+ - `nodes:` list with `id`, `label` (use literal `\n` for line breaks, real Unicode `–`, `≤`, `−`, `•`).
495
+ - Optional per-node: `highlight: true` (thicker border), `shape: note` (side boxes), `rank_same_with: <other_id>` (place on same horizontal rank).
496
+ - `edges:` list with `from`, `to`, optional `style: dashed`, `arrow: false` (no arrowhead), `constraint: false` (edge ignored by layout engine — use for exclusion side-links).
497
+ - Numbers in labels **MUST** be CSV-derived in an upstream R script that emits the YAML, or hand-written only when the value lives in a commit-tracked data artifact. Follow numerical-safety rules.
498
+
499
+ **Style is fixed (do not override in the YAML):**
500
+ - Monochrome: all boxes `color=black, fillcolor=white, fontname="Arial"`.
501
+ - Penwidth 1.2 default, 1.8 for highlighted cohort box.
502
+ - Arrow style: black solid, arrowsize 0.75. Dashed without arrowhead for exclusion side-links.
503
+ - Bullet alignment in multi-item labels: Graphviz `\l` (left-align), never `\n` (center). Each `\l` applies to text preceding it.
504
+ - **No HTML-like labels** (`label=<...>` with `<B>`, `<I>`, `&#8226;`). Plain quoted labels with `\l` bullets produce tighter, more readable structure than HTML ragged wrapping. Do not reintroduce without explicit approval.
505
+ - To add one emphasis color (e.g., Wong blue `#0072B2` for a single highlighted box), edit `scripts/generate_flow_diagram.R` — do not inline hex colors in YAML.
506
+
507
+ **Per-project `create_figure1.R` pattern (preferred for complex flows):**
508
+
509
+ When the flow has derived counts, `stopifnot()` reconciliation, multi-rank `{rank=same; ... }` constraints, or exclusion side-cars that the generic YAML dispatcher cannot express cleanly, write a per-project `create_figure1.R` directly (same DiagrammeR + DiagrammeRsvg + rsvg stack, sprintf'd `dot` string). This is the dominant pattern when the generic YAML dispatcher cannot capture the flow:
510
+
511
+ - STROBE cohort: `<project>/manuscript/figures/create_figure1.R`
512
+ - STARD: `<project>/Analysis/figures/create_figure1.R` or `<project>/figures/v2_monochrome/create_figure1.R`
513
+ - PRISMA / PRISMA-DTA: `<project>/5_Figures/create_figure1.R` or `<project>/analysis/create_figure1.R`
514
+ - CONSORT-edu (naturalistic allocation): `<project>/figures/v2_monochrome/create_figure1.R`
515
+
516
+ Copy the `STYLE_HEADER` (graph/node/edge attrs) verbatim from any exemplar; then customise nodes, edges, and `{rank=same}` blocks. Use `read.csv()` for cohort counts when possible; if hardcoded, every number must have a source comment referencing manuscript line / CSV cell / screening log row.
517
+
518
+ **Legacy D2 fallback (only when R unavailable):**
519
+
520
+ ```bash
521
+ d2 --layout elk --theme 0 --pad 20 flow.d2 /tmp/raw.png --scale 2
522
+ # Resize + 85% vertical compression via Pillow; then render PDF:
523
+ d2 --layout elk --theme 0 --pad 20 flow.d2 figures/fig1_flow.pdf
524
+ ```
525
+
526
+ Use `font-size: 20-24`, `stroke: black`, `fill: white`. D2 PDF is vector; D2 PNG needs the resize step to match publication density.
527
+
528
+ ---
529
+
530
+ ## Tool Selection Guide
531
+
532
+ Choose the right tool for each figure type. Using matplotlib for flow diagrams leads to
533
+ hard-coded coordinates that break when text changes — use auto-layout tools instead.
534
+
535
+ ### Data Visualization → matplotlib/seaborn (this skill)
536
+
537
+ Best for figures where data drives the layout. This skill handles these directly:
538
+
539
+ | Type | Use Case | Key Library |
540
+ |------|----------|-------------|
541
+ | ROC Curve | Diagnostic accuracy | matplotlib, sklearn |
542
+ | Forest Plot | Meta-analysis | matplotlib |
543
+ | Calibration Plot | Prediction model | matplotlib |
544
+ | KM Curve | Survival analysis | lifelines, matplotlib |
545
+ | Bland-Altman | Agreement | matplotlib |
546
+ | Confusion Matrix | Classification | seaborn |
547
+ | Box/Violin Plot | Group comparison | seaborn |
548
+ | Bar Chart | Categorical comparison | matplotlib |
549
+ | Heatmap | Correlation/agreement | seaborn |
550
+
551
+ ### Flow Diagrams → Dedicated Tools (NOT matplotlib)
552
+
553
+ Flow diagrams require auto-layout engines. Do NOT use matplotlib patches with manual coordinates
554
+ — this causes the "absolute coordinate hell" problem where changing one box breaks all
555
+ downstream positions.
556
+
557
+ | Type | Recommended Tool | Why |
558
+ |------|-----------------|-----|
559
+ | STROBE (cohort / cross-sectional) | **`scripts/generate_flow_diagram.R --type strobe`** | Single canonical tool; auto-layout; vector PDF + 300/600 dpi PNG |
560
+ | CONSORT (RCT) | **`scripts/generate_flow_diagram.R --type consort`** | Same pipeline; monochrome Arial default |
561
+ | PRISMA 2020 (SR/MA) | **`scripts/generate_flow_diagram.R --type prisma`** | Faithfully implements PRISMA 2020 structure; avoids PRISMA2020 R package's webshot-based raster PDF issue |
562
+ | STARD (DTA) | **`scripts/generate_flow_diagram.R --type stard`** | Same pipeline; supports 2x2 reference-standard split |
563
+ | Pipeline Diagram | **D2** (legacy) | Until pipeline-diagram support is added to the R script |
564
+
565
+ **R workflow for flow diagrams:** See the "R flow diagram recipe" above in the Flow diagram generation rule. Key points: YAML config → `Rscript scripts/generate_flow_diagram.R --type <t> --config <yaml> --out <prefix>` → PDF + 300/600 dpi PNG. Templates in `references/exemplar_diagrams/{strobe,consort,prisma,stard}/template_input.yaml`.
566
+
567
+ ### Official Reporting Guideline Templates → `templates/official/`
568
+
569
+ When a journal requires the canonical, statement-issued template (rather than
570
+ the auto-laid-out R version), use the bundled official files in
571
+ `templates/official/{prisma2020,consort2010,stard2015,spirit2013}/`.
572
+
573
+ | Guideline | What ships | When to use |
574
+ |-----------|-----------|-------------|
575
+ | PRISMA 2020 | Locally built `.pptx` (4 variants) + `fill_prisma_template.py` | Reviewer asks for the official PRISMA 2020 layout, or you want editable PowerPoint instead of an R-rendered PDF. |
576
+ | STROBE (cohort) | Parametric `.pptx` builder `build_strobe_template.py` (single-script, takes YAML config) | Cohort/case-control study Figure 1 when co-authors want PowerPoint they can hand-edit. Auto-fits text, content-fits slide, dashed-border exclusion side-branches with strictly-horizontal connectors. Optional left-side phase column (omit `stages:` for the plain STROBE convention; include it for the PRISMA-style Identification/Screening/Inclusion/Analysis column). Pair with `generate_flow_diagram.R --type strobe` for the vector PDF/TIFF submission file. |
577
+ | CONSORT 2025 | Official `.docx` flow diagram + checklist | RCT submissions to journals that mandate the consort-spirit.org template. |
578
+ | STARD 2015 | Official `.pdf` flow diagram + `.docx` checklist | Diagnostic accuracy studies; flow diagram is fixed PDF, checklist is editable. |
579
+ | SPIRIT 2025 | Official `.docx` participant timeline + checklist | Trial protocols. |
580
+
581
+ Refresh / fill workflow:
582
+
583
+ ```bash
584
+ # Refresh from canonical sources (CC-BY 4.0 / public-statement licenses)
585
+ bash ${CLAUDE_SKILL_DIR}/scripts/fetch_official_templates.sh
586
+
587
+ # Build PRISMA 2020 .pptx (one-time; site blocks programmatic .docx fetch)
588
+ python3 ${CLAUDE_SKILL_DIR}/scripts/build_prisma2020_template.py \
589
+ --variant new \
590
+ --out ${CLAUDE_SKILL_DIR}/templates/official/prisma2020/PRISMA_2020_flow_new_v1.pptx
591
+
592
+ # Fill counts — positional 10-tuple matching most SR/MA workflows:
593
+ # n_db, n_dup, n_screened, n_screen_excluded,
594
+ # n_sought, n_assessed, n_excl_r1, n_excl_r2, n_excl_r3, n_studies
595
+ python3 ${CLAUDE_SKILL_DIR}/scripts/fill_prisma_template.py \
596
+ --template ${CLAUDE_SKILL_DIR}/templates/official/prisma2020/PRISMA_2020_flow_new_v1.pptx \
597
+ --counts "315,122,186,7,111,204,102,84,3,15" \
598
+ --out fig1_prisma_filled.pptx
599
+
600
+ # Or use full JSON mapping for studies with non-standard PRISMA splits
601
+ python3 ${CLAUDE_SKILL_DIR}/scripts/fill_prisma_template.py \
602
+ --template ${CLAUDE_SKILL_DIR}/templates/official/prisma2020/PRISMA_2020_flow_new_v1.pptx \
603
+ --counts-file my_counts.json \
604
+ --out fig1_prisma_filled.pptx
605
+
606
+ # STROBE — parametric single-script builder (cohort study; spine structure varies per study).
607
+ # YAML schema: stages, spine (id/stage/text), exclusions (after/text). Consecutive same-stage
608
+ # rows share one phase label automatically. Stage box fills auto-pick readable text color.
609
+ python3 ${CLAUDE_SKILL_DIR}/scripts/build_strobe_template.py \
610
+ --config figures/figure1_strobe.yaml \
611
+ --out figures/figure1_strobe.pptx
612
+ ```
613
+
614
+ For STROBE the canonical KJR/Radiology/BMJ submission flow is:
615
+
616
+ 1. Render the vector submission file via the auto-fitting Graphviz path:
617
+ `Rscript ${CLAUDE_SKILL_DIR}/scripts/generate_flow_diagram.R --type strobe --config figures/figure1_strobe_graphviz.yaml --out figures/figure1`
618
+ 2. Build the editable PowerPoint companion via `build_strobe_template.py` so co-authors and senior reviewers can adjust prose/positioning before sign-off.
619
+ 3. Re-export the final PPTX to PDF/TIFF only after co-author edits are integrated.
620
+
621
+ See `templates/official/NOTES.md` for licenses, attribution, and refresh notes.
622
+
623
+ ### Visual / Graphical Abstracts → python-pptx Template Generator
624
+
625
+ | Type | Recommended Tool |
626
+ |------|-----------------|
627
+ | Visual Abstract (any journal) | `generate_visual_abstract.py` with PPTX template |
628
+ | Visual element illustration | Study's own figures (preferred), or free libraries (Servier/NIAID) |
629
+ | Medical Illustration | See `${CLAUDE_SKILL_DIR}/references/medical_illustration_sources.md` |
630
+
631
+ See the Visual Abstract section above for the full workflow.
632
+
633
+ ### Hybrid Workflow (recommended for publication)
634
+
635
+ ```
636
+ Data plots: matplotlib/seaborn → PDF + PNG (this skill)
637
+ Flow diagrams: generate_flow_diagram.R (DiagrammeR + rsvg) → PDF + 300/600 dpi PNG
638
+ Final assembly: pandoc or python-docx (auto-embedded in DOCX)
639
+ ```
640
+
641
+ ---
642
+
643
+ ## Supported Figure Types (matplotlib/seaborn)
644
+
645
+ | Type | Use Case | Key Library | Output |
646
+ |------|----------|-------------|--------|
647
+ | ROC Curve | Diagnostic accuracy | matplotlib, sklearn | Single/multi-model ROC with AUC |
648
+ | Forest Plot | Meta-analysis | matplotlib | Effect sizes with CIs, diamond summary |
649
+ | Calibration Plot | Prediction model | matplotlib | Observed vs predicted with Hosmer-Lemeshow |
650
+ | KM Curve | Survival analysis | lifelines, matplotlib | With risk table, log-rank p |
651
+ | Bland-Altman | Agreement | matplotlib | With mean diff, +/-1.96 SD limits |
652
+ | Confusion Matrix | Classification | seaborn | Heatmap with percentages |
653
+ | Box/Violin Plot | Group comparison | seaborn | With individual data points |
654
+ | Pipeline Diagram | Methods figure | D2 (preferred) or matplotlib | Processing/workflow steps |
655
+ | Bar Chart | Categorical comparison | matplotlib | With error bars (CI or SD) |
656
+ | Heatmap | Correlation/agreement | seaborn | Color-coded matrix |
657
+
658
+ ---
659
+
660
+ ## Figure Type Templates
661
+
662
+ ### ROC Curve
663
+
664
+ ```python
665
+ from sklearn.metrics import roc_curve, auc
666
+
667
+ fig, ax = plt.subplots(figsize=(3.5, 3.5))
668
+ fpr, tpr, _ = roc_curve(y_true, y_score)
669
+ roc_auc = auc(fpr, tpr)
670
+ ax.plot(fpr, tpr, color=WONG[5], lw=1.5,
671
+ label=f'Model (AUC = {roc_auc:.3f})')
672
+ ax.plot([0, 1], [0, 1], 'k--', lw=0.8, alpha=0.5)
673
+ ax.set(xlabel='1 - Specificity', ylabel='Sensitivity',
674
+ xlim=[-0.02, 1.02], ylim=[-0.02, 1.02])
675
+ ax.legend(loc='lower right', frameon=False)
676
+ ```
677
+
678
+ - For multiple models: use distinct Wong palette colors, include AUC + 95% CI in legend.
679
+ - For comparison: report DeLong p-value in annotation.
680
+
681
+ ### Forest Plot
682
+
683
+ - Horizontal layout: effect sizes as squares (sized by weight), CIs as lines.
684
+ - Diamond at bottom for pooled estimate.
685
+ - Vertical dashed line at null effect (OR=1 or MD=0).
686
+ - Axis label: "Favours A | Favours B" or appropriate.
687
+ - Include heterogeneity stats (I-squared, p) below the diamond.
688
+
689
+ ### Flow Diagrams (STROBE / CONSORT / PRISMA / STARD)
690
+
691
+ **Single canonical tool: `scripts/generate_flow_diagram.R`** (see the R flow diagram recipe above). Do not fall back to matplotlib for flow diagrams — manual coordinates break when text changes and patches distort in DOCX. D2 remains a documented legacy fallback only when R is unavailable.
692
+
693
+ Layout invariants:
694
+ - Rectangular boxes with rounded corners for stages; notes (`shape: note`) for exclusion side-boxes.
695
+ - Vertical top-down flow by default; horizontal only when the manuscript layout demands it.
696
+ - Every box label contains the count (e.g., `"Assessed for eligibility\n(n = 450)"`).
697
+ - Numbers are CSV-derived (numerical-safety) — author the YAML from an R/Python script that reads the upstream data, or cite the source file in a comment when a literal value is unavoidable.
698
+ - Follow the official template layout from each guideline.
699
+ - **Use relative positioning** — never hard-code absolute y-coordinates. Calculate each box
700
+ position from the previous box's bottom edge plus a consistent gap constant.
701
+ - **Define gap constants** at the top of the script (e.g., `GAP_SMALL = 1.5`, `GAP_BRANCH = 2.2`).
702
+ - **Avoid magic number padding** in arrow endpoints — use named constants.
703
+
704
+ **D2 approach (recommended):**
705
+ ```bash
706
+ d2 --layout elk --theme 0 flow.d2 output.svg
707
+ # Then: open SVG in Figma → grid-snap → font swap → export PDF
708
+ ```
709
+
710
+ **Caption ↔ flow-SSOT reconciliation (before Step 5 Export).** The flow-diagram config (the YAML/script that `generate_flow_diagram.R` consumes) is the single source of truth for participant counts. A hand-written Figure 1 caption drifts from it whenever the cohort is re-locked but the caption is not — the classic "caption says n = 1,284 analytic, diagram box says n = 998" defect, which surfaces only at submission. Re-derive the caption counts from the flow config and reconcile:
711
+
712
+ ```bash
713
+ python3 ${CLAUDE_SKILL_DIR}/scripts/derive_figure_legend_counts.py \
714
+ --flow-config figures/figure1_strobe_graphviz.yaml \
715
+ --manuscript manuscript/index.qmd \
716
+ --out qc/figure_legend_counts.json --strict
717
+ ```
718
+
719
+ Any `n = N` in the caption that is not a box count in the flow config is a `MISMATCH` (stale caption) — update the caption from the config, never the reverse. This pairs with numerical-safety's "re-derive prose counts every revision" rule and with `/sync-submission`'s cross-document N checks. (The reconciler is stdlib-only and parses the config as text, so it works regardless of the flow tool.)
720
+
721
+ ### Calibration Plot
722
+
723
+ - 45-degree reference line (perfect calibration).
724
+ - Grouped observed vs predicted with error bars.
725
+ - Report Hosmer-Lemeshow statistic and Brier score in annotation.
726
+ - Optional: histogram of predicted probabilities at the bottom.
727
+
728
+ ### Kaplan-Meier Curve
729
+
730
+ - Step function with distinct colors per group.
731
+ - Censoring marks as small vertical ticks.
732
+ - Number-at-risk table below the plot (aligned with x-axis ticks).
733
+ - Log-rank p-value in annotation.
734
+ - Median survival with 95% CI if applicable.
735
+
736
+ ### Bland-Altman Plot
737
+
738
+ - X-axis: mean of two measurements.
739
+ - Y-axis: difference between measurements.
740
+ - Horizontal lines: mean difference (solid), +/-1.96 SD (dashed).
741
+ - Annotate the mean diff and limits of agreement values.
742
+ - Optional: proportional bias check (regression line through points).
743
+
744
+ ### Confusion Matrix
745
+
746
+ - Heatmap with both counts and percentages in each cell.
747
+ - Row-normalized percentages preferred (sensitivity per class).
748
+ - Clear axis labels: "Predicted" (x) and "Actual" (y).
749
+ - Use sequential colormap (Blues or Greens), not diverging.
750
+
751
+ ### Box/Violin Plot
752
+
753
+ - Show individual data points (jittered) overlaid on box or violin.
754
+ - Mark median and mean distinctly.
755
+ - Statistical annotation brackets with significance stars.
756
+ - Stars: * p<0.05, ** p<0.01, *** p<0.001, ns for non-significant.
757
+
758
+ ### Pipeline Diagram
759
+
760
+ - Horizontal or vertical flow of processing stages.
761
+ - Boxes: rounded rectangles with stage name and brief description.
762
+ - Arrows: labeled with data counts or transformation type.
763
+ - Color-code stages by category (data collection, processing, validation).
764
+ - Keep text minimal; use supplementary caption for details.
765
+
766
+ ### Bar Chart
767
+
768
+ - Error bars: 95% CI (preferred) or SD, stated in caption.
769
+ - Individual data points overlaid if n < 30.
770
+ - Horizontal orientation for many categories.
771
+ - Sort by value (descending) unless order is meaningful.
772
+
773
+ ### Heatmap
774
+
775
+ - Annotate cells with values.
776
+ - Use sequential colormap for correlation (coolwarm diverging if centered at zero).
777
+ - Mask diagonal for correlation matrices.
778
+ - Cluster rows/columns if appropriate.
779
+
780
+ ---
781
+
782
+ ## Style Rules
783
+
784
+ ### Colors
785
+
786
+ **Wong colorblind-safe palette (default):**
787
+ ```python
788
+ WONG = ['#000000', '#E69F00', '#56B4E9', '#009E73',
789
+ '#F0E442', '#0072B2', '#D55E00', '#CC79A7']
790
+ ```
791
+
792
+ **Sequential palettes (for heatmaps):**
793
+ - Positive values: `Blues` or `Greens`
794
+ - Diverging (centered at 0): `coolwarm` or `RdBu_r`
795
+ - Agreement matrices: `YlOrRd`
796
+
797
+ **Rules:**
798
+ - Never use red-green only distinctions.
799
+ - Use line style (solid, dashed, dotted) in addition to color for line plots.
800
+ - Use marker shape in addition to color for scatter plots.
801
+
802
+ ### Typography
803
+
804
+ | Element | Font Size | Weight |
805
+ |---------|-----------|--------|
806
+ | Figure title (if any) | 10 pt | Bold |
807
+ | Axis label | 9 pt | Regular |
808
+ | Tick label | 8 pt | Regular |
809
+ | Legend text | 8 pt | Regular |
810
+ | Annotation | 8 pt | Regular |
811
+ | Panel label (A, B, C) | 12 pt | Bold |
812
+
813
+ - Font family: Arial or Helvetica (sans-serif).
814
+ - Panel labels: uppercase bold letter, top-left of each panel.
815
+
816
+ ### Layout
817
+
818
+ - Minimize white space while maintaining readability.
819
+ - Align multi-panel figures on a grid.
820
+ - Consistent axis ranges across comparable panels.
821
+ - No figure titles in the plot itself (title goes in the caption below).
822
+
823
+ ### Statistical Annotations
824
+
825
+ - Significance stars: * p<0.05, ** p<0.01, *** p<0.001
826
+ - Place above comparison brackets.
827
+ - Report exact p-value in the figure legend or caption, not in the plot.
828
+ - For AUC, correlation, or agreement: display in the legend with 95% CI.
829
+
830
+ ---
831
+
832
+ ## Journal Specifications
833
+
834
+ Default dimensions (override from `figure_specs.md` if journal-specific):
835
+
836
+ - **Single column**: 3.5 in (88 mm) width
837
+ - **1.5 column**: 5.0 in (127 mm) width
838
+ - **Double column**: 7.0 in (178 mm) width
839
+ - **Full page**: 7.0 x 9.5 in (178 x 241 mm)
840
+ - **DPI**: 300 minimum for halftone, 600 for line art
841
+ - **File formats**: PDF (vector, preferred) + PNG (300 DPI)
842
+ - **No chartjunk**: no 3D effects, no unnecessary gridlines, no decorative elements, no gradient fills
843
+
844
+ ---
845
+
846
+ ## Multi-Panel Figures
847
+
848
+ For composite figures with multiple panels:
849
+
850
+ ```python
851
+ fig, axes = plt.subplots(nrows, ncols, figsize=(width, height))
852
+
853
+ # Label each panel
854
+ for ax, label in zip(axes.flat, 'ABCDEFGH'):
855
+ ax.text(-0.15, 1.05, label, transform=ax.transAxes,
856
+ fontsize=12, fontweight='bold', va='top')
857
+ ```
858
+
859
+ Common layouts:
860
+ - 2-panel horizontal: `figsize=(7.0, 3.5)`, 1 row x 2 cols
861
+ - 2-panel vertical: `figsize=(3.5, 7.0)`, 2 rows x 1 col
862
+ - 2x2 grid: `figsize=(7.0, 7.0)`, 2 rows x 2 cols
863
+ - 3-panel: `figsize=(7.0, 3.0)`, 1 row x 3 cols
864
+
865
+ Use `plt.tight_layout()` or `fig.subplots_adjust()` for spacing.
866
+
867
+ ---
868
+
869
+ ## Caption Writing
870
+
871
+ After generating each figure, draft a caption following these rules:
872
+
873
+ 1. **First sentence**: Describe what the figure shows (type + key finding).
874
+ 2. **Subsequent sentences**: Define abbreviations, explain symbols, state sample sizes.
875
+ 3. **Statistical details**: Note the test used and significance threshold.
876
+ 4. **Format**: "Figure {N}. {Caption text}" -- no bold, no title case.
877
+
878
+ Example:
879
+ > Figure 1. Receiver operating characteristic curves comparing the diagnostic performance of
880
+ > the multi-agent pipeline (blue) and single-agent baseline (orange) for identifying incorrect
881
+ > Anki flashcard content. The area under the curve was 0.92 (95% CI: 0.89-0.95) for the
882
+ > multi-agent pipeline and 0.84 (95% CI: 0.80-0.88) for the single-agent baseline (DeLong
883
+ > test, p = 0.003). The dashed diagonal line represents chance performance.
884
+
885
+ ---
886
+
887
+ ## Skill Interactions
888
+
889
+ | When | Call | Purpose |
890
+ |------|------|---------|
891
+ | Need statistical values for plot | `/analyze-stats` | Get computed values (AUC, CI, p-values) |
892
+ | Flow diagram for manuscript | `/write-paper` Phase 2 | Coordinate with Tables & Figures plan |
893
+ | Caption review | `/write-paper` Phase 7 | Final polish pass |
894
+
895
+ ---
896
+
897
+ ## Error Handling
898
+
899
+ - If data is insufficient for the requested figure type, explain what is needed and ask the user.
900
+ - If a figure exceeds journal dimension limits, resize and report the adjustment.
901
+ - If text overlaps in the figure, try `tight_layout()`, reduce font size, or adjust spacing.
902
+ - Never fabricate data points. If sample data is needed for a template demo, explicitly label it as "example data."
903
+
904
+ ## CLI Tools Available
905
+
906
+ ImageMagick, Ghostscript, FFmpeg are installed and can be used for post-processing:
907
+
908
+ ```bash
909
+ # Figure DPI/format conversion for journal submission
910
+ magick input.png -density 300 -units PixelsPerInch output.tiff
911
+ magick input.png -resize 1200x -quality 95 output.jpg
912
+
913
+ # CMYK conversion (some print journals require this)
914
+ magick input.png -colorspace CMYK output.tiff
915
+
916
+ # Multi-panel figure assembly (A/B/C/D panels)
917
+ magick montage panelA.png panelB.png panelC.png panelD.png \
918
+ -tile 2x2 -geometry +10+10 -density 300 combined.png
919
+
920
+ # Animated figure (GIF from frame sequence)
921
+ ffmpeg -framerate 2 -i frame_%03d.png -vf "scale=800:-1" output.gif
922
+
923
+ # Video from figure sequence (for supplementary materials)
924
+ ffmpeg -framerate 1 -i slide_%03d.png -c:v libx264 -pix_fmt yuv420p supplementary_video.mp4
925
+ ```
926
+
927
+ ## AI Image Generation (Optional)
928
+
929
+ AI illustration is a **supplementary option**, not a requirement. Visual abstracts and figures
930
+ can be completed without any API key using study figures and free illustration libraries.
931
+
932
+ If `GEMINI_API_KEY` is set, the `generate_image.py` script can generate illustrations:
933
+ ```bash
934
+ python ${CLAUDE_SKILL_DIR}/scripts/generate_image.py \
935
+ "Clean medical illustration of a CT-guided lung biopsy procedure, \
936
+ flat vector style, white background, no text" \
937
+ --output output.png --aspect 16:9
938
+ ```
939
+
940
+ Use for: procedural schematics, anatomical illustrations, pipeline diagrams.
941
+ Always review AI output against the AI-Generated Figure Warning section above.
942
+
943
+ If `GEMINI_API_KEY` is not set, guide the user to free illustration resources:
944
+ see `${CLAUDE_SKILL_DIR}/references/medical_illustration_sources.md`.
945
+
946
+ ## Language
947
+
948
+ - Code and figure text: English
949
+ - Communication with user: Match user's preferred language
950
+ - Medical terms: English only
951
+
952
+ ## Anti-Hallucination
953
+
954
+ - **Never fabricate references.** All citations must be verified via `/search-lit` with confirmed DOI or PMID. Mark unverified references as `[UNVERIFIED - NEEDS MANUAL CHECK]`.
955
+ - **Never invent clinical definitions, diagnostic criteria, or guideline recommendations.** If uncertain, flag with `[VERIFY]` and ask the user.
956
+ - **Never fabricate numerical results** — compliance percentages, scores, effect sizes, or sample sizes must come from actual data or analysis output.
957
+ - If a reporting guideline item, journal policy, or clinical standard is uncertain, state the uncertainty rather than guessing.