Updates and validates Jupyter notebooks comprehensively: refreshes figures and TOC, verifies references, data coherence, cell order, and documentation quality.
npx claudepluginhub joshuarweaver/cascade-ai-ml-engineering --plugin delphine-l-claude-globalglobal/Update and validate a Jupyter notebook comprehensively after making changes to code, figures, or data. ## Your Task This command performs a multi-stage validation and update of Jupyter notebooks to ensure: - All figure references are current and correct - Table of contents matches actual sections - Variable names and data are consistent - Cell execution order is logical - Documentation is coherent ### Step 1: Identify Target Notebook Ask user which notebook to update, or auto-detect if context is clear: ### Steps 2-4: Pre-Update Analysis and Validation Analyze notebook structure, va...
/update-notebookForce notebook update when AI doesn't auto-update. Use when you've discovered important facts that should be recorded.
Update and validate a Jupyter notebook comprehensively after making changes to code, figures, or data.
This command performs a multi-stage validation and update of Jupyter notebooks to ensure:
Ask user which notebook to update, or auto-detect if context is clear:
# List all notebooks in current directory
notebooks=$(find . -maxdepth 2 -name "*.ipynb" ! -path "*/.*" | sort)
if [ -z "$notebooks" ]; then
echo "No Jupyter notebooks found in current directory"
exit 1
fi
# Count notebooks
nb_count=$(echo "$notebooks" | wc -l | tr -d ' ')
if [ "$nb_count" -eq 1 ]; then
notebook_path="$notebooks"
echo "Found notebook: $notebook_path"
else
echo "Found $nb_count notebooks:"
echo "$notebooks" | nl
echo ""
echo "Which notebook to update? (enter number or path)"
fi
Analyze notebook structure, validate figure references, and check data coherence.
Full details: See validation-checks.md
Summary of checks performed:
Pre-Update Analysis (Step 2) - Load notebook, count cells by type, detect TOC, extract figure references, data references, and section structure.
Figure Reference Validation (Step 3) - Extract figure numbers from descriptions and code cells. Check for: missing descriptions, missing image displays, non-adjacent figure/description pairs, non-sequential numbering, missing figure files on disk. Generate a validation report.
Variable and Data Coherence (Step 4) - Extract variable assignments and dataframe operations from code cells. Check markdown for sample size mentions and file references. Flag inconsistent sample sizes, missing referenced files, and undefined variables.
Update table of contents and validate figure legend quality.
Full details: See toc-and-legends.md
Summary of checks performed:
Table of Contents Update (Step 5) - Extract all section headers, build hierarchy, generate new TOC with proper anchors. Compare with existing TOC and flag if update needed. Offer to insert TOC if none exists.
Figure Legend Validation (Step 6) - For each figure, check description quality: minimum length (50 chars), presence of method keywords (plot type), data info keywords (sample details), and statistical keywords. Report issues per figure.
Present update options, execute selected fixes, and re-validate.
Full details: See execute-updates.md
Summary of operations:
Interactive Menu (Step 7) - Present numbered list of recommended fixes: figure renumbering, TOC update, adjacency fixes, missing descriptions, data reference fixes, or "verify all" option.
Execute Updates (Step 8) - Fix figure numbering (reverse-order replacement to avoid collisions), update TOC cell content, move description cells adjacent to image cells.
Post-Update Validation (Step 9) - Re-run all validation checks to confirm issues are resolved.
Create backup, save notebook, and generate change summary.
Full details: See save-and-reference.md
Summary:
Save (Step 10) - Create timestamped backup, then write updated notebook JSON.
Summary (Step 11) - Report all changes made (renumbering, TOC, adjacency, data fixes), validation results, and next steps (review, re-run cells, commit, remove backup).
jq to extract structure without reading full notebook:
jq -r '.cells[] | select(.cell_type=="markdown") | .source | join("")' notebook.ipynb | grep "^#"
jq + grepMore tips and examples: See save-and-reference.md