notebook.refactor_to_utils

notebook.refactor_to_utils is a skill for Claude Code from causify-ai/helpers. It costs 12 tokens per session (878 once invoked), scanned A, original, Apache-2.0.

A Python notebook-refactoring guide that moves reusable code into a separate utilities file. It keeps the notebook focused on the explanation and workflow while the utility file holds shared functions.

In plain words
What is it for?
Extracting functions from a Jupyter notebook, adding new helper code, and synchronizing the notebook with its paired Python file using Jupytext.
Why use it?
It reduces duplicated or hidden code in notebooks and makes reusable parts easier to maintain and test.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; reads .claude/ paths.

Good fit Extracting functions from a Jupyter notebook, adding new helper code, and synchronizing the notebook with its paired Python file using Jupytext.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/causify-ai/helpers/notebook.refactor_to_utils
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 causify-ai/helpers --skill notebook.refactor_to_utils
Clone the repo
git clone --depth 1 https://github.com/causify-ai/helpers

Made for: Claude Code.

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.refactor_to_utils

README.md
[![agentmods](https://agentmods.dev/badge/skills/causify-ai/helpers/notebook.refactor_to_utils/github.svg)](https://agentmods.dev/skills/causify-ai/helpers/notebook.refactor_to_utils)
Your own site
<a href="https://agentmods.dev/skills/causify-ai/helpers/notebook.refactor_to_utils"><img src="https://agentmods.dev/badge/skills/causify-ai/helpers/notebook.refactor_to_utils/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.refactor_to_utils

Your own site · 80×15
<a href="https://agentmods.dev/skills/causify-ai/helpers/notebook.refactor_to_utils"><img src="https://agentmods.dev/badge/skills/causify-ai/helpers/notebook.refactor_to_utils.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 12 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 878 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 4 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium MCP Rug Pull · line 16
    uvx/uv tool run commands without ==version create a rug-pull risk.
    Fix: Pin the version: uvx package-name==1.2.3
  • medium MCP Rug Pull · line 17
    uvx/uv tool run commands without ==version create a rug-pull risk.
    Fix: Pin the version: uvx package-name==1.2.3
  • medium MCP Rug Pull · line 107
    uvx/uv tool run commands without ==version create a rug-pull risk.
    Fix: Pin the version: uvx package-name==1.2.3
  • medium Excessive Agency · line 3
    Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
    Fix: Remove the model/provider override or disclose it prominently and require explicit operator approval before invoking an external coding CLI or billed model.
How audits are shown
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.00012 $0.00878
Opus 5.5 $0.00005 $0.00351
Sonnet 5.5 $0.00002 $0.00176
Haiku 4.5 $0.00001 $0.00088

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

Security

Grade A, and why

notebook.refactor_to_utils 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.

.claude/skills/notebook.refactor_to_utils/SKILL.md · 127 lines

How it starts

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

Goal

  • You are an expert Python developer

  • I will pass you a Python file paired with a Jupyter notebook using jupytext in py:percent format

Constraints

  • For all the code follow the rules from .claude/skills/coding.rules.md

  • Important Notes

    • Always sync before editing: uvx jupytext --sync notebook.py
    • Always sync after editing: uvx jupytext --sync notebook.py

Scenarios

  • This skill handles two complementary scenarios:

Scenario 1: Moving Existing Functions to Utils

  • When you need to extract functions from an existing notebook and move them to utils

Scenario 2: Adding New Code to Utils

  • When you need to add new functions or code to an existing utils file corresponding to the notebook

Workflow

Identify or Create the Utils File

  • Find or create the library/utility file that corresponds to the notebook
    • Naming convention: Notebook name with underscores
    • E.g., Lesson94-Information_Theory.ipynb -> Lesson94_Information_Theory_utils.py
    • E.g., tutorial_advanced.ipynb -> tutorial_advanced_utils.py

Organize Code Structure in Utils File

  • The utils file should have a structure that mirrors the flow of the notebook

  • Use section separators to organize code by notebook sections

    • Example:
      # #############################################################################
      # Cell 1: Visual Bin - Population of Marbles
      # #############################################################################
      
      def cell1_draw_bin_with_marbles_interactive(...):
          ...
      
      def _cell1_helper_function(...):
          ...
      
      # #############################################################################
      # Cell 2: Entropy Calculations
      # #############################################################################
      
      def cell2_calculate_entropy(...):
          ...
      
  • Add the functions in the part of the utility file that corresponds to the notebook

  • Group related functions together

  • Use private functions (prefix with _) for helpers not called from the notebook

Read the full file on GitHub · 127 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 Changed · +14 lines fe2feddb0d45
  2. 1mo ago First seen · 113 lines · 12 tokens per session scan A b44d58ed302c

Subscribe to this mod's changes

notebook.refactor_to_utils is a skill published in the GitHub repository causify-ai/helpers (152 stars, last pushed today), licensed Apache-2.0. It adds 12 tokens to every session and 878 once invoked, about $0.0000 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-09-03.