skills/notebook-debug/SKILL.md
This skill should be used when the user asks to "debug notebook", "inspect notebook outputs", "find notebook error", "read traceback from ipynb", "why did notebook fail", or needs to understand runtime errors in executed Jupyter notebooks from any source (marimo, jupytext, papermill).
npx skillsauth add edwinhu/workflows notebook-debugInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill covers inspecting executed .ipynb files to debug runtime errors, regardless of how the notebook was created (marimo, jupytext, or plain Jupyter).
If debugging within a /ds workflow, first read .planning/LEARNINGS.md for pipeline context and .planning/PLAN.md for task expectations.
Before claiming ANY notebook executed successfully, you MUST:
This is not negotiable. Skipping traceback checks is NOT HELPFUL — the user opens a notebook that throws errors on first run.
.py source file directly loses cell-level outputs and error attribution. Execute to ipynb first, then inspect.outputs[].text — it misses stderr and structured error outputs. Use BOTH the quick check AND the Read tool.execution_count: null — a middle-cell failure is invisible unless you verify every cell executed.Before claiming "notebook works":
Execution:
--include-outputs flag (for marimo)Traceback Check:
jq -r '.cells[].outputs[]?.text[]?' | grep "Traceback"jq '[.cells[].outputs[]? | select(.output_type == "error")] | length'Cell Execution:
Output Inspection:
Claim success only after:
Apply this verification sequence for every notebook debugging task:
1. EXECUTE → Run to ipynb with outputs
2. CHECK → Quick traceback/error count check
3. READ → Full inspection with Read tool if errors
4. VERIFY → All cells executed, outputs as expected
5. CLAIM → "Notebook works" only after all gates passed
Never skip any gate. Each gate catches different failure modes.
Converting and executing notebooks to ipynb captures:
This makes debugging much easier than reading raw .py source.
# Export marimo notebook to ipynb with outputs
marimo export ipynb notebook.py -o __marimo__/notebook.ipynb --include-outputs
# Convert jupytext to ipynb and execute with outputs
jupytext --to notebook --output - script.py | papermill - output.ipynb
# Execute existing ipynb notebook to capture outputs
papermill input.ipynb output.ipynb
| | jq | Read tool | |------------------|-------------------------------|---------------------| | Output | Raw JSON with escaped strings | Clean rendered view | | Error visibility | Buried in outputs array | Inline after cell | | Cell context | Need to piece together | Cell IDs visible | | Scripting | Better for automation | Not scriptable |
Verdict: Use Read for debugging/inspection, jq for scripting/CI.
# Check for tracebacks in notebook outputs
jq -r '.cells[].outputs[]?.text[]?' notebook.ipynb | grep "Traceback"
# Count error outputs in notebook
jq '[.cells[].outputs[]? | select(.output_type == "error")] | length' notebook.ipynb
The Read tool renders ipynb with errors inline after the failing cell:
<cell id="MJUe">raise ValueError("intentional error")</cell>
Traceback (most recent call last):
File "/path/to/notebook.py", line 5, in <module>
raise ValueError("intentional error")
ValueError: intentional error
<cell id="vblA">y = x + 10 # depends on x, not the error cell</cell>
Benefits:
Use the Read tool to inspect the notebook and locate tracebacks:
# Read notebook to find traceback location inline after failing cell
Read __marimo__/notebook.ipynb
Identify cells that did not execute:
# Find cells with null execution_count (not executed)
jq '.cells[] | select(.execution_count == null) | .source[:50]' notebook.ipynb
Gather all error outputs from executed cells:
# Extract error tracebacks from all cells
jq -r '.cells[].outputs[]? | select(.output_type == "error") | .traceback[]' notebook.ipynb
Execute notebook with outputs captured:
# Export marimo notebook to ipynb format with all outputs
marimo export ipynb nb.py -o __marimo__/nb.ipynb --include-outputs
Run quick failure check:
# Check if execution produced tracebacks
jq -r '.cells[].outputs[]?.text[]?' __marimo__/nb.ipynb | grep -q "Traceback" && echo "FAILED"
Inspect notebook using Read tool:
# Read the full notebook to identify failing cells and their errors
Read __marimo__/nb.ipynb
Fix source code and re-run to verify
development
Build the meeting-level proxy-voting × ownership panel on the WRDS SGE grid — ISS N-PX fund votes reduced to (item × block) direction cells, joined to institutional and mutual-fund ownership. Use when working with risk.voteanalysis_npx, N-PX fund-level votes, ISS→CRSP fund linking, index/passive/active voting blocks, or a proxy-voting panel that needs ownership attached.
development
Use when "CRSP CIZ", "CRSP v2", "CRSP flat file format 2.0", "crsp.dsf_v2 / msf_v2", "StkDlySecurityData", "StkMthSecurityData", "StkSecurityInfoHist", "stocknames_v2", "DlyRet / MthRet / DlyPrc / MthPrc", "SHRCD or EXCHCD equivalent in new CRSP", "SIZ to CIZ migration", "CRSP data after 2024", "CRSP delisting returns", "CRSP cumulative adjustment factors", "CRSP index INDNO / INDFAM", or any CRSP stock/index query where the legacy SIZ column names no longer exist.
development
Use when linking or deduping datasets by entity name rather than a shared key — 'fuzzy match', 'fuzzy name matching', 'entity resolution', 'record linkage', 'match company/person names', 'dedupe entity names', 'name-based join', 'bridge identifiers' (CIK ↔ permno ↔ gvkey ↔ wficn ↔ EIN ↔ personid), or any use of char n-gram TF-IDF, cosine similarity on names, `sparse_dot_topn`, or RapidFuzz at scale.
development
Use when building a publication-quality table in Python — 'regression table', 'results table', 'summary statistics table', 'etable', 'coefplot', 'great_tables', 'GT', 'gt table', 'format a table for the paper', 'export table to LaTeX/HTML', significance stars, spanners, or column formatting for a table headed into a paper, slide deck, or notebook.