Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Create reproducible research workflows with R and RMarkdown/Quarto
.claude/skills/brycewang-stanford-r-reproducibility-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 130% | 0% |
| case-17 | ✓→✗ | ▼ Worse | 59% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 44% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 94% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 86% | 0% |
A skill for creating fully reproducible research workflows in R using RMarkdown, Quarto, package management with renv, and project organization best practices. Covers literate programming, environment management, automated reporting, and sharing reproducible analyses.
my-research-project/
README.md
my-project.Rproj # RStudio project file
renv.lock # Package versions (managed by renv)
renv/ # renv library directory
data/
raw/ # Untouched original data
processed/ # Cleaned, analysis-ready data
R/
01-clean.R # Data cleaning functions
02-analyze.R # Analysis functions
03-visualize.R # Plotting functions
utils.R # Helper functions
analysis/
main-analysis.Rmd # Primary analysis notebook
supplementary.Rmd # Supplementary analyses
output/
figures/ # Generated plots
tables/ # Generated tables
manuscript.pdf # Compiled document
Makefile # Reproducible build commands1. Raw data is read-only (never modify original data files)
2. All processing steps are scripted (no manual spreadsheet edits)
3. Generated outputs can be deleted and recreated from source
4. Package versions are locked with renv
5. Random seeds are set for all stochastic operations
6. Paths are relative to project root (never absolute)`markdown--- title: "Analysis of Treatment Effects" author: "Jane Smith" date: "`r Sys.Date()`" output: pdf_document: toc: true number_sections: true html_document: toc: true code_folding: hide bibliography: references.bib ---
knitr::opts_chunk$set( echo = TRUE, message = FALSE, warning = FALSE, fig.width = 7, fig.height = 5, dpi = 300 )
library(tidyverse) library(broom)
set.seed(42)
# Introduction
This analysis examines the effect of treatment on outcomes
[@smith2024].
# Methods
df <- read_csv("data/processed/study_data.csv") glimpse(df)
# Results
model <- lm(outcome ~ treatment + age + gender, data = df) tidy(model, conf.int = TRUE)
ggplot(df, aes(x = treatment, y = outcome, fill = treatment)) + geom_boxplot() + theme_minimal() + labs(x = "Group", y = "Outcome Score")
yaml--- title: "Analysis Report" format: html: code-fold: true toc: true pdf: documentclass: article execute: echo: true warning: false ---
Quarto supports R, Python, Julia, and Observable JS in a single document, making it ideal for multilingual research workflows.
r# Initialize renv in your project renv::init() # Install packages as usual install.packages("tidyverse") install.packages("lme4") # Snapshot current package versions renv::snapshot() # Restore environment from lockfile (on a new machine) renv::restore()
pythondef explain_renv() -> dict: """ Explain the renv reproducibility workflow. """ return { "init": "Creates project-local library and renv.lock", "snapshot": ( "Records exact package versions (name, version, source) " "into renv.lock. Commit this file to Git." ), "restore": ( "Installs exact package versions from renv.lock on any machine. " "Collaborators run renv::restore() to match your environment." ), "benefits": [ "Each project has isolated package versions", "No conflicts between projects", "Exact reproducibility months or years later", "renv.lock is a text file that diffs cleanly in Git" ] }
makefile# Makefile for reproducible analysis all: output/manuscript.pdf data/processed/clean_data.csv: data/raw/study_data.csv R/01-clean.R Rscript R/01-clean.R output/figures/figure1.pdf: data/processed/clean_data.csv R/03-visualize.R Rscript R/03-visualize.R output/manuscript.pdf: analysis/main-analysis.Rmd data/processed/clean_data.csv Rscript -e "rmarkdown::render('analysis/main-analysis.Rmd', output_dir='output')" clean: rm -rf output/figures/* output/manuscript.pdf data/processed/*
r# _targets.R library(targets) tar_option_set(packages = c("tidyverse", "broom")) list( tar_target(raw_data, read_csv("data/raw/study_data.csv")), tar_target(clean_data, clean_dataset(raw_data)), tar_target(model, fit_model(clean_data)), tar_target(report, { rmarkdown::render("analysis/main-analysis.Rmd") "output/manuscript.pdf" }) )
The targets package tracks dependencies between pipeline steps and only reruns steps whose inputs have changed, saving time on large analyses.
| Method | Effort | Reproducibility | |--------|--------|----------------| | GitHub repo + renv.lock | Low | Good (requires R installation) | | Docker container | Medium | Excellent (full environment) | | Binder (mybinder.org) | Low | Good (browser-based, no install) | | Code Ocean capsule | Medium | Excellent (certified reproducibility) |
Always include a README with instructions for reproducing the analysis: required software, how to install dependencies (renv::restore), how to run the pipeline (make all), and expected runtime.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | pass→pass | 11,862 | 8,056 | -32% | 1 | 1 | 0% | 2,046 | 2,953 | +44% | 0 | 0 | — |
case-01 | fail→fail | 16,856 | 26,169 | +55% | 1 | 1 | 0% | 2,710 | 3,710 | +37% | 0 | 0 | — |
case-03 | fail→pass | 6,887 | 4,761 | -31% | 1 | 1 | 0% | 1,045 | 2,404 | +130% | 0 | 0 | — |
case-04 | pass→pass | 8,576 | 5,847 | -32% | 1 | 1 | 0% | 1,324 | 2,565 | +94% | 0 | 0 | — |
case-05 | pass→pass | 7,733 | 5,735 | -26% | 1 | 1 | 0% | 1,258 | 2,346 | +86% | 0 | 0 | — |
case-06 | pass→pass | 13,363 | 7,456 | -44% | 1 | 1 | 0% | 2,463 | 2,969 | +21% | 0 | 0 | — |
case-07 | pass→pass | 13,271 | 11,420 | -14% | 1 | 1 | 0% | 2,494 | 3,630 | +46% | 0 | 0 | — |
case-08 | pass→pass | 4,768 | 4,098 | -14% | 1 | 1 | 0% | 896 | 2,337 | +161% | 0 | 0 | — |
case-09 | pass→pass | 10,404 | 8,018 | -23% | 1 | 1 | 0% | 1,820 | 3,002 | +65% | 0 | 0 | — |
case-10 | pass→pass | 19,781 | 19,336 | -2% | 1 | 1 | 0% | 3,255 | 4,687 | +44% | 0 | 0 | — |
case-11 | pass→pass | 6,785 | 5,352 | -21% | 1 | 1 | 0% | 909 | 2,498 | +175% | 0 | 0 | — |
case-12 | pass→pass | 10,636 | 7,581 | -29% | 1 | 1 | 0% | 1,789 | 3,097 | +73% | 0 | 0 | — |
case-13 | pass→pass | 14,900 | 5,269 | -65% | 1 | 1 | 0% | 2,177 | 2,446 | +12% | 0 | 0 | — |
case-14 | pass→pass | 18,291 | 19,811 | +8% | 1 | 1 | 0% | 2,755 | 4,828 | +75% | 0 | 0 | — |
case-15 | pass→pass | 8,993 | 9,604 | +7% | 1 | 1 | 0% | 1,628 | 2,907 | +79% | 0 | 0 | — |
case-16 | pass→pass | 10,159 | 6,889 | -32% | 1 | 1 | 0% | 1,581 | 2,507 | +59% | 0 | 0 | — |
case-17 | pass→fail | 19,115 | 20,362 | +7% | 1 | 1 | 0% | 3,187 | 5,068 | +59% | 0 | 0 | — |
case-18 | pass→pass | 11,469 | 6,876 | -40% | 1 | 1 | 0% | 1,597 | 2,692 | +69% | 0 | 0 | — |
case-19 | pass→pass | 7,359 | 6,316 | -14% | 1 | 1 | 0% | 1,373 | 2,723 | +98% | 0 | 0 | — |
case-20 | pass→pass | 19,643 | 14,000 | -29% | 1 | 1 | 0% | 2,668 | 3,980 | +49% | 0 | 0 | — |
case-21 | pass→pass | 10,490 | 12,465 | +19% | 1 | 1 | 0% | 1,557 | 3,335 | +114% | 0 | 0 | — |
case-22 | pass→pass | 13,920 | 12,391 | -11% | 1 | 1 | 0% | 2,102 | 3,742 | +78% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of 0 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.