python-module-to-package-refactor

Community

Patch-targeted module-to-package refactor guide.

Authorshimo4228
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Splitting a large Python module into a package often breaks unit tests because unittest.mock.patch targets still refer to the old flat module path. This skill provides clear rules to update patch targets so tests mock the correct lookup path at runtime, preserving test reliability during refactors.

Core Features & Use Cases

  • Update patch targets to reflect the actual lookup path after refactoring the module into a package.
  • Provide a bottom-up migration checklist for creating the package structure with init.py re-exports.
  • Ensure test compatibility by validating patch paths across multiple modules and test suites.

Quick Start

Split the module into a package and update all patch targets to reflect where names are looked up at runtime.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: python-module-to-package-refactor
Download link: https://github.com/shimo4228/claude-code-learned-skills/archive/main.zip#python-module-to-package-refactor

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.