Claude Skill

replicate-study

Replicate an existing cohort study's methodology on a different database. Extracts study design from a source paper, maps variables to the target DB via harmonization table, generates analysis code, and produces a replication difference report.

LLM Mart · 0 points · 3 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download aperivue-medsci-skills-skills_replicate-study-815765c.zip · 15 KB
Part of aperivue/medsci-skills — 47 skills

Install

skills CLI npx skills add https://github.com/Aperivue/medsci-skills/tree/main/skills/replicate-study
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install aperivue-medsci-skills@llmmart
Git git clone https://github.com/Aperivue/medsci-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole aperivue/medsci-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Replicate Study Skill

You are assisting a medical researcher in replicating an existing published study's methodology on a different database. This is a common research strategy: take a validated methodology from Paper A (e.g., NHIS cohort study) and apply it to Database B (e.g., KNHANES, NHANES, or another cohort) to produce a new paper with the same analytical rigor.

When to Use

  • Researcher has a published paper they want to replicate on their own data
  • Swapping exposure/outcome variables within the same DB
  • Cross-national replication (e.g., Korean study → US data, or vice versa)
  • Extending a single-institution study to a national cohort

Inputs

  1. Source paper: PDF, DOI, or markdown of the paper to replicate
  2. Target database path: CSV/SAS data file(s) to use
  3. Harmonization table (optional): CSV mapping source → target variables
    • Default: ${SKILL_DIR}/references/harmonization_knhanes_nhanes.csv (if KNHANES↔NHANES)

Reference Files

  • ${SKILL_DIR}/references/methodology_extraction_template.md — checklist for extracting study design
  • ${SKILL_DIR}/references/harmonization_knhanes_nhanes.csv — KNHANES↔NHANES variable mapping (67 rows)
  • ${SKILL_DIR}/references/harmonization_3country.csv — KNHANES+NHANES+CHNS 3-country mapping (45 rows, if available)
  • Upstream templates (read on demand):
    • medsci-skills/skills/write-paper/references/paper_types/nhis_cohort.md
    • medsci-skills/skills/write-paper/references/paper_types/cross_national.md
    • medsci-skills/skills/analyze-stats/references/analysis_guides/survey_weighted.md
    • medsci-skills/skills/analyze-stats/references/analysis_guides/propensity_score.md

Workflow

Phase 1: Source Paper Analysis

  1. Read the source paper (PDF → text, or markdown).
  2. Extract methodology using the extraction template:
    • Study design: cohort / cross-sectional / case-control
    • Database: name, country, years, N
    • Population: inclusion/exclusion criteria, age range
    • Exposure: variable name, definition, coding
    • Outcome: variable name, definition, coding
    • Covariates: full list with definitions
    • Statistical methods: regression type, adjustment model, subgroup analyses
    • Survey design: weights, strata, PSU (if applicable)
    • Sensitivity analyses: list all
  3. Output: structured extraction summary for user review.

Phase 2: Variable Mapping

  1. Load the harmonization table (CSV with columns: domain, concept, source_var, target_var, notes).
  2. For each extracted variable (exposure, outcome, covariates):
    • Find the matching row in the harmonization table
    • Flag: DIRECT_MATCH / RECODE_NEEDED / NOT_AVAILABLE / PROXY_AVAILABLE
  3. Generate a mapping report:
    • Green: directly available (no recoding)
    • Yellow: available but needs recoding (document transformation)
    • Red: not available in target DB (propose proxy or exclusion)
  4. Output: variable mapping table for user approval.

Phase 3: Code Generation

  1. Generate analysis code (Python with pandas + R via subprocess for survey-weighted):
    1. Data loading & cleaning: read target DB, apply inclusion/exclusion
    2. Variable derivation: recode variables per mapping table
    3. Survey design setup: define svydesign object (strata, PSU, weights)
    4. Table 1: demographics by exposure group (weighted)
    5. Main analysis: replicate the primary model (logistic/Cox/linear regression)
    6. Subgroup analyses: if specified in source paper
    7. Sensitivity analyses: replicate all listed in source paper
  2. Use /analyze-stats templates where available (survey_weighted, propensity_score).
  3. All code must be self-contained and reproducible.

