extract-module-from-notebook

Extract reusable functions from Jupyter notebooks into src modules.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/sunLeee/optimization --skill extract-module-from-notebook
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extract-module-from-notebook
Source: https://github.com/sunLeee/optimization/tree/main/.claude/skills/utility/extract-module-from-notebook
Command: npx skills add https://github.com/sunLeee/optimization --skill extract-module-from-notebook

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Jupyter Notebook에서 반복 사용되는 함수를 자동으로 src/ 모듈로 추출한다. convention-jupyter-setup의 '함수 3개 이하' 규칙 준수를 자동화한다.

Core Features & Use Cases

  • 노트북 내 공용 함수들을 src 모듈로 리팩토링하여 재사용성을 높인다.
  • 추출된 모듈에서 자동으로 import 문을 생성하고 노트북 정리 흐름을 지원한다.
  • 대규모 노트북에서 함수 관리와 유지보수를 용이하게 한다.

Quick Start

Run /extract-module-from-notebook <notebook_path> [--threshold 3] to extract eligible functions into a reusable src module.

Frequently Asked Questions about extract-module-from-notebook

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract functions from a Jupyter Notebook into a reusable Python module?

To extract functions from a Jupyter Notebook, you can automate refactoring frequently used helper functions into a src module. This process identifies eligible functions, generates the module, and updates the notebook with the necessary import statements.

What is the best way to refactor a large Jupyter Notebook for better maintainability?

Refactoring a large Jupyter Notebook involves moving shared helper functions into separate src modules. This modularization approach reduces clutter, increases code reuse, and makes ongoing maintenance significantly easier across complex notebooks.

How do I automatically generate import statements when moving notebook functions to a src directory?

When moving notebook functions to a src directory, the extraction process automatically generates the required import statements. It updates the original notebook code cells to reference the newly created src modules, ensuring the refactored notebook runs correctly.

Can I set a threshold for the number of functions allowed in a Jupyter Notebook before refactoring?

Yes, you can set a threshold for notebook functions before refactoring. By passing a threshold parameter, such as three, the extraction targets notebooks that exceed the specified limit of helper functions and moves them to a src module.

When should I modularize Python notebook functions into separate files?

You should modularize Python notebook functions into separate files when you have multiple reusable helper functions. Moving them to a src module prevents code duplication, supports better refactoring workflows, and improves long-term project maintainability.