Use when the user asks to create, scaffold, or edit Jupyter notebooks (`.ipynb`) for experiments, explorations, or tutorials; prefer the bundled templates and run the helper script `new_notebook.py` to generate a clean starting notebook.
Add this skill
npx mdskills install openai/jupyter-notebookWell-structured workflow with decision trees, templates, and helper script for safe notebook generation
1---2name: "jupyter-notebook"3description: "Use when the user asks to create, scaffold, or edit Jupyter notebooks (`.ipynb`) for experiments, explorations, or tutorials; prefer the bundled templates and run the helper script `new_notebook.py` to generate a clean starting notebook."4---567# Jupyter Notebook Skill89Create clean, reproducible Jupyter notebooks for two primary modes:1011- Experiments and exploratory analysis12- Tutorials and teaching-oriented walkthroughs1314Prefer the bundled templates and the helper script for consistent structure and fewer JSON mistakes.1516## When to use17- Create a new `.ipynb` notebook from scratch.18- Convert rough notes or scripts into a structured notebook.19- Refactor an existing notebook to be more reproducible and skimmable.20- Build experiments or tutorials that will be read or re-run by other people.2122## Decision tree23- If the request is exploratory, analytical, or hypothesis-driven, choose `experiment`.24- If the request is instructional, step-by-step, or audience-specific, choose `tutorial`.25- If editing an existing notebook, treat it as a refactor: preserve intent and improve structure.2627## Skill path (set once)2829```bash30export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"31export JUPYTER_NOTEBOOK_CLI="$CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py"32```3334User-scoped skills install under `$CODEX_HOME/skills` (default: `~/.codex/skills`).3536## Workflow371. Lock the intent.38Identify the notebook kind: `experiment` or `tutorial`.39Capture the objective, audience, and what "done" looks like.40412. Scaffold from the template.42Use the helper script to avoid hand-authoring raw notebook JSON.4344```bash45uv run --python 3.12 python "$JUPYTER_NOTEBOOK_CLI" \46 --kind experiment \47 --title "Compare prompt variants" \48 --out output/jupyter-notebook/compare-prompt-variants.ipynb49```5051```bash52uv run --python 3.12 python "$JUPYTER_NOTEBOOK_CLI" \53 --kind tutorial \54 --title "Intro to embeddings" \55 --out output/jupyter-notebook/intro-to-embeddings.ipynb56```57583. Fill the notebook with small, runnable steps.59Keep each code cell focused on one step.60Add short markdown cells that explain the purpose and expected result.61Avoid large, noisy outputs when a short summary works.62634. Apply the right pattern.64For experiments, follow `references/experiment-patterns.md`.65For tutorials, follow `references/tutorial-patterns.md`.66675. Edit safely when working with existing notebooks.68Preserve the notebook structure; avoid reordering cells unless it improves the top-to-bottom story.69Prefer targeted edits over full rewrites.70If you must edit raw JSON, review `references/notebook-structure.md` first.71726. Validate the result.73Run the notebook top-to-bottom when the environment allows.74If execution is not possible, say so explicitly and call out how to validate locally.75Use the final pass checklist in `references/quality-checklist.md`.7677## Templates and helper script78- Templates live in `assets/experiment-template.ipynb` and `assets/tutorial-template.ipynb`.79- The helper script loads a template, updates the title cell, and writes a notebook.8081Script path:82- `$JUPYTER_NOTEBOOK_CLI` (installed default: `$CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py`)8384## Temp and output conventions85- Use `tmp/jupyter-notebook/` for intermediate files; delete when done.86- Write final artifacts under `output/jupyter-notebook/` when working in this repo.87- Use stable, descriptive filenames (for example, `ablation-temperature.ipynb`).8889## Dependencies (install only when needed)90Prefer `uv` for dependency management.9192Optional Python packages for local notebook execution:9394```bash95uv pip install jupyterlab ipykernel96```9798The bundled scaffold script uses only the Python standard library and does not require extra dependencies.99100## Environment101No required environment variables.102103## Reference map104- `references/experiment-patterns.md`: experiment structure and heuristics.105- `references/tutorial-patterns.md`: tutorial structure and teaching flow.106- `references/notebook-structure.md`: notebook JSON shape and safe editing rules.107- `references/quality-checklist.md`: final validation checklist.108
Full transparency — inspect the skill content before installing.