Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

splitting-oversized-modules

Skill by PostHog

Splits an oversized Python module into a package with one module per concern, as a pure move that leaves behavior unchanged. Aimed at developers and agents working with 1000-plus-line files.

  • Score 85
  • 41k stars
  • NOASSERTION
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install splitting-oversized-modules

Built from the published package, never by AI.

git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.claude/skills && cp -r /tmp/posthog/.agents/skills/splitting-oversized-modules ~/.claude/skills/splitting-oversized-modules

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install splitting-oversized-modules in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This agent skill guides splitting a Python module of roughly a thousand or more lines, such as logic.py, models.py, api.py or its test file, into a package with one module per concern. It starts with a worth-it gate: the file should be large, hold several concerns that change independently, and still be actively changing. The skill says to propose the split before doing it and to land it as a separate base PR.

The method maps symbols to concerns using an acyclic dependency graph, then runs an AST plus tokenize move script. The script copies each symbol verbatim and refuses to run unless the layout covers every symbol exactly once. The skill also retargets callers and mock patch targets, splits the matching tests, and runs verify_pure_move.py to compare definitions before and after. It is written for Python code only.

Written from the project's SKILL.md and checked against it.

What it can do

  • Worth-it gateChecks file size, independent concerns and recent changes before proposing a split.
  • Symbol layoutAssigns functions and classes to concern-named modules using an acyclic dependency graph.
  • Move scriptCopies symbols by AST line range and requalifies cross-module references with tokenize.
  • Caller retargetingUpdates calls and mock patch targets, including fixtures in conftest.py.
  • Test splitMirrors the package in the tests and assigns whole test classes to matching modules.
  • Pure move verificationUses verify_pure_move.py to compare every top-level definition before and after the split.

What you need

  • Python
  • uv
  • ruff
  • git
  • hogli for running the test suite

Try asking

  • Check whether logic.py is worth splitting before we change it
  • Split models.py into a package with one module per concern
  • Run verify_pure_move.py to confirm the split changed no behavior

Good to know

  • Python only; frontend files use the writing-ui-components skill.
  • Not for extracting shared helpers into common/ or moving code between products.
  • Static checks cover imports and equivalence, not behavior, so the test suite must also run.
  • A models.py split needs aggregation imports in models/__init__.py.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: .agents/skills/splitting-oversized-modules/SKILL.md, .agents/skills/splitting-oversized-modules/scripts/split_module.py, .agents/skills/splitting-oversized-modules/scripts/verify_pure_move.py. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md9 KB
  • scripts/split_module.py14 KB
  • scripts/verify_pure_move.py5 KB

Alternatives to splitting-oversized-modules

All alternatives →
openclaw-github-repo-commandersickn33
94

Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.

AAA Skill 50k
gradiogradio-app
94

Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.

AAA Skill 44k
hig-components-menussickn33
94

Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.

AAA Skill 50k
fastapi-templateswshobson
94

Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.

AAA Skill 43k
appfunctionsandroid
94

Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.

AAA Skill 11k
agent-qa-authoringsickn33
94

Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.

AAA Skill 50k

Compare with openclaw-github-repo-commander, gradio or hig-components-menus

splitting-oversized-modules: common questions

Why not extract helpers inside the same file instead?

The source says extracting helpers in place leaves every helper in the same file, so the read-set is unchanged and the file gets longer.

Why should the split land as its own PR?

The source says to land the move as a separate base PR and branch the feature work on top, so reviewers do not find it inside a feature diff.

How does the skill check that the split changed no behavior?

It runs verify_pure_move.py, which compares every top-level definition before and after, ignoring module qualification and relative-import depth.

How do I install splitting-oversized-modules?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is splitting-oversized-modules free?

The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.

Is splitting-oversized-modules safe to use?

It scores 85 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to splitting-oversized-modules?

Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.

splitting-oversized-modules Install

Add to stack

Loading.