skills/28-maxwell2732-paper-replicate-agent-demo/dot-claude/skills/replicate-paper/SKILL.md
# Skill: /replicate-paper **Trigger:** `/replicate-paper [paper.pdf] [data.csv|dta]` or "replicate this paper" **Purpose:** Full 6-phase autonomous replication of a biomedical/epidemiology paper using UK Biobank or similar data. Produces Python and R scripts plus a polished validation report. --- ## Invocation ``` /replicate-paper papers/AuthorYear.pdf data/ukb_extract.csv ``` Or with just: "replicate this paper" (Claude will ask for paths if not provided). --- ## The 6-Phase Pipeline #
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research skills/28-maxwell2732-paper-replicate-agent-demo/dot-claude/skills/replicate-paperInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Trigger: /replicate-paper [paper.pdf] [data.csv|dta] or "replicate this paper"
Purpose: Full 6-phase autonomous replication of a biomedical/epidemiology paper using UK Biobank or similar data. Produces Python and R scripts plus a polished validation report.
/replicate-paper papers/AuthorYear.pdf data/ukb_extract.csv
Or with just: "replicate this paper" (Claude will ask for paths if not provided).
Goal: Understand exactly what needs to be replicated.
quality_reports/[paper_name]_replication_targets.mdOutput: quality_reports/[paper_name]_replication_targets.md
Goal: Confirm what we can and cannot replicate given the available data.
data/[filename])quality_reports/[paper_name]_data_audit.mdOutput: quality_reports/[paper_name]_data_audit.md
Goal: Map the paper's methods to our dataset before writing a single line of code.
quality_reports/[paper_name]_variable_map.mdOutput: quality_reports/[paper_name]_variable_map.md
Goal: Produce clean, reproducible Python and R scripts that implement the paper's analysis.
Rules:
python-code-conventions.md and r-code-conventions.md exactlyrandom.seed(YYYYMMDD) + numpy.random.seed(YYYYMMDD) (Python); set.seed(YYYYMMDD) (R)pathlib.Path for all Python paths; here::here() for all R pathsreplication-protocol.md translation pitfall tablesPython script: replications/[paper_name]/python/replicate.py
Structure:
# Replication: [Paper Author (Year)]
# Date: YYYY-MM-DD
# Original: Stata / R
# Python version: X.Y.Z
# Key packages: pandas X.X, statsmodels X.X, lifelines X.X
from pathlib import Path
import random
import numpy as np
import pandas as pd
# ... other imports
random.seed(YYYYMMDD)
np.random.seed(YYYYMMDD)
DATA_DIR = Path(__file__).parents[3] / "data"
RESULTS_DIR = Path(__file__).parent / "results"
RESULTS_DIR.mkdir(exist_ok=True)
# --- 1. Load Data ---
# --- 2. Sample Construction ---
# --- 3. Model Fitting ---
# --- 4. Save Results ---
R script: replications/[paper_name]/R/replicate.R
Structure:
# Replication: [Paper Author (Year)]
# Date: YYYY-MM-DD
# Original: Stata / Python
# R version: X.Y.Z
# Key packages: survival X.X, fixest X.X
library(here)
library(tidyverse)
library(survival)
# ... other packages
set.seed(YYYYMMDD)
data_dir <- here("data")
results_dir <- here("replications", "[paper_name]", "R", "results")
dir.create(results_dir, recursive = TRUE, showWarnings = FALSE)
# --- 1. Load Data ---
# --- 2. Sample Construction ---
# --- 3. Model Fitting ---
# --- 4. Save Results ---
Outputs:
replications/[paper_name]/python/replicate.pyreplications/[paper_name]/R/replicate.Rreplications/[paper_name]/python/results/ (parquet/pkl files)replications/[paper_name]/R/results/ (rds files)Goal: Run both scripts and compare results to gold standard targets.
python replications/[paper_name]/python/replicate.pyRscript replications/[paper_name]/R/replicate.Rreplication-protocol.md:
replications/[paper_name]/validation_report.mdOutput: replications/[paper_name]/validation_report.md
Goal: Produce a polished, self-contained replication report.
Report structure:
# Replication Report: [Paper Author (Year)]
**Date:** [YYYY-MM-DD]
**Replicator:** Claude (domain-reviewer verified)
## Paper Summary
[1 paragraph: research question, population, exposure, outcome, key finding]
## Methods Summary
[Bullet list: sample, exclusions, covariates, model, SEs, software]
## Data
[Bullet list: our dataset, N after exclusions, any discrepancies vs. paper sample]
## Results Comparison
| Target | Table/Fig | Paper Value | Our Value (Python) | Our Value (R) | Diff | Status |
|--------|-----------|-------------|-------------------|---------------|------|--------|
## Discrepancies
[Each discrepancy: what, investigated how, resolved or not]
## Corrective Steps Taken
[Any adjustments made during validation and why]
## Verdict
**[REPLICATED / PARTIAL / FAILED]**
- Targets matched: N / Total
- Remaining discrepancies: [list or "none"]
## Reproducibility
- Python: X.Y.Z | pandas X.X | statsmodels X.X | lifelines X.X
- R: X.Y.Z | survival X.X | fixest X.X
- Data: [filename, UKB application ID if applicable]
- Seed: YYYYMMDD
Save to: reports/[paper_name]_replication_report.md
After saving: run domain-reviewer agent on the report.
After Phase 6, score the output. Minimum 80/100 to commit.
Auto-commit if score >= 80:
git add replications/[paper_name]/ reports/[paper_name]_replication_report.md quality_reports/[paper_name]_*.md
git commit -m "Replicate [Paper Author (Year)] -- [VERDICT]: N/Total targets matched"
| Failure | Recovery | |---------|---------| | Script syntax error | Fix before proceeding | | N mismatch > 5% | Stop, audit inclusion/exclusion criteria | | All point estimates off by same factor | Check unit conversion (HR vs. log-HR, OR vs. log-OR) | | SEs systematically too large | Check clustering level | | Cannot install package | Document, note in report, use closest alternative | | Data variable missing | Document gap; attempt proxy; flag as ASSUMED in report |
development
Conduct rigorous thematic analysis (TA) of qualitative data following Braun and Clarke's (2006) six-phase framework. Use whenever the user mentions 'thematic analysis', 'TA', 'Braun and Clarke', 'qualitative coding', 'identifying themes', or asks for help analysing interviews, focus groups, open-ended survey responses, or transcripts to identify patterns. Also trigger for questions about inductive vs theoretical coding, semantic vs latent themes, essentialist vs constructionist epistemology, building a thematic map, or writing up a qualitative findings section. Covers all six phases, the four upfront analytic decisions, the 15-point quality checklist, and the five common pitfalls. Produces a Word document write-up and an annotated thematic map. Does NOT cover IPA, grounded theory, discourse analysis, conversation analysis, or narrative analysis — use a different method for those.
development
Guide users through writing a systematic literature review (SLR) following the PRISMA 2020 framework. Use this skill whenever the user mentions 'systematic review', 'systematic literature review', 'SLR', 'PRISMA', 'PRISMA 2020', 'PRISMA flow diagram', 'PRISMA checklist', or asks for help writing, structuring, or auditing a literature review that follows reporting guidelines. Also trigger when the user asks about inclusion/exclusion criteria for a review, search strategies for databases like Scopus/WoS/PubMed, study selection processes, risk of bias assessment, or narrative synthesis for a review paper. This skill covers the full PRISMA 2020 checklist (27 items), produces a Word document manuscript in strict journal article format, generates an annotated PRISMA flow diagram, and enforces APA 7th Edition referencing throughout. It does NOT cover meta-analysis or statistical pooling. By Chuah Kee Man.
testing
Performs placebo-in-time sensitivity analysis with hierarchical null model and optional Bayesian assurance. Use when checking model robustness, verifying lack of pre-intervention effects, or estimating study power.
data-ai
Fit, summarize, plot, and interpret a chosen CausalPy experiment. Use after the causal method has been selected, including when configuring PyMC/sklearn models and scale-aware custom priors.