Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Best practices for computational research notebooks with reproducible workflows
.claude/skills/brycewang-stanford-jupyter-notebook-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 44% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 32% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 29% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 56% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 164% | 0% |
A skill for using Jupyter notebooks effectively in research contexts. Covers notebook organization, reproducibility best practices, collaboration workflows, and integration with research computing infrastructure.
Every research notebook should follow a consistent structure:
01_data_collection.ipynb # Data acquisition and initial storage
02_data_cleaning.ipynb # Preprocessing, validation, transformations
03_exploratory_analysis.ipynb # EDA, descriptive statistics, initial plots
04_modeling.ipynb # Model training, evaluation, selection
05_results_visualization.ipynb # Publication-quality figures
06_supplementary.ipynb # Additional analyses, robustness checkspython# === CELL 1: Header and metadata === """ # Analysis: Effect of Treatment on Outcome Variable Author: [Name] Date: 2026-03-09 Data: experiment_results_v2.csv Dependencies: pandas>=2.0, scipy>=1.11, matplotlib>=3.8 """ # === CELL 2: Imports and configuration === import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import stats # Reproducibility np.random.seed(42) pd.set_option('display.max_columns', 50) plt.rcParams.update({ 'figure.figsize': (10, 6), 'figure.dpi': 150, 'font.size': 12, 'axes.titlesize': 14, 'savefig.dpi': 300, 'savefig.bbox': 'tight' }) # === CELL 3: Data loading === DATA_PATH = '../data/raw/experiment_results_v2.csv' df = pd.read_csv(DATA_PATH) print(f"Loaded {len(df)} rows, {len(df.columns)} columns") df.head()
Always pin your dependencies:
bash# Create environment from scratch conda create -n research python=3.11 conda activate research # Install and pin pip install pandas==2.1.4 scipy==1.11.4 matplotlib==3.8.2 jupyterlab==4.0.9 # Export for reproducibility pip freeze > requirements.txt # Or use conda conda env export --no-builds > environment.yml
python# Add this cell at the top of every notebook to catch execution order issues import IPython print(f"Python: {IPython.sys.version}") print(f"IPython: {IPython.__version__}") print(f"Working directory: {os.getcwd()}") # Run all cells from top to bottom before sharing # Menu: Kernel -> Restart & Run All # This verifies the notebook executes cleanly in order
Use papermill for parameterized execution:
python# Parameters cell (tag with "parameters" in cell metadata) input_file = "data/experiment_001.csv" alpha = 0.05 n_bootstrap = 1000 output_dir = "results/experiment_001"
bash# Execute with different parameters papermill 04_modeling.ipynb output/run_001.ipynb \ -p input_file "data/experiment_001.csv" \ -p alpha 0.01 \ -p n_bootstrap 5000 # Batch execution for i in $(seq 1 10); do papermill 04_modeling.ipynb "output/run_${i}.ipynb" \ -p input_file "data/experiment_${i}.csv" done
| Extension | Purpose | Install | |-----------|---------|---------| | jupyterlab-git | Version control integration | pip install jupyterlab-git | | jupyterlab-lsp | Code intelligence (autocomplete) | pip install jupyterlab-lsp | | nbdime | Notebook diffing and merging | pip install nbdime | | jupytext | Pair notebooks with .py scripts | pip install jupytext | | jupyter-book | Convert notebooks to publications | pip install jupyter-book |
Jupyter notebooks contain output cells, which create noisy diffs. Solutions:
bash# Option 1: Strip outputs before committing pip install nbstripout nbstripout --install # adds git filter # Option 2: Use jupytext to maintain .py mirrors jupytext --set-formats ipynb,py:percent notebook.ipynb # Now edit the .py file and sync: jupytext --sync notebook.ipynb # Option 3: Use nbdime for meaningful diffs nbdime config-git --enable --global git diff notebook.ipynb # now shows structured diff
bash# SSH tunnel to remote Jupyter server ssh -N -L 8888:localhost:8888 user@cluster.university.edu # On the cluster: jupyter lab --no-browser --port=8888 # Then open http://localhost:8888 in your local browser
For quick sharing and GPU access, export notebooks to Colab format. Add a Colab badge to your repository README for one-click access. Remember that Colab environments are ephemeral -- always save results to Google Drive or download locally.
Use jupyter-book or nbconvert to transform notebooks into LaTeX, HTML, or PDF outputs suitable for supplementary materials in journal submissions. Always run the full notebook from a clean kernel before conversion to ensure all outputs are current and reproducible.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | pass→pass | 15,387 | 14,565 | -5% | 1 | 1 | 0% | 2,428 | 3,794 | +56% | 0 | 0 | — |
case-01 | fail→fail | 13,539 | 23,351 | +72% | 1 | 1 | 0% | 2,849 | 3,943 | +38% | 0 | 0 | — |
case-03 | pass→pass | 4,787 | 5,686 | +19% | 1 | 1 | 0% | 768 | 2,028 | +164% | 0 | 0 | — |
case-04 | pass→pass | 9,643 | 3,938 | -59% | 1 | 1 | 0% | 1,394 | 2,035 | +46% | 0 | 0 | — |
case-05 | fail→pass | 12,049 | 9,282 | -23% | 1 | 1 | 0% | 2,155 | 3,105 | +44% | 0 | 0 | — |
case-06 | fail→fail | 12,564 | 16,936 | +35% | 1 | 1 | 0% | 2,629 | 4,498 | +71% | 0 | 0 | — |
case-07 | fail→fail | 14,516 | 7,006 | -52% | 1 | 1 | 0% | 2,652 | 2,340 | -12% | 0 | 0 | — |
case-08 | pass→pass | 10,111 | 5,888 | -42% | 1 | 1 | 0% | 1,463 | 2,068 | +41% | 0 | 0 | — |
case-09 | pass→pass | 7,258 | 5,385 | -26% | 1 | 1 | 0% | 1,139 | 2,220 | +95% | 0 | 0 | — |
case-10 | pass→pass | 3,698 | 2,738 | -26% | 1 | 1 | 0% | 585 | 1,761 | +201% | 0 | 0 | — |
case-11 | pass→pass | 3,393 | 2,287 | -33% | 1 | 1 | 0% | 513 | 1,712 | +234% | 0 | 0 | — |
case-17 | pass→pass | 5,134 | 2,671 | -48% | 1 | 1 | 0% | 724 | 1,814 | +151% | 0 | 0 | — |
case-12 | pass→pass | 5,266 | 4,265 | -19% | 1 | 1 | 0% | 849 | 1,951 | +130% | 0 | 0 | — |
case-13 | pass→pass | 5,075 | 1,959 | -61% | 1 | 1 | 0% | 922 | 1,651 | +79% | 0 | 0 | — |
case-14 | pass→pass | 10,725 | 4,694 | -56% | 1 | 1 | 0% | 1,725 | 2,073 | +20% | 0 | 0 | — |
case-15 | fail→pass | 15,829 | 11,850 | -25% | 1 | 1 | 0% | 2,497 | 3,284 | +32% | 0 | 0 | — |
case-16 | fail→pass | 17,260 | 11,886 | -31% | 1 | 1 | 0% | 2,595 | 3,342 | +29% | 0 | 0 | — |
case-18 | fail→fail | 6,834 | 3,688 | -46% | 1 | 1 | 0% | 1,209 | 2,051 | +70% | 0 | 0 | — |
case-19 | pass→pass | 4,928 | 4,516 | -8% | 1 | 1 | 0% | 816 | 1,985 | +143% | 0 | 0 | — |
case-20 | pass→pass | 13,143 | 14,961 | +14% | 1 | 1 | 0% | 2,730 | 4,464 | +64% | 0 | 0 | — |
case-21 | pass→pass | 9,268 | 9,981 | +8% | 1 | 1 | 0% | 1,694 | 3,203 | +89% | 0 | 0 | — |
case-22 | pass→pass | 13,327 | 10,679 | -20% | 1 | 1 | 0% | 2,684 | 3,433 | +28% | 0 | 0 | — |
case-23 | pass→pass | 6,514 | 2,802 | -57% | 1 | 1 | 0% | 1,077 | 1,825 | +69% | 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. 23 cases were attempted. The headline lift of +13 percentage points is the difference between those two pass rates over the 23 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.