Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Reproducible Python environments, notebooks, and literate programming
.claude/skills/brycewang-stanford-python-reproducibility-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 119% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 234% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 91% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 98% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 68% | 0% |
Set up reproducible Python environments for research computing, using virtual environments, dependency management, Jupyter notebooks, and literate programming practices.
bash# Option 1: venv (built-in, lightweight) python -m venv .venv source .venv/bin/activate # macOS/Linux # .venv\Scripts\activate # Windows pip install -r requirements.txt # Option 2: conda (includes non-Python dependencies) conda create -n myproject python=3.11 conda activate myproject conda install numpy pandas scipy matplotlib conda env export > environment.yml # Option 3: uv (fast, modern Python package manager) uv venv source .venv/bin/activate uv pip install -r requirements.txt
bash# requirements.txt with exact versions (pip freeze) pip freeze > requirements.txt # Better: use pip-tools for compiled dependencies pip install pip-tools # Create requirements.in (human-readable, loose constraints) cat > requirements.in << 'EOF' numpy>=1.24 pandas>=2.0 scipy>=1.11 matplotlib>=3.7 scikit-learn>=1.3 EOF # Compile to requirements.txt (pinned, reproducible) pip-compile requirements.in --output-file requirements.txt # Install from compiled requirements pip-sync requirements.txt
toml[project] name = "my-research-project" version = "0.1.0" description = "Analysis code for paper: Title" requires-python = ">=3.10" dependencies = [ "numpy>=1.24", "pandas>=2.0", "scipy>=1.11", "matplotlib>=3.7", "scikit-learn>=1.3", "statsmodels>=0.14", ] [project.optional-dependencies] dev = ["pytest", "black", "ruff", "jupyter"] gpu = ["torch>=2.0", "torchvision"] [tool.ruff] line-length = 88 select = ["E", "F", "I"]
python# Cell 1: Imports and configuration (always the first cell) import numpy as np import pandas as pd import matplotlib.pyplot as plt from pathlib import Path # Configuration DATA_DIR = Path("./data") OUTPUT_DIR = Path("./outputs") OUTPUT_DIR.mkdir(exist_ok=True) RANDOM_SEED = 42 np.random.seed(RANDOM_SEED) # Matplotlib defaults plt.rcParams.update({ "figure.figsize": (10, 6), "figure.dpi": 150, "font.size": 12, "axes.spines.top": False, "axes.spines.right": False, }) print(f"NumPy: {np.__version__}") print(f"Pandas: {pd.__version__}")
markdown# Paper Title: Analysis Notebook ## 1. Setup and Data Loading [Import libraries, set seeds, load data] ## 2. Data Exploration [Summary statistics, distributions, missing data check] ## 3. Preprocessing [Cleaning, transformation, feature engineering] ## 4. Analysis ### 4.1 Primary Analysis [Main statistical tests or model training] ### 4.2 Sensitivity Analysis [Robustness checks] ### 4.3 Supplementary Analysis [Additional analyses for appendix] ## 5. Visualization [Publication-quality figures] ## 6. Export Results [Save tables, figures, and summary statistics]
bash# Convert notebook to Python script jupyter nbconvert --to script analysis.ipynb # Convert notebook to HTML report jupyter nbconvert --to html --no-input analysis.ipynb # Convert notebook to PDF jupyter nbconvert --to pdf analysis.ipynb # Execute notebook from command line (and save output) jupyter nbconvert --execute --to notebook --inplace analysis.ipynb
pythonimport numpy as np import random import os def set_global_seed(seed=42): """Set random seeds for full reproducibility.""" random.seed(seed) np.random.seed(seed) os.environ["PYTHONHASHSEED"] = str(seed) # PyTorch (if used) try: import torch torch.manual_seed(seed) torch.cuda.manual_seed_all(seed) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False except ImportError: pass # TensorFlow (if used) try: import tensorflow as tf tf.random.set_seed(seed) except ImportError: pass set_global_seed(42)
dockerfileFROM python:3.11-slim WORKDIR /app # System dependencies RUN apt-get update && apt-get install -y \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy project code COPY . . # Default: run the analysis CMD ["python", "run_analysis.py"]
bash# Build and run docker build -t my-analysis . docker run -v $(pwd)/data:/app/data -v $(pwd)/outputs:/app/outputs my-analysis # Interactive Jupyter inside Docker docker run -p 8888:8888 -v $(pwd):/app my-analysis \ jupyter notebook --ip=0.0.0.0 --allow-root --no-browser
research-project/
├── README.md # Project overview and how to reproduce
├── pyproject.toml # Dependencies and project metadata
├── requirements.txt # Pinned dependencies
├── Dockerfile # Containerized environment
├── Makefile # Automation (make data, make analysis, make figures)
├── data/
│ ├── raw/ # Original, immutable data
│ ├── processed/ # Cleaned, transformed data
│ └── external/ # Third-party data sources
├── notebooks/
│ ├── 01_exploration.ipynb # Data exploration
│ ├── 02_analysis.ipynb # Main analysis
│ └── 03_figures.ipynb # Publication figures
├── src/
│ ├── __init__.py
│ ├── data.py # Data loading and preprocessing
│ ├── models.py # Statistical models and ML
│ ├── visualization.py # Plotting functions
│ └── utils.py # Shared utilities
├── tests/
│ ├── test_data.py # Data pipeline tests
│ └── test_models.py # Model correctness tests
├── outputs/
│ ├── figures/ # Generated figures (PDF, PNG)
│ ├── tables/ # Generated tables (CSV, LaTeX)
│ └── models/ # Saved model artifacts
└── configs/
├── experiment_1.yaml # Experiment configuration
└── experiment_2.yaml # Experiment configurationmakefile.PHONY: all data analysis figures clean all: data analysis figures data: python src/data.py --input data/raw/ --output data/processed/ analysis: data python -m jupyter nbconvert --execute notebooks/02_analysis.ipynb \ --to notebook --inplace figures: analysis python src/visualization.py --output outputs/figures/ clean: rm -rf data/processed/ outputs/ # Reproduce the full pipeline from scratch reproduce: clean all @echo "All results reproduced successfully." # Run tests test: pytest tests/ -v # Format code format: ruff check --fix src/ tests/ ruff format src/ tests/
pythonimport logging from datetime import datetime # Set up logging logging.basicConfig( level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s", handlers=[ logging.FileHandler(f"outputs/logs/run_{datetime.now():%Y%m%d_%H%M%S}.log"), logging.StreamHandler() ] ) logger = logging.getLogger(__name__) # Log experiment parameters logger.info(f"Random seed: {RANDOM_SEED}") logger.info(f"Data file: {DATA_DIR / 'dataset.csv'}") logger.info(f"Model: Linear Regression with L2 regularization (alpha=0.1)") logger.info(f"Train/test split: 80/20")
requirements.txt or pyproject.tomlmake all or python run_analysis.py)| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→pass | 13,526 | 14,622 | +8% | 1 | 1 | 0% | 2,787 | 4,692 | +68% | 0 | 0 | — |
case-02 | fail→fail | 35,487 | 17,790 | -50% | 1 | 1 | 0% | 1,415 | 5,161 | +265% | 0 | 0 | — |
case-03 | fail→pass | 7,148 | 5,305 | -26% | 1 | 1 | 0% | 1,435 | 3,146 | +119% | 0 | 0 | — |
case-04 | pass→pass | 8,036 | 4,627 | -42% | 1 | 1 | 0% | 1,285 | 3,119 | +143% | 0 | 0 | — |
case-05 | pass→pass | 7,109 | 8,460 | +19% | 1 | 1 | 0% | 1,515 | 3,749 | +147% | 0 | 0 | — |
case-21 | pass→pass | 11,289 | 15,394 | +36% | 1 | 1 | 0% | 2,276 | 4,794 | +111% | 0 | 0 | — |
case-06 | pass→pass | 11,146 | 10,234 | -8% | 1 | 1 | 0% | 2,687 | 4,234 | +58% | 0 | 0 | — |
case-07 | fail→fail | 10,659 | 8,183 | -23% | 1 | 1 | 0% | 1,684 | 3,947 | +134% | 0 | 0 | — |
case-08 | fail→pass | 4,174 | 3,868 | -7% | 1 | 1 | 0% | 851 | 2,844 | +234% | 0 | 0 | — |
case-09 | pass→pass | 4,350 | 4,592 | +6% | 1 | 1 | 0% | 1,066 | 3,126 | +193% | 0 | 0 | — |
case-10 | pass→pass | 6,951 | 4,864 | -30% | 1 | 1 | 0% | 1,203 | 3,245 | +170% | 0 | 0 | — |
case-11 | pass→pass | 21,664 | 20,624 | -5% | 1 | 1 | 0% | 3,333 | 6,166 | +85% | 0 | 0 | — |
case-12 | fail→pass | 11,458 | 13,814 | +21% | 1 | 1 | 0% | 2,335 | 4,453 | +91% | 0 | 0 | — |
case-13 | pass→pass | 13,371 | 15,248 | +14% | 1 | 1 | 0% | 2,471 | 5,035 | +104% | 0 | 0 | — |
case-14 | pass→pass | 9,169 | 11,401 | +24% | 1 | 1 | 0% | 1,699 | 3,930 | +131% | 0 | 0 | — |
case-15 | fail→pass | 16,976 | 18,101 | +7% | 1 | 1 | 0% | 2,700 | 5,344 | +98% | 0 | 0 | — |
case-16 | pass→pass | 5,595 | 6,216 | +11% | 1 | 1 | 0% | 1,111 | 3,169 | +185% | 0 | 0 | — |
case-17 | pass→pass | 12,625 | 12,503 | -1% | 1 | 1 | 0% | 2,467 | 4,573 | +85% | 0 | 0 | — |
case-18 | fail→fail | 20,404 | 22,590 | +11% | 1 | 1 | 0% | 3,012 | 6,724 | +123% | 0 | 0 | — |
case-19 | pass→pass | 9,983 | 5,876 | -41% | 1 | 1 | 0% | 1,651 | 3,385 | +105% | 0 | 0 | — |
case-20 | pass→pass | 18,491 | 17,178 | -7% | 1 | 1 | 0% | 3,168 | 5,260 | +66% | 0 | 0 | — |
case-22 | fail→fail | 17,002 | 19,831 | +17% | 1 | 1 | 0% | 2,743 | 5,559 | +103% | 0 | 0 | — |
case-23 | fail→fail | 14,507 | 12,054 | -17% | 1 | 1 | 0% | 2,099 | 4,056 | +93% | 0 | 0 | — |
case-24 | pass→pass | 7,763 | 10,404 | +34% | 1 | 1 | 0% | 1,272 | 3,931 | +209% | 0 | 0 | — |
case-25 | pass→pass | 5,695 | 7,878 | +38% | 1 | 1 | 0% | 1,144 | 3,427 | +200% | 0 | 0 | — |
case-26 | pass→pass | 6,470 | 4,730 | -27% | 1 | 1 | 0% | 985 | 3,154 | +220% | 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. 26 cases were attempted, and 25 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +15 percentage points is the difference between those two pass rates over the 25 comparable cases.
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.