notebook-hygiene

notebook-hygiene is a skill for Claude Code from StamKavid/last-ds-mile. It costs 71 tokens per session (886 once invoked), scanned A, original, MIT.

A guide for making computational notebooks, such as Jupyter notebooks, safe to rerun from start to finish. It checks execution order, fresh runs, and reproducibility.

In plain words
What is it for?
It is for cleaning notebooks before sharing or review, restarting the runtime, running every cell in order, checking saved outputs, and setting random seeds where needed.
Why use it?
It prevents results from depending on cells that were run earlier or out of order, which can make a notebook look correct while hiding errors.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the last-ds-mile plugin — 29 skills, 17 commands, 3 agents, 4 hooks shipped together

Good fit It is for cleaning notebooks before sharing or review, restarting the runtime, running every cell in order, checking saved outputs, and setting random seeds where needed.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/stamkavid/last-ds-mile/notebook-hygiene
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add StamKavid/last-ds-mile --skill notebook-hygiene
Clone the repo
git clone --depth 1 https://github.com/StamKavid/last-ds-mile

Made for: Claude Code.

Or install last-ds-mile, the plugin that ships this one along with the rest of its 29 skills, 17 commands, 3 agents, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for notebook-hygiene

README.md
[![agentmods](https://agentmods.dev/badge/skills/stamkavid/last-ds-mile/notebook-hygiene/github.svg)](https://agentmods.dev/skills/stamkavid/last-ds-mile/notebook-hygiene)
Your own site
<a href="https://agentmods.dev/skills/stamkavid/last-ds-mile/notebook-hygiene"><img src="https://agentmods.dev/badge/skills/stamkavid/last-ds-mile/notebook-hygiene/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for notebook-hygiene

Your own site · 80×15
<a href="https://agentmods.dev/skills/stamkavid/last-ds-mile/notebook-hygiene"><img src="https://agentmods.dev/badge/skills/stamkavid/last-ds-mile/notebook-hygiene.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 71 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 886 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00071 $0.00886
Opus 5.5 $0.00028 $0.00354
Sonnet 5.5 $0.00014 $0.00177
Haiku 4.5 $0.00007 $0.00089

Measured 1mo ago against content hash aba176afcd20, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

notebook-hygiene scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/notebook-hygiene/SKILL.md · 73 lines

How it starts

The opening of the file, as written. The whole thing — 73 lines — stays where its author put it; the contents beside it link to each section on GitHub.

notebook-hygiene

Overview

A notebook is only as trustworthy as its ability to be rerun from a blank kernel and produce the same result — this skill is the concrete checklist for that property, which is otherwise easy to lose one out-of-order cell execution at a time.

When to Use

  • Before considering exploratory work "done" — especially before /ds-handoff.
  • A notebook has been edited/re-run out of order and you're not sure its current displayed output matches what the code would actually produce.
  • NOT for: environment pinning itself (that's /ds-handoff's Gate Check) — this skill is about the notebook's own internal consistency, handoff is about the surrounding environment.

Core Process

  1. Before finishing a session, do a Restart & Run All (or the script equivalent: run the whole file fresh, top to bottom, in a new process) and confirm it completes without error and without needing manual intervention.
  2. Check that cell execution order in the saved notebook matches top-to-bottom order — a notebook where cell 12 was run before cell 5 can display results that don't match a fresh run, even though it "looks fine" right now.
  3. Set random seeds explicitly wherever randomness is used (splits, model init, resampling) — an unset seed makes "restart and run all" produce different numbers each time, which looks like a reproducibility failure even when the code is correct.
  4. Remove or clearly mark any manual/interactive step (a value pasted in by hand, a file path typed once and never reused) that a rerun would silently skip.

Techniques/Patterns

Hygiene issue How it shows up Fix
Out-of-order execution Cell numbers in the saved notebook aren't sequential top to bottom Restart & Run All before saving; if a cell must run early for exploration, don't leave the notebook in that state as "final"
Hidden global state A later cell depends on a variable set by a cell above it that's since been deleted or edited Restart & Run All will catch this immediately — that's exactly why it's step 1, not a nice-to-have
Unset random seeds Rerunning produces different train/test splits, different model coefficients, different plots Set random_state/np.random.seed/torch.manual_seed explicitly, once, near the top
Notebook-as-production-code A notebook with real business logic that nobody can run non-interactively For anything beyond exploration, extract the logic into a plain .py module/script the notebook imports and calls — the notebook becomes a thin driver, not the source of truth

Read the full file on GitHub · 73 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 73 lines · 71 tokens per session scan A aba176afcd20

Subscribe to this mod's changes

notebook-hygiene is a skill published in the GitHub repository StamKavid/last-ds-mile (3 stars, last pushed 7d ago), licensed MIT. It adds 71 tokens to every session and 886 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

audit-ml-pipeline

Read-only audit of one persisted skore report: audit/NN .py (jupytext percent), 1:1 with experiments/ and journal/. Do not execute it. Run materialize.py once. Never call skore.evaluate or project.put. TRIGGER when a completed run needs an audit, the user asks to audit, show, or re-audit an experiment, a re-run…

probabl-ai/skills · 258 tokens

model-ml-pipeline

Deterministic entry point for modeling. On a first landing, write the locked baseline design note and ask for approval. Later landings offer only the choices the workspace justifies (an EDA proposal, Backlog, discussion). A missing modeling lock loads frame-ml-problem and stops. After a design is approved, coordinate…

probabl-ai/skills · 117 tokens

evaluate-ml-pipeline

Evaluate one learner with skore.evaluate. The splitter and any non-default score are already on the DataOp from build-ml-pipeline. This skill writes the call without splitter=, persists the report, and records the locator. When the locked split is the training table and test table that shipped with the data, fit on…

probabl-ai/skills · 222 tokens

frame-ml-problem

Record the problem, the deployment setting, the comparison metric, the baseline, and the fold count in the journal before model code. Ask every missing decision in one turn, from frame show. Does not write Python, estimator hyperparameters, or splitter constructors. TRIGGER when the user asks which metric to compare…

probabl-ai/skills · 225 tokens

export-ml-notebook

Write a jupytext percent # %% Python file out as an .ipynb. dataanalysis/, experiments/, and audit/ are filled with empty outputs. Pass --html when that notebook should also become a viewer on the site. Kernel notebook convert stays for a source that is itself the execution. Trigger on notebook, ipynb, HTML, or…

probabl-ai/skills · 105 tokens

search-ml-literature

Search scientific and technical sources for a query and, after the user picks and confirms one direction, write one idea file and its Ideas row. Comes after review, beside the backlog. Do not call research-ml-practice. Do not write History, Backlog, or a design note. Do not pick a winner.

probabl-ai/skills · 70 tokens