Help us improve
Share bugs, ideas, or general feedback.
From medsci-presentation
Generates batch analysis scripts from a validated methodology template by swapping exposure/outcome variables for cohort studies. Produces R/Python code + summary matrix.
npx claudepluginhub aperivue/medsci-skills --plugin medsci-literatureHow this skill is triggered — by the user, by Claude, or both
Slash command
/medsci-presentation:batch-cohortopusThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are assisting a medical researcher in generating multiple analysis scripts from a single
Generates publication-ready statistical tables and figures for medical research papers. Supports diagnostic accuracy, survival analysis, regression, propensity score, and repeated measures with Python/R code.
Guides epidemiological study analysis from PECO question design through statistical modeling and publication-ready reporting. Runs Python code for NHANES/UK-Biobank-style cohort, case-control, and cross-sectional analyses.
Share bugs, ideas, or general feedback.
You are assisting a medical researcher in generating multiple analysis scripts from a single validated methodology template, each differing only in the exposure/outcome variable combination. This replicates the "80-person research team" pattern: one PI designs the methodology, and many researchers execute the same approach with different variable swaps.
nhis_cohort, cross_national, survey_weightedexposures: [depression, obesity, smoking]; outcomes: [diabetes, hypertension, CVD]exposure, outcome, (optional) subgroup_vars"all" keyword: generates all pairwise combinations from the listscode_only (just scripts) | execute (run + collect results) | full (code + results + summary)EXPOSURE_VAR: raw variable name in the databaseEXPOSURE_LABEL: human-readable label for tables/figuresEXPOSURE_CODING: how to derive binary/categorical exposureOUTCOME_VAR: raw variable nameOUTCOME_LABEL: human-readable labelOUTCOME_CODING: how to derive binary outcomeFor each exposure and outcome in the combination spec:
HE_glu >= 126 → diabetes = 1)smoking: current/former/never)| # | Exposure | Exposure Coding | Outcome | Outcome Coding | Covariates (adjusted) | Notes |
|---|----------|-----------------|---------|----------------|----------------------|-------|
| 1 | Depression (PHQ≥10) | BP_PHQ sum ≥10 | Diabetes | HE_glu≥126|HbA1c≥6.5|DE1_dg=1 | age,sex,edu,income,smoking,alcohol,obesity,CVD | — |
| 2 | Obesity (BMI≥25) | HE_obe ≥4 | Diabetes | same | age,sex,edu,income,smoking,alcohol,depression,CVD | obesity removed from covariates |
| ... | | | | | | |
For each combination in the matrix:
run_all.R or run_all.sh) that:
future/parallel)execute or full mode)Aggregate all results into a single summary:
Main Results Matrix (summary_matrix.csv):
| Exposure | Outcome | N | Events | Model 1 OR (95% CI) | Model 2 OR (95% CI) | Model 3 OR (95% CI) | p-value | Significant |
|---|---|---|---|---|---|---|---|---|
| Depression | Diabetes | 5,811 | 487 | 2.14 (1.52–3.01) | 1.89 (1.33–2.69) | 1.36 (0.91–2.05) | 0.137 | No |
| Obesity | Diabetes | 5,811 | 487 | 3.45 (2.71–4.39) | 3.38 (2.65–4.32) | 3.12 (2.42–4.02) | <0.001 | Yes |
| ... |
Subgroup Summary (subgroup_matrix.csv): Same format, stratified by subgroup variables.
Heatmap (optional): Visual matrix of effect sizes × significance, exposure on Y-axis, outcome on X-axis.
{working_dir}/batch_{timestamp}/
├── README.md — Batch run summary (N combinations, template used, date)
├── combination_matrix.csv — All exposure/outcome specs with coding
├── template/
│ └── base_template.R — The validated template (frozen copy)
├── scripts/
│ ├── 01_depression_diabetes.R
│ ├── 02_obesity_diabetes.R
│ ├── ...
│ └── run_all.R — Master execution script
├── results/
│ ├── 01_depression_diabetes/
│ │ ├── table1.csv
│ │ ├── main_results.csv
│ │ └── subgroup_results.csv
│ ├── 02_obesity_diabetes/
│ │ └── ...
│ └── ...
├── summary/
│ ├── summary_matrix.csv — Main results across all combinations
│ ├── subgroup_matrix.csv — Subgroup results across all combinations
│ ├── failed_runs.csv — Combinations that failed + error messages
│ └── heatmap.png — Optional effect size × significance visual
└── logs/
└── batch_execution.log — Timing + error log
/analyze-stats code-quality gate (check_generated_code.py --code-dir {batch_dir} --strict) and clear every Major (MISSING_SEED, HARDCODED_DATA_LITERAL, HARDCODED_ABS_PATH, INPLACE_SOURCE_OVERWRITE) before batch execution.When cross_national: true:
| Need | Skill |
|---|---|
| Variable coding lookup | analyze-stats survey_weighted guide |
| Template creation from paper | /replicate-study Phase 1–3 |
| Cross-national paired analysis | /cross-national |
| ICD-10 claims algorithms | analyze-stats nhis_icd10_mapping guide |
| Write manuscript from results | /write-paper (nhis_cohort or cross_national type) |
| Figure generation | /make-figures (forest plot of all combinations) |
/batch-cohort
DB: /path/to/knhanes/HN18.csv
Template: /path/to/validated_analysis.R
Exposures: [depression, obesity, smoking, heavy_drinking, low_income, low_education]
Outcome: diabetes
Mode: full
/batch-cohort
DB Korea: /path/to/knhanes/HN18.csv
DB US: /path/to/nhanes/
Template: cross_national
Exposures: [depression, obesity, smoking]
Outcomes: [diabetes, hypertension, metabolic_syndrome]
cross_national: true
Mode: execute
/batch-cohort
DB: /path/to/nhis_sample_cohort.csv
Template: nhis_cohort
Exposures: [atrial_fibrillation, heart_failure, COPD, CKD]
Outcomes: [all_cause_mortality, cardiovascular_death, stroke]
Mode: code_only
[VERIFY: variable_name] and ask the user to confirm against the data dictionary./search-lit for all citations.