notebook

Edit Jupyter notebook (.ipynb) cells — insert, replace, or delete cells. Use when working with notebooks.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "notebook" with this command: npx skills add ninehills/skills/ninehills-skills-notebook

Notebook Edit Skill

Modify Jupyter notebook cells using jq and bash.

List Cells

# Show all cells with IDs and types
jq -r '.cells | to_entries[] | "\(.key): [\(.value.cell_type)] id=\(.value.id // "none") | \(.value.source[:1] | .[0] // "" | .[0:80])"' NOTEBOOK.ipynb

Replace a Cell's Source

# Replace cell by index (0-based)
jq --arg src "print(\"hello world\")\n" \
   '.cells[0].source = ($src | split("\n") | map(if . == "" then . else . + "\n" end) | .[:-1])' \
   NOTEBOOK.ipynb > /tmp/nb_tmp.ipynb && mv /tmp/nb_tmp.ipynb NOTEBOOK.ipynb

Insert a New Cell

# Insert a code cell after index 2
jq --arg src "# New cell\nprint(42)\n" \
   '.cells |= (.[0:3] + [{
     "id": ("new-" + (now | tostring)),
     "cell_type": "code",
     "source": ($src | split("\n") | map(if . == "" then . else . + "\n" end) | .[:-1]),
     "metadata": {},
     "outputs": [],
     "execution_count": null
   }] + .[3:])' \
   NOTEBOOK.ipynb > /tmp/nb_tmp.ipynb && mv /tmp/nb_tmp.ipynb NOTEBOOK.ipynb

Delete a Cell

# Delete cell at index 1
jq 'del(.cells[1])' NOTEBOOK.ipynb > /tmp/nb_tmp.ipynb && mv /tmp/nb_tmp.ipynb NOTEBOOK.ipynb

Tips

  • Always read the notebook first to understand its structure
  • Notebook source lines should end with \n except the last line
  • Use jq for reliable JSON manipulation
  • Back up the notebook before complex edits
  • For simple edits, you can also use the Read/Write tools directly on the JSON

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

self-reflection

No summary provided by upstream source.

Repository SourceNeeds Review
General

tvscreener

No summary provided by upstream source.

Repository SourceNeeds Review
General

send-file

No summary provided by upstream source.

Repository SourceNeeds Review
General

news-aggregator-skill

No summary provided by upstream source.

Repository SourceNeeds Review