Phase 4: Difference Report

Generate a structured difference report documenting:

Section Content
Study Design Same / Modified (explain)
Database Source DB → Target DB (N, years, country)
Population Inclusion/exclusion differences
Variable Mapping Full mapping table with match status
Unavailable Variables What's missing and how handled
Methodological Differences Any forced changes (e.g., BMI cutoffs, LDL calculation)
Expected Differences Why results may differ (population, measurement, cultural)

Save as replication_report.md in the working directory.

Phase 5: Validation Checklist

Before reporting completion, verify:

  • All source paper covariates accounted for (mapped, proxied, or documented as missing)
  • Survey weights correctly applied (NEVER analyze unweighted if source used weights)
  • Obesity/BMI cutoffs match target population standards (Asian vs WHO)
  • Fasting requirements matched (fasting glucose, lipids)
  • Age restrictions applied correctly
  • Code runs without errors on target data
  • Output tables match source paper structure

Critical Rules

  1. Never pool data across surveys. Analyze each country's data with its own survey design.
  2. Document every deviation from the source methodology in the difference report.
  3. Asian BMI cutoffs (≥25 for obesity) when analyzing Korean data, even if source used WHO (≥30).
  4. LDL calculation: note if source used direct measurement vs Friedewald.
  5. Weighted analysis is mandatory for KNHANES/NHANES — never run unweighted models.
  6. IRB: note that KNHANES/NHANES are de-identified public data (IRB exempt or waived).
  7. Outdated source definitions: if the source paper used a pre-2023 definition that has since been superseded (e.g., NAFLD → MASLD 2023, CKD-EPI 2009 → 2021 race-free), call /define-variables to cross-check whether to mirror the legacy definition (pure replication) or upgrade to current (extension). Document the choice explicitly in the difference report.

Output Files

{working_dir}/
├── replication_report.md     — Structured difference report
├── variable_mapping.csv      — Variable mapping table with match status
├── analysis_code.py          — Main analysis script (Python + R calls)
├── analysis_code.R           — R script for survey-weighted analysis
└── results/
    ├── table1.csv            — Demographics table
    ├── main_results.csv      — Primary analysis results
    └── subgroup_results.csv  — Subgroup analysis results (if applicable)

Example Invocation

/replicate-study

Source paper: Joo 2026 (Psychiatry Research) — depression/diabetes cross-national
Target DB: /path/to/knhanes/HN18.csv
Harmonization: /path/to/harmonization_knhanes_nhanes.csv

Anti-Hallucination

  • Never fabricate variable names, dataset column names, or variable codings. If a variable mapping is uncertain, output [VERIFY: variable_name] and ask the user to confirm against the data dictionary.
  • Never fabricate statistical results — no invented p-values, effect sizes, confidence intervals, or sample sizes. All numbers must come from executed code output.
  • Never generate references from memory. Use /search-lit for all citations.
  • If a function, package, or API does not exist or you are unsure, say so explicitly rather than guessing.
Files (medsci-skills)
  • references
    • harmonization_3country.csv 11 KB · in bundle
    • harmonization_knhanes_nhanes.csv 10.4 KB · in bundle
    • methodology_extraction_template.md 3.1 KB
      # Methodology Extraction Template
      
      Use this checklist to systematically extract a source paper's methodology for replication.
      
      ## 1. Study Overview
      
      | Field | Value |
      |-------|-------|
      | Title | |
      | Authors | |
      | Journal / Year | |
      | DOI | |
      | Study type | cohort / cross-sectional / case-control / other |
      | Design variant | emulated target trial / standard / trend / composite |
      
      ## 2. Database
      
      | Field | Value |
      |-------|-------|
      | Database name | |
      | Country | |
      | Data years | |
      | Total N (before exclusions) | |
      | Final analytic N | |
      | Population-based? | yes / no |
      | Survey design? | yes (complex) / no |
      | Weights variable | |
      | Strata variable | |
      | PSU/cluster variable | |
      
      ## 3. Study Population
      
      ### Inclusion Criteria
      - [ ] Age range: 
      - [ ] Sex: both / male / female
      - [ ] Fasting: required (≥N hours) / not required
      - [ ] Exam participation: required / not required
      - [ ] Other: 
      
      ### Exclusion Criteria
      - [ ] Missing key variables: 
      - [ ] Pregnant women: excluded / included
      - [ ] Prior disease: 
      - [ ] Age outliers: 
      - [ ] Other: 
      
      ## 4. Exposure Variable
      
      | Field | Value |
      |-------|-------|
      | Concept | |
      | Variable name(s) | |
      | Definition | |
      | Coding | binary / categorical / continuous |
      | Categories | |
      | Source (questionnaire/lab/exam) | |
      
      ## 5. Outcome Variable
      
      | Field | Value |
      |-------|-------|
      | Concept | |
      | Variable name(s) | |
      | Definition | |
      | Coding | binary / categorical / continuous |
      | Source (questionnaire/lab/exam) | |
      | For composite outcomes, list components: | |
      
      ## 6. Covariates
      
      List ALL covariates used in any model:
      
      | # | Covariate | Definition | Variable(s) | Coding | Model(s) |
      |---|-----------|------------|-------------|--------|----------|
      | 1 | Age | | | continuous / categorical | all |
      | 2 | Sex | | | binary | all |
      | 3 | | | | | |
      
      ## 7. Statistical Methods
      
      ### Primary Analysis
      | Field | Value |
      |-------|-------|
      | Model type | logistic / Cox / linear / Poisson / other |
      | Dependent variable | |
      | Key independent variable | |
      | Adjustment strategy | sequential (Model 1/2/3) / full / stepwise |
      
      ### Model Building (if sequential)
      | Model | Covariates |
      |-------|-----------|
      | Model 1 (unadjusted or age/sex) | |
      | Model 2 (+ sociodemographic) | |
      | Model 3 (+ clinical/behavioral) | |
      
      ### Effect Measure
      - OR / aOR / HR / aHR / PR / β / wOR
      - 95% CI reported: yes / no
      - P-value threshold: 
      
      ### Subgroup Analyses
      | Subgroup variable | Categories |
      |-------------------|-----------|
      | | |
      
      ### Sensitivity Analyses
      | # | Description |
      |---|-------------|
      | 1 | |
      | 2 | |
      
      ## 8. Key Results to Replicate
      
      | Analysis | Effect (95% CI) | P-value | Note |
      |----------|----------------|---------|------|
      | Primary | | | |
      | Subgroup 1 | | | |
      | Sensitivity 1 | | | |
      
      ## 9. Tables/Figures to Replicate
      
      | # | Type | Description |
      |---|------|-------------|
      | Table 1 | Demographics | Baseline characteristics by exposure |
      | Table 2 | Main results | OR/HR with sequential models |
      | | | |
      
      ## 10. IRB / Ethics
      
      | Field | Value |
      |-------|-------|
      | Original IRB | |
      | Target DB IRB status | exempt (de-identified public data) / needs new IRB |
      | Informed consent | waived (secondary data) |
      
  • SKILL.md 7.6 KB
    ---
    name: replicate-study
    description: Replicate an existing cohort study's methodology on a different database. Extracts study design from a source paper, maps variables to the target DB via harmonization table, generates analysis code, and produces a replication difference report.
    triggers: replicate study, replicate paper, 논문 복제, 방법론 복제, reproduce study, replication, 다른 DB로, swap database, 데이터 교체
    tools: Read, Write, Edit, Bash, Grep, Glob
    model: opus
    ---
    
    # Replicate Study Skill
    
    You are assisting a medical researcher in replicating an existing published study's methodology
    on a different database. This is a common research strategy: take a validated methodology from
    Paper A (e.g., NHIS cohort study) and apply it to Database B (e.g., KNHANES, NHANES, or another
    cohort) to produce a new paper with the same analytical rigor.
    
    ## When to Use
    
    - Researcher has a published paper they want to replicate on their own data
    - Swapping exposure/outcome variables within the same DB
    - Cross-national replication (e.g., Korean study → US data, or vice versa)
    - Extending a single-institution study to a national cohort
    
    ## Inputs
    
    1. **Source paper**: PDF, DOI, or markdown of the paper to replicate
    2. **Target database path**: CSV/SAS data file(s) to use
    3. **Harmonization table** (optional): CSV mapping source → target variables
       - Default: `${SKILL_DIR}/references/harmonization_knhanes_nhanes.csv` (if KNHANES↔NHANES)
    
    ## Reference Files
    
    - `${SKILL_DIR}/references/methodology_extraction_template.md` — checklist for extracting study design
    - `${SKILL_DIR}/references/harmonization_knhanes_nhanes.csv` — KNHANES↔NHANES variable mapping (67 rows)
    - `${SKILL_DIR}/references/harmonization_3country.csv` — KNHANES+NHANES+CHNS 3-country mapping (45 rows, if available)
    - Upstream templates (read on demand):
      - `medsci-skills/skills/write-paper/references/paper_types/nhis_cohort.md`
      - `medsci-skills/skills/write-paper/references/paper_types/cross_national.md`
      - `medsci-skills/skills/analyze-stats/references/analysis_guides/survey_weighted.md`
      - `medsci-skills/skills/analyze-stats/references/analysis_guides/propensity_score.md`
    
    ## Workflow
    
    ### Phase 1: Source Paper Analysis
    
    1. Read the source paper (PDF → text, or markdown).
    2. Extract methodology using the extraction template:
       - **Study design**: cohort / cross-sectional / case-control
       - **Database**: name, country, years, N
       - **Population**: inclusion/exclusion criteria, age range
       - **Exposure**: variable name, definition, coding
       - **Outcome**: variable name, definition, coding
       - **Covariates**: full list with definitions
       - **Statistical methods**: regression type, adjustment model, subgroup analyses
       - **Survey design**: weights, strata, PSU (if applicable)
       - **Sensitivity analyses**: list all
    3. Output: structured extraction summary for user review.
    
    ### Phase 2: Variable Mapping
    
    1. Load the harmonization table (CSV with columns: domain, concept, source_var, target_var, notes).
    2. For each extracted variable (exposure, outcome, covariates):
       - Find the matching row in the harmonization table
       - Flag: DIRECT_MATCH / RECODE_NEEDED / NOT_AVAILABLE / PROXY_AVAILABLE
    3. Generate a **mapping report**:
       - Green: directly available (no recoding)
       - Yellow: available but needs recoding (document transformation)
       - Red: not available in target DB (propose proxy or exclusion)
    4. Output: variable mapping table for user approval.
    
    ### Phase 3: Code Generation
    
    1. Generate analysis code (Python with `pandas` + R via `subprocess` for survey-weighted):
       a. **Data loading & cleaning**: read target DB, apply inclusion/exclusion
       b. **Variable derivation**: recode variables per mapping table
       c. **Survey design setup**: define svydesign object (strata, PSU, weights)
       d. **Table 1**: demographics by exposure group (weighted)
       e. **Main analysis**: replicate the primary model (logistic/Cox/linear regression)
       f. **Subgroup analyses**: if specified in source paper
       g. **Sensitivity analyses**: replicate all listed in source paper
    2. Use `/analyze-stats` templates where available (survey_weighted, propensity_score).
    3. All code must be self-contained and reproducible.
    
    ### Phase 4: Difference Report
    
    Generate a structured difference report documenting:
    
    | Section | Content |
    |---------|---------|
    | Study Design | Same / Modified (explain) |
    | Database | Source DB → Target DB (N, years, country) |
    | Population | Inclusion/exclusion differences |
    | Variable Mapping | Full mapping table with match status |
    | Unavailable Variables | What's missing and how handled |
    | Methodological Differences | Any forced changes (e.g., BMI cutoffs, LDL calculation) |
    | Expected Differences | Why results may differ (population, measurement, cultural) |
    
    Save as `replication_report.md` in the working directory.
    
    ### Phase 5: Validation Checklist
    
    Before reporting completion, verify:
    
    - [ ] All source paper covariates accounted for (mapped, proxied, or documented as missing)
    - [ ] Survey weights correctly applied (NEVER analyze unweighted if source used weights)
    - [ ] Obesity/BMI cutoffs match target population standards (Asian vs WHO)
    - [ ] Fasting requirements matched (fasting glucose, lipids)
    - [ ] Age restrictions applied correctly
    - [ ] Code runs without errors on target data
    - [ ] Output tables match source paper structure
    
    ## Critical Rules
    
    1. **Never pool data across surveys**. Analyze each country's data with its own survey design.
    2. **Document every deviation** from the source methodology in the difference report.
    3. **Asian BMI cutoffs** (≥25 for obesity) when analyzing Korean data, even if source used WHO (≥30).
    4. **LDL calculation**: note if source used direct measurement vs Friedewald.
    5. **Weighted analysis is mandatory** for KNHANES/NHANES — never run unweighted models.
    6. **IRB**: note that KNHANES/NHANES are de-identified public data (IRB exempt or waived).
    7. **Outdated source definitions**: if the source paper used a pre-2023 definition that has since been superseded (e.g., NAFLD → MASLD 2023, CKD-EPI 2009 → 2021 race-free), call `/define-variables` to cross-check whether to mirror the legacy definition (pure replication) or upgrade to current (extension). Document the choice explicitly in the difference report.
    
    ## Output Files
    
    ```
    {working_dir}/
    ├── replication_report.md     — Structured difference report
    ├── variable_mapping.csv      — Variable mapping table with match status
    ├── analysis_code.py          — Main analysis script (Python + R calls)
    ├── analysis_code.R           — R script for survey-weighted analysis
    └── results/
        ├── table1.csv            — Demographics table
        ├── main_results.csv      — Primary analysis results
        └── subgroup_results.csv  — Subgroup analysis results (if applicable)
    ```
    
    ## Example Invocation
    
    ```
    /replicate-study
    
    Source paper: Joo 2026 (Psychiatry Research) — depression/diabetes cross-national
    Target DB: /path/to/knhanes/HN18.csv
    Harmonization: /path/to/harmonization_knhanes_nhanes.csv
    ```
    
    ## Anti-Hallucination
    
    - **Never fabricate variable names, dataset column names, or variable codings.** If a variable mapping is uncertain, output `[VERIFY: variable_name]` and ask the user to confirm against the data dictionary.
    - **Never fabricate statistical results** — no invented p-values, effect sizes, confidence intervals, or sample sizes. All numbers must come from executed code output.
    - **Never generate references from memory.** Use `/search-lit` for all citations.
    - If a function, package, or API does not exist or you are unsure, say so explicitly rather than guessing.
    
  • skill.yml 1.4 KB
    schema_version: 2
    name: replicate-study
    layer: B
    owner_domain: study_replication
    maturity: official
    
    when_to_use: "Replicate an existing cohort study's methodology on a different database via a variable harmonization table and a replication difference report."
    when_NOT_to_use: "Comparing countries in parallel (use cross-national); a fresh single analysis (use analyze-stats)."
    
    inputs:
      - "source study paper"
      - "target database"
      - "variable mapping"
    outputs:
      - "replication analysis code"
      - "replication difference report"
    side_effects:
      - writes_project_artifacts
      - executes_analysis_code
    downstream_consumers:
      - analyze-stats
      - self-review
    forbidden_actions:
      - misrepresent_method_deviations_as_identical
      - fabricate_replication_results
    
    # v2.1 quality card
    purpose: "Re-run a published study's method on a new DB and report exactly where target-DB constraints forced deviations."
    safety_boundaries:
      - "Method deviations forced by the target DB are documented in a difference report, not hidden."
      - "Results come from executed code on the target data."
    known_limitations:
      - "Perfect replication is rarely possible; residual method differences remain and are disclosed."
      - "No standalone demo; depends on a faithful variable mapping."
    validation_commands:
      - "execute the replication code and review the difference report"
      - "/self-review"
    evidence_surface: manual_workflow
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related