Claude Code

Verified against Claude Code · 2026-08-03

Run a notebook data analysis with Claude Code's NotebookEdit without losing outputs

A cell-level notebook workflow prompt that has Claude Code edit a Jupyter notebook through NotebookEdit rather than a whole-file rewrite, preserving already-computed cell outputs that took real time to generate unless a cell's actual inputs changed, and requiring a stated hypothesis before an exploratory cell runs.

Claude Code5 fillable variables

The prompt

Ready to copy — highlighted parts are example details you can swap.

You are working in analysis/prompt_engagement_by_category.ipynb through the NotebookEdit tool, editing at the cell level, not regenerating the notebook file as a whole. A notebook's cell outputs, especially ones that took a long time to compute, are themselves valuable artifacts — treat re-running a cell that does not need to change as a real cost, not a free action.

ANALYSIS GOAL
Whether prompts with an exampleOutput field get meaningfully more time-on-page than prompts without one, across all tier-1 categories.

DATASET
Page-analytics export covering the last 60 days; sample size for some smaller categories is under 200 sessions, too small to treat a small difference as significant.

WHICH CELLS ARE EXPENSIVE TO RE-RUN
Cell 3, which joins the full analytics export against the prompt-library metadata and takes about four minutes to run.

WHEN AN OUTPUT MUST BE PRESERVED VERSUS RECOMPUTED
Any cell whose output depends on cell 3’s join must be re-run if cell 3 changes; cells that only reformat an already-computed result do not need cell 3 to change to stay valid.

WORKING RULES
1. Before editing any cell listed in Cell 3, which joins the full analytics export against the prompt-library metadata and takes about four minutes to run., confirm whether this specific change actually alters that cell's inputs or logic. If it does not, do not re-run it — the existing output is still valid evidence and re-running it purely out of habit wastes real time or compute for no new information.
2. Before writing and running a new exploratory cell, state the specific hypothesis it is testing — what result would confirm it, what result would disconfirm it — before executing it, not after looking at the output and narrating a story that fits whatever appeared. A cell run with no stated expectation beforehand invites explaining away a result that does not actually support the analysis's conclusion.
3. When adding a new cell, insert it at the position where it belongs in the analysis narrative, not appended at the end of the notebook regardless of where its result is actually relevant — a notebook read top to bottom should tell a coherent story, and cells scattered out of narrative order defeat that for the next person who opens this file.
4. If a change to an early cell would invalidate the output of a later cell that depends on it, per Any cell whose output depends on cell 3’s join must be re-run if cell 3 changes; cells that only reformat an already-computed result do not need cell 3 to change to stay valid., say so explicitly and either re-run the dependent cell or flag its now-stale output rather than leaving a stale result sitting uncorrected next to a change that quietly invalidated it.

FINAL CELL
End the notebook with a markdown cell summarizing the actual findings in plain language, citing the specific cells whose output supports each claim — a finding stated without pointing back to the cell that produced it is not distinguishable from a guess to anyone reviewing the notebook later.

CONSTRAINTS
- Do not silently delete an existing cell's output when editing that cell's code, unless the edit means the old output no longer corresponds to anything real; a notebook's history of what was actually tried is itself useful context for whoever reviews this analysis next.
- Cite Page-analytics export covering the last 60 days; sample size for some smaller categories is under 200 sessions, too small to treat a small difference as significant.'s actual known limitations when interpreting a result, rather than presenting a finding as more conclusive than the data underlying it can actually support.

OUTPUT
The notebook edits made, cell by cell, and the final summary cell's content.

Customize

Optional — swap in your own details for the highlighted parts above.

Why this works

NotebookEdit operates at the level of an individual cell rather than the notebook file as a whole, and that granularity is not incidental to how this prompt works, it is the entire reason cell-level discipline is possible at all — a whole-file rewrite approach has no natural place to preserve one cell's expensive output while changing another cell entirely, whereas an edit scoped to exactly the cell that needs to change can leave every other cell, including its already-computed output, untouched by construction. Treating a cell's output as a valuable artifact rather than something regenerated by default matters specifically because notebooks are the one common code format where the result of running the code is saved alongside the code itself, and a four-minute join that already ran and produced a correct result is genuinely different from four minutes of redundant recomputation that produces the identical result a second time — checking whether a given change actually touches a cell's inputs before re-running it is the difference between respecting that saved state and discarding it out of habit. Requiring a stated hypothesis before an exploratory cell runs, rather than after its output already exists, targets a specific and well-documented failure mode in exploratory analysis: a result interpreted after the fact, with no prior stated expectation to measure it against, is far more susceptible to being explained into supporting whatever conclusion the analysis was already leaning toward, since there is no earlier, uncontaminated statement of what would have counted as evidence against it. Keeping cells in narrative order rather than appended wherever convenient matters because a notebook is read top to bottom by a future reviewer who was not present while it was built, and a notebook whose cell order reflects the order things were tried rather than the order the analysis's own logic actually flows in forces that reviewer to reconstruct the real narrative themselves, precisely the same cost a flat file-by-file codebase walkthrough imposes on a new engineer. Requiring the final summary to cite the specific cell backing each claim closes the loop on the same principle — a finding stated without a pointer back to the evidence that produced it is, to anyone who did not personally watch the analysis happen, indistinguishable from an assertion made with no evidence at all.

Verified against

Claude Code Sonnet 4.6 · 2026-08-03

Changelog

  • 2026-08-03 Initial publish, verified against Claude Code NotebookEdit workflows (Sonnet 4.6).

Building this for real?

This is a free starting point. If you'd rather have custom software built and running for your business, that's Scult's day job.

EXPLORE CUSTOM SOFTWARE
All Claude Code prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY