FormingSkillclaude-codepublished fresh until

How do I let Claude Code edit a Jupyter notebook safely?

Summary As of October 2026, Claude Code's tools reference says notebooks are edited cell by cell with NotebookEdit (replace, insert, delete by cell_id), not by text replacement, reads return all cells with outputs, and a notebook over 256 KB or the token limit errors on read instead.

Not for running or scheduling notebooks, or Python test setup, see are-agent-written-unit-tests-worth-it

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The option

Option
ASkill · v1.0.0Check notebook outputs after a cell replacement
How you use itYou ask for it
What it can dowrites files · runs shell
What's inside
ASkill · v1.0.0Check notebook outputs after a cell replacement
How you use it
You ask for it
What it can do
writes files · runs shell
What's inside

What this thread does

The problem

You ask Claude Code to change a few cells in a Jupyter notebook. A .ipynb file is one JSON document with code, markdown and saved outputs, so a plain text edit can easily corrupt it, and a notebook full of plots can be too large to read in one go.

What the Claude Code docs say

From the tools reference (Anthropic's documentation):

  • There is a dedicated NotebookEdit tool that "modifies a Jupyter notebook one cell at a time", targeting cells by their cell_id. It does not do string replacement across the notebook the way Edit does on plain files.
  • Its modes include replacing a cell, inserting a cell after a target (with no cell_id the new cell goes at the start; cell_type must be code or markdown), and deleting a cell.
  • Read on a .ipynb returns all cells with their outputs. A notebook whose cells come to more than 256 KB, or more than the read token limit, returns an error instead, and a file over 100 MB is refused; the error tells Claude how to read a slice of cells with a shell command.
  • NotebookEdit refuses a file that is not valid UTF-8 and writes nothing.
  • Permission rules written as Edit(path) also cover NotebookEdit calls, so a rule like Edit(notebooks/**) controls both.

Practical wording for your prompt

Edit the notebook with the notebook tool, one cell at a time. Tell me the cell index and the first line of each cell before you change it. Do not rewrite the whole file and note that replacing a code cell clears its execution count and saved outputs. If the notebook is too large to read, read only the cells you need.

Habits that follow from the docs

  • Commit the notebook before the session so a bad edit is a one-command revert.
  • If reads fail on size, clear outputs first (with the tool you already use for that) or ask the agent to read a slice of cells.
  • Keep notebooks under a path your permission rules name, so edits are allowed or blocked in one place.

Sources

  • Claude Code tools reference was read, specifically NotebookEdit and Read. Checked: cell_id targeting; replace, insert and delete modes; insertion before all cells when no cell_id is supplied; required code or markdown cell_type for insertion; invalid UTF-8 refusal without writes; Edit path rules also cover NotebookEdit. Read returns notebook cells and outputs, errors above 256 KB of cells or the token limit, refuses notebook files over 100 MB, and suggests shell-based cell slices. The allow_large text-file option does not lift notebook limits.

The prompt and workflow are suggestions, not tested guarantees about preserving outputs. No notebook or third-party code was run.

Started from a post by @Anthropic Claude Code documentation, packaged by the editor. Original post

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I let Claude Code edit a Jupyter notebook safely?
Summary: As of October 2026, Claude Code's tools reference says notebooks are edited cell by cell with NotebookEdit (replace, insert, delete by cell_id), not by text replacement, reads return all cells with outputs, and a notebook over 256 KB or the token limit errors on read instead.

## Options
- A · Check notebook outputs after a cell replacement · early, no verdict yet · writes files · runs shell
Copy for agent
get the whatworks thread claude-code-edit-jupyter-notebook-ipynb-without-breaking-it and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-edit-jupyter-notebook-ipynb-without-breaking-it

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · Check notebook outputs after a cell replacement

Compares before and after notebook JSON for a cell-replacement workflow and rejects changed cell identities, saved outputs or execution counts.

Format
Skill
Source
—
Pinned
v1.0.0 · sha256:17fc4
Content hash
17fc4aa5d121c671
Audit
scan passed
Can do
writes files · runs shell
Works with
claude-code
Check
Verifies exact installed SKILL.md and runs bundled positive and rejection fixtures without changing project files.
Author
@WhatWorks
Kudos
0

This package has no public source link yet.

Are you @WhatWorks? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package ww-notebook-check before installing
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp