--- description: Implement a Jupyter notebook with widgets from an outline description model: opus argument-hint: " [--only_plan]" --- # Goal - **Input**: A `notebook.create_outline..md` outline file that describes each notebook cell (created via `.claude/skills/notebook.create_outline/SKILL.md`) - **Outputs**: 1. `.ipynb` file: Fully functional Jupyter notebook with working code, visualizations, and interactive widgets 2. `.py` file: Paired with the `.ipynb` using `jupytext` in py:percent format 3. `*_utils.py` file: Reusable helper functions for the notebook code - **Purpose**: Implement the pedagogical design as an executable, interactive notebook - Each visualization is a triplet of pre-viz markdown, a code cell, and post-viz markdown (see "Cell Structure in Notebook") # Plan Only (`--only_plan`) - With `--only_plan`, follow `.claude/skills/skill.rules.md` section "Create Only a Plan with `--only_plan`" - Write the plan to `notebook.implement_outline..md`, then stop without executing the skill # Core Workflow - **Understand the outline**: Review each cell's Purpose, Display, and (if present) Widgets and Guided Usage - **Implement utility functions**: Write reusable widget and visualization code in `*_utils.py` - **Create notebook cells**: Add markdown cells (context) and code cells (widget calls) - **Follow the separation principle**: Utilities hold the implementation. The notebook holds only function calls # Key Conventions - Follow `.claude/skills/notebook.rules.md` for general notebook conventions and structure, especially: - `## Visualization Cell Triplet Details`: Pre-viz and post-viz markdown cells - `# Visualization and Interactivity`: Widget patterns and comments panel conventions - Follow the outline cell format in `.claude/skills/notebook.create_outline/SKILL.md` - Follow `.claude/skills/coding.rules.md` for Python in `*_utils.py` and in the `.ipynb` Python cells ## Code Organization - Follow the section `## Utilities vs. Notebook Responsibilities` from the file `.claude/skills/notebook.rules.md` for organizing utility files and notebook cells ## Reference Templates - Study these before implementing. They set the quality bar and idioms - `.claude/templates/notebook.template.py` - End-to-end notebook covering both static and interactive cell types - `.claude/templates/notebook_utils_template.py` - Paired utilities file with widget creation, state management, and visualization functions - In the title cell, right after the title, add: ```markdown - Generated by `.claude/skills/notebook.implement_outline/SKILL.md` ``` - Examples of notebooks: - `msml610/tutorials/Lesson94_Information_Theory_utils.py` - Production example with complex interactive patterns (especially `plot_joint_entropy_interactive()`) # Implementation Patterns ## Cell Structure in Notebook - Each visualization in the outline becomes a sequence of cells (a triplet of stages, with more than one cell per stage): 1. **Markdown cells (pre-viz)**: Goal, then Description split into Inputs and Panels 2. **Code cell**: Visualization / interactive widget, with a comments panel that holds only variable state 3. **Markdown cells (post-viz)**: Guided usage (one action per control plus the observation it produces, not general facts to learn), then Implementation, then the `print_obj_info()` code cell - Follow `## Visualization Cell Triplet Details` in `.claude/skills/notebook.rules.md` ## Simple Interactive Widgets - Follow `## Simple Interactive Widgets` in `.claude/skills/notebook.rules.md` ## Complex Interactive Widgets - Follow `## Complex Interactive Widgets` in `.claude/skills/notebook.rules.md` # Sync with Jupytext - After all modifications, sync the paired `.py` file with Jupytext following `# Code Architecture and Responsibility` -> `## Utilities vs. Notebook Responsibilities` in `.claude/skills/notebook.rules.md` # Verification - [ ] `--only_plan` (check only this item): the plan is in `notebook.implement_outline..md` in the current dir, has the `Generated by` line, and nothing was executed - [ ] Confirm the `.ipynb`, paired `.py`, and `*_utils.py` files are in sync via Jupytext - [ ] Run the notebook top to bottom following `## Testing Notebook` in `.claude/skills/notebook.rules.md` and confirm it completes without errors - [ ] Check that every outline cell has a corresponding notebook cell and no step from `notebook.create_outline..md` was skipped - [ ] The title cell of the notebook says that it was generated by `.claude/skills/notebook.implement_outline/SKILL.md`