AGENT SKILL

notebook.implement_outline

Implement a Jupyter notebook with widgets from an outline description

License 许可
Apache-2.0
所属仓库
causify-ai/helpers
最近更新
2026-11-02
Stars
★ 0
Forks
1

01 前言 Front Matter

model
opus
description
Implement a Jupyter notebook with widgets from an outline description

03 SKILL.md 正文

Goal

  • Input: A notebook_outline.<TAG>.md outline file describing 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: A Python file paired using jupytext to the .ipynb using py:percent
    3. *_utils.py file: Reusable helper functions for the notebook code
  • Purpose: Implement the pedagogical design as a fully executable, interactive notebook
  • Each visualization follows the triplet structure:
    • Pre-visualization markdown (goal, then the input/panel description)
    • Code cell (visualization / interactive widget)
    • Post-visualization markdown (guided usage: actions plus observations, then the implementation followed by the print_obj_info() code cell)

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) to the notebook
  • Follow the separation principle: Utilities contain implementation; notebook contains only function calls

Key Conventions

  • Follow .claude/skills/notebook.rules.md: 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 outline cell format from .claude/skills/notebook.create_outline/SKILL.md
  • Follow .claude/skills/coding.rules.md for Python code in *_utils.py and in the Python cells in .ipynb file
  • Follow .claude/skills/notebook.rules.md # Code Architecture and Responsibility -> ## Utilities vs. Notebook Responsibilities for organizing utility files and notebooks

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 establish 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
  • 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 the cell sequence (triplet of stages, 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 comments panel containing 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
  • Make sure to follow the section ## Visualization Cell Triplet Details from the file .claude/skills/notebook.rules.md

Simple Interactive Widgets

  • Follow the conventions in .claude/skills/notebook.rules.md ## Simple Interactive Widgets

Complex Interactive Widgets

  • Follow the conventions in .claude/skills/notebook.rules.md ## Complex Interactive Widgets

Sync with Jupytext

  • After all modifications are complete, sync the paired .py file with Jupytext following the conventions in # Code Architecture and Responsibility -> ## Utilities vs. Notebook Responsibilities in .claude/skills/notebook.rules.md

Verification

  • [ ] 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_outline.<TAG>.md was skipped

04 同仓库更多 Skills