jupyter-notebook
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJupyter Notebook Skill
Jupyter Notebook 技能
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.
创建用于两种主要场景的整洁、可复现的Jupyter Notebook:
- 实验与探索性分析
- 教程与教学导向的分步指南
优先使用捆绑的模板和辅助脚本,以保证结构一致并减少JSON错误。
When to use
使用场景
- Create a new notebook from scratch.
.ipynb - 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.
- 从零开始创建新的Notebook。
.ipynb - 将粗略的笔记或脚本转换为结构化的Notebook。
- 重构现有Notebook,使其更具可复现性和易读性。
- 构建可供他人阅读或重新运行的实验或教程。
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.
- 如果请求是探索性、分析性或假设驱动的,选择(实验)模式。
experiment - 如果请求是指导性、分步式或针对特定受众的,选择(教程)模式。
tutorial - 如果是编辑现有Notebook,将其视为重构:保留原有意图并优化结构。
Skill path (set once)
技能路径(仅需设置一次)
bash
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 (default: ).
$CODEX_HOME/skills~/.codex/skillsbash
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export JUPYTER_NOTEBOOK_CLI="$CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py"用户范围的技能安装在目录下(默认路径:)。
$CODEX_HOME/skills~/.codex/skillsWorkflow
工作流程
-
Lock the intent. Identify the notebook kind:or
experiment. Capture the objective, audience, and what "done" looks like.tutorial -
Scaffold from the template. Use the helper script to avoid hand-authoring raw notebook JSON.
bash
uv run --python 3.12 python "$JUPYTER_NOTEBOOK_CLI" \
--kind experiment \
--title "Compare prompt variants" \
--out output/jupyter-notebook/compare-prompt-variants.ipynbbash
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. For tutorials, follow
references/experiment-patterns.md.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, reviewfirst.
references/notebook-structure.md -
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
-
明确意图。 确定Notebook类型:或
experiment。 记录目标、受众以及完成标准。tutorial -
基于模板搭建。 使用辅助脚本避免手动编写原始Notebook JSON。
bash
uv run --python 3.12 python "$JUPYTER_NOTEBOOK_CLI" \
--kind experiment \
--title "Compare prompt variants" \
--out output/jupyter-notebook/compare-prompt-variants.ipynbbash
uv run --python 3.12 python "$JUPYTER_NOTEBOOK_CLI" \
--kind tutorial \
--title "Intro to embeddings" \
--out output/jupyter-notebook/intro-to-embeddings.ipynb-
用小的、可运行的步骤填充Notebook。 每个代码单元格专注于一个步骤。 添加简短的Markdown单元格解释目的和预期结果。 当简短摘要足够时,避免大而杂乱的输出。
-
应用正确的模式。 对于实验,请遵循。 对于教程,请遵循
references/experiment-patterns.md。references/tutorial-patterns.md -
编辑现有Notebook时确保安全。 保留Notebook结构;除非能优化从上到下的逻辑,否则不要重新排序单元格。 优先进行针对性编辑而非完全重写。 如果必须编辑原始JSON,请先查看。
references/notebook-structure.md -
验证结果。 如果环境允许,从上到下运行Notebook。 如果无法执行,请明确说明,并指出如何在本地验证。 使用中的最终检查清单。
references/quality-checklist.md
Templates and helper script
模板与辅助脚本
- Templates live in and
assets/experiment-template.ipynb.assets/tutorial-template.ipynb - The helper script loads a template, updates the title cell, and writes a notebook.
Script path:
- (installed default:
$JUPYTER_NOTEBOOK_CLI)$CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py
- 模板位于和
assets/experiment-template.ipynb。assets/tutorial-template.ipynb - 辅助脚本加载模板,更新标题单元格,并生成Notebook。
脚本路径:
- (默认安装路径:
$JUPYTER_NOTEBOOK_CLI)$CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py
Temp and output conventions
临时文件与输出约定
- Use for intermediate files; delete when done.
tmp/jupyter-notebook/ - Write final artifacts under when working in this repo.
output/jupyter-notebook/ - Use stable, descriptive filenames (for example, ).
ablation-temperature.ipynb
- 使用存放中间文件;完成后删除。
tmp/jupyter-notebook/ - 在此仓库中工作时,将最终产物写入目录。
output/jupyter-notebook/ - 使用稳定、描述性的文件名(例如)。
ablation-temperature.ipynb
Dependencies (install only when needed)
依赖项(仅在需要时安装)
Prefer for dependency management.
uvOptional Python packages for local notebook execution:
bash
uv pip install jupyterlab ipykernelThe bundled scaffold script uses only the Python standard library and does not require extra dependencies.
优先使用进行依赖管理。
uv本地运行Notebook所需的可选Python包:
bash
uv pip install jupyterlab ipykernel捆绑的搭建脚本仅使用Python标准库,不需要额外依赖。
Environment
环境
No required environment variables.
无必需的环境变量。
Reference map
参考文档
- : experiment structure and heuristics.
references/experiment-patterns.md - : tutorial structure and teaching flow.
references/tutorial-patterns.md - : notebook JSON shape and safe editing rules.
references/notebook-structure.md - : final validation checklist.
references/quality-checklist.md
- :实验结构与启发式方法。
references/experiment-patterns.md - :教程结构与教学流程。
references/tutorial-patterns.md - :Notebook JSON结构与安全编辑规则。
references/notebook-structure.md - :最终验证检查清单。
references/quality-checklist.md