Claude-skill-registry fix_notebook
ノートブックのエラーを、そのノートブック自体の修正(セル内容・JSONスキーマ)またはソースコードの修正により解決する
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/fix-notebook" ~/.claude/skills/majiayu000-claude-skill-registry-fix-notebook && rm -rf "$T"
manifest:
skills/data/fix-notebook/SKILL.mdsource content
Fix Notebook Errors
This skill handles fixing errors encountered during notebook execution, ranging from Python code bugs to Jupyter JSON schema violations.
Instructions
-
Analyze the Failure:
- Examine the traceback to determine if the error is in the notebook cell's logic, a JSON schema violation, or the underlying library.
-
Strategy A: Fix Code Cell (Local):
- If the usage is wrong, imports are missing, or data paths are incorrect, edit the
cells..ipynb - Modify the
field of the failing code cell in the notebook JSON."source" - Unit-Safe Assignment: When updating
objects, preferastropy.units
to keep metadata.series.value[:] = new_data
- If the usage is wrong, imports are missing, or data paths are incorrect, edit the
-
Strategy B: Fix JSON Schema:
- If
or validators fail with "Additional properties are not allowed ('id' was unexpected)":nbconvert - Remove Cell IDs: Delete the
key from all cells in the JSON."id" - Normalize nbformat_minor: Set
tonbformat_minor
(if4
is 4) to prevent auto-adding IDs.nbformat
- If
-
Strategy C: Fix Library Source Code:
- If the bug is in the
package, trace it to the source file and apply the fix.gwexpy/
- If the bug is in the
-
Verification:
- Re-run the notebook using
orjupyter nbconvert --execute
to confirm it passes.test_notebooks
- Re-run the notebook using
# Utility for Strategy B import json def fix_nb_schema(path): with open(path, 'r') as f: data = json.load(f) for cell in data.get('cells', []): cell.pop('id', None) if data.get('nbformat') == 4 and data.get('nbformat_minor', 0) >= 5: data['nbformat_minor'] = 4 with open(path, 'w') as f: json.dump(data, f, indent=1)