Jupyter Notebook Skill
Create clean, reproducible Jupyter notebooks for two primary modes:
- Experiments and exploratory analysis
- Tutorials and teaching-oriented walkthroughs
Prefer the bundled templates and the helper script for consistent structure and fewer JSON mistakes.
When to use
- Create a new
.ipynb notebook from scratch.
- Convert rough notes or scripts into a structured notebook.
- Refactor an existing notebook to be more reproducible and skimmable.
- Build experiments or tutorials that will be read or re-run by other people.
Decision tree
- If the request is exploratory, analytical, or hypothesis-driven, choose
experiment.
- If the request is instructional, step-by-step, or audience-specific, choose
tutorial.
- If editing an existing notebook, treat it as a refactor: preserve intent and improve structure.
Skill path (set once)
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export JUPYTER_NOTEBOOK_CLI="$CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py"
User-scoped skills install under $CODEX_HOME/skills (default: ~/.codex/skills).
Workflow
Lock the intent.
Identify the notebook kind: experiment or tutorial.
Capture the objective, audience, and what "done" looks like.
Scaffold from the template.
Use the helper script to avoid hand-authoring raw notebook JSON.
uv run --python 3.12 python "$JUPYTER_NOTEBOOK_CLI" \
--kind experiment \
--title "Compare prompt variants" \
--out output/jupyter-notebook/compare-prompt-variants.ipynb
uv run --python 3.12 python "$JUPYTER_NOTEBOOK_CLI" \
--kind tutorial \
--title "Intro to embeddings" \
--out output/jupyter-notebook/intro-to-embeddings.ipynb
Fill the notebook with small, runnable steps.
Keep each code cell focused on one step.
Add short markdown cells that explain the purpose and expected result.
Avoid large, noisy outputs when a short summary works.
Apply the right pattern.
For experiments, follow references/experiment-patterns.md.
For tutorials, follow references/tutorial-patterns.md.
Edit safely when working with existing notebooks.
Preserve the notebook structure; avoid reordering cells unless it improves the top-to-bottom story.
Prefer targeted edits over full rewrites.
If you must edit raw JSON, review references/notebook-structure.md first.
Validate the result.
Run the notebook top-to-bottom when the environment allows.
If execution is not possible, say so explicitly and call out how to validate locally.
Use the final pass checklist in references/quality-checklist.md.
Templates and helper script
- Templates live in
assets/experiment-template.ipynb and assets/tutorial-template.ipynb.
- The helper script loads a template, updates the title cell, and writes a notebook.
Script path:
$JUPYTER_NOTEBOOK_CLI (installed default: $CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py)
Temp and output conventions
- Use
tmp/jupyter-notebook/ for intermediate files; delete when done.
- Write final artifacts under
output/jupyter-notebook/ when working in this repo.
- Use stable, descriptive filenames (for example,
ablation-temperature.ipynb).
Dependencies (install only when needed)
Prefer uv for dependency management.
Optional Python packages for local notebook execution:
uv pip install jupyterlab ipykernel
The bundled scaffold script uses only the Python standard library and does not require extra dependencies.
Environment
No required environment variables.
Reference map
references/experiment-patterns.md: experiment structure and heuristics.
references/tutorial-patterns.md: tutorial structure and teaching flow.
references/notebook-structure.md: notebook JSON shape and safe editing rules.
references/quality-checklist.md: final validation checklist.
Cross-Client Portability
This skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.
- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the
workflow in project instructions when folder discovery is unavailable.
- Claude Code: keep the folder in a local skills directory or a compatible plugin source.
- Codex: install or sync the folder into
$CODEX_HOME/skills/jupyter-notebook and restart Codex after major changes.
MCP Availability And Fallback
Preferred MCP Server: None required
- Fallback prompt: "Use the Jupyter Notebook Skill skill without MCP. Rely on its local instructions, bundled resources, standard shell or editor tools, and direct verification. Show the evidence used before concluding."
- Do not claim an MCP operation was used when the active host does not expose it.
- Treat local files, tests, rendered outputs, logs, or screenshots as the fallback evidence path.
Anti-Patterns
- Hand-authoring raw notebook JSON when the bundled scaffold or a targeted cell edit would avoid avoidable formatting mistakes.
- Packing large exploratory leaps into one noisy cell instead of building small, runnable notebook steps with short narrative bridges.
- Presenting a notebook as validated when it has not been run top-to-bottom or the execution limitation has not been disclosed.
Verification Protocol
- Pass/fail: the notebook opens successfully and the structure, title, and requested sections match the chosen experiment or tutorial pattern.
- Pressure test: execute the notebook top-to-bottom when the environment allows, or validate the JSON plus template structure and call out any runtime gap explicitly.
- Success metric: no malformed notebook JSON and a clear top-to-bottom flow with runnable or clearly marked cells.
Related Skills
codebase-to-course
notebooklm-management
excel-sheet
documentation-authoring
1---2name: jupyter-notebook3description: Use when the user asks to create, scaffold, or edit Jupyter notebooks (`.ipynb`) for experiments, explorations, or tutorials; prefer the bundled templates and helper script for reproducible notebook structure and safer editing.4---5# Jupyter Notebook Skill
6
7Create clean, reproducible Jupyter notebooks for two primary modes:
8
9- Experiments and exploratory analysis
10- Tutorials and teaching-oriented walkthroughs
11
12Prefer the bundled templates and the helper script for consistent structure and fewer JSON mistakes.
13
14## When to use
15- Create a new `.ipynb` notebook from scratch.
16- Convert rough notes or scripts into a structured notebook.
17- Refactor an existing notebook to be more reproducible and skimmable.
18- Build experiments or tutorials that will be read or re-run by other people.
19
20## Decision tree
21- If the request is exploratory, analytical, or hypothesis-driven, choose `experiment`.
22- If the request is instructional, step-by-step, or audience-specific, choose `tutorial`.
23- If editing an existing notebook, treat it as a refactor: preserve intent and improve structure.
24
25## Skill path (set once)
26
27```bash
28export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
29export JUPYTER_NOTEBOOK_CLI="$CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py"
30```
31
32User-scoped skills install under `$CODEX_HOME/skills` (default: `~/.codex/skills`).
33
34## Workflow
351. Lock the intent.
36Identify the notebook kind: `experiment` or `tutorial`.
37Capture the objective, audience, and what "done" looks like.
38
392. Scaffold from the template.
40Use the helper script to avoid hand-authoring raw notebook JSON.
41
42```bash
43uv run --python 3.12 python "$JUPYTER_NOTEBOOK_CLI" \
44 --kind experiment \
45 --title "Compare prompt variants" \
46 --out output/jupyter-notebook/compare-prompt-variants.ipynb
47```
48
49```bash
50uv run --python 3.12 python "$JUPYTER_NOTEBOOK_CLI" \
51 --kind tutorial \
52 --title "Intro to embeddings" \
53 --out output/jupyter-notebook/intro-to-embeddings.ipynb
54```
55
563. Fill the notebook with small, runnable steps.
57Keep each code cell focused on one step.
58Add short markdown cells that explain the purpose and expected result.
59Avoid large, noisy outputs when a short summary works.
60
614. Apply the right pattern.
62For experiments, follow `references/experiment-patterns.md`.
63For tutorials, follow `references/tutorial-patterns.md`.
64
655. Edit safely when working with existing notebooks.
66Preserve the notebook structure; avoid reordering cells unless it improves the top-to-bottom story.
67Prefer targeted edits over full rewrites.
68If you must edit raw JSON, review `references/notebook-structure.md` first.
69
706. Validate the result.
71Run the notebook top-to-bottom when the environment allows.
72If execution is not possible, say so explicitly and call out how to validate locally.
73Use the final pass checklist in `references/quality-checklist.md`.
74
75## Templates and helper script
76- Templates live in `assets/experiment-template.ipynb` and `assets/tutorial-template.ipynb`.
77- The helper script loads a template, updates the title cell, and writes a notebook.
78
79Script path:
80- `$JUPYTER_NOTEBOOK_CLI` (installed default: `$CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py`)
81
82## Temp and output conventions
83- Use `tmp/jupyter-notebook/` for intermediate files; delete when done.
84- Write final artifacts under `output/jupyter-notebook/` when working in this repo.
85- Use stable, descriptive filenames (for example, `ablation-temperature.ipynb`).
86
87## Dependencies (install only when needed)
88Prefer `uv` for dependency management.
89
90Optional Python packages for local notebook execution:
91
92```bash
93uv pip install jupyterlab ipykernel
94```
95
96The bundled scaffold script uses only the Python standard library and does not require extra dependencies.
97
98## Environment
99No required environment variables.
100
101## Reference map
102- `references/experiment-patterns.md`: experiment structure and heuristics.
103- `references/tutorial-patterns.md`: tutorial structure and teaching flow.
104- `references/notebook-structure.md`: notebook JSON shape and safe editing rules.
105- `references/quality-checklist.md`: final validation checklist.
106
107<!-- MCP:START -->
108
109<!-- PORTABILITY:START -->
110## Cross-Client Portability
111
112This skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.
113
114- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the
115 workflow in project instructions when folder discovery is unavailable.
116- Claude Code: keep the folder in a local skills directory or a compatible plugin source.
117- Codex: install or sync the folder into
118 `$CODEX_HOME/skills/jupyter-notebook` and restart Codex after major changes.
119
120<!-- PORTABILITY:END -->
121
122## MCP Availability And Fallback
123
124Preferred MCP Server: None required
125
126- Fallback prompt: "Use the Jupyter Notebook Skill skill without MCP. Rely on its local instructions, bundled resources, standard shell or editor tools, and direct verification. Show the evidence used before concluding."
127- Do not claim an MCP operation was used when the active host does not expose it.
128- Treat local files, tests, rendered outputs, logs, or screenshots as the fallback evidence path.
129
130<!-- MCP:END -->
131
132## Anti-Patterns
133
134- Hand-authoring raw notebook JSON when the bundled scaffold or a targeted cell edit would avoid avoidable formatting mistakes.
135- Packing large exploratory leaps into one noisy cell instead of building small, runnable notebook steps with short narrative bridges.
136- Presenting a notebook as validated when it has not been run top-to-bottom or the execution limitation has not been disclosed.
137
138## Verification Protocol
139
1401. Pass/fail: the notebook opens successfully and the structure, title, and requested sections match the chosen experiment or tutorial pattern.
1412. Pressure test: execute the notebook top-to-bottom when the environment allows, or validate the JSON plus template structure and call out any runtime gap explicitly.
1423. Success metric: no malformed notebook JSON and a clear top-to-bottom flow with runnable or clearly marked cells.
143
144## Related Skills
145
146- `codebase-to-course`
147- `notebooklm-management`
148- `excel-sheet`
149- `documentation-authoring`