splitting-oversized-modules

splitting-oversized-modules is a skill for Claude Code, Codex from PostHog/posthog-foss. It costs 197 tokens per session (2,134 once invoked), scanned A, original, MIT.

A process for splitting a very large Python module and its tests into smaller modules organized by responsibility. A module is a Python file or package that groups related code.

In plain words
What is it for?
Use it to assess and decompose an oversized logic, model, API, or test file after confirming that the file is large, has separate concerns, and is still changing.
Why use it?
It reduces how much code developers must read for a typical change and makes independently changing concerns easier to work on. The process checks that the split preserves behavior.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to assess and decompose an oversized logic, model, API, or…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/posthog/posthog-foss/splitting-oversized-modules
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 PostHog/posthog-foss --skill splitting-oversized-modules
Clone the repo
git clone --depth 1 https://github.com/PostHog/posthog-foss

Made for: Claude Code, Codex.

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 splitting-oversized-modules

README.md
[![agentmods](https://agentmods.dev/badge/skills/posthog/posthog-foss/splitting-oversized-modules.svg)](https://agentmods.dev/skills/posthog/posthog-foss/splitting-oversized-modules)
Your own site
<a href="https://agentmods.dev/skills/posthog/posthog-foss/splitting-oversized-modules"><img src="https://agentmods.dev/badge/skills/posthog/posthog-foss/splitting-oversized-modules.svg" alt="Measured on agentmods" height="20"></a>
Per session 197 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,134 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.00197 $0.02134
Opus 5 $0.00098 $0.01067
Sonnet 5 $0.00039 $0.00427
Haiku 4.5 $0.00020 $0.00213

Measured 3d ago against content hash f6dad5bf0c60, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

splitting-oversized-modules 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 3d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/split_module.py, scripts/verify_pure_move.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

.agents/skills/splitting-oversized-modules/SKILL.md · 174 lines

How it starts

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

Splitting oversized modules

A module nobody wants to open taxes every change in it, and agents pay that tax on every task because they do not carry knowledge between them. A 3000-line logic.py beside a 3000-line test_logic.py is roughly 55k input tokens of reading before a line gets written. Splitting one measured case cut the read-set 81 to 97% depending on the concern touched, while total lines grew about 5% from the repeated import headers.

So the goal is a small read-set for a typical change, not tidiness.

Is it worth doing here?

All three must hold: over roughly a thousand lines, several concerns that change independently, and something still actively changing in it. A big cohesive frozen file buys nothing. Skip generated files, and skip a file several people are mid-change in (git log --oneline -20 -- <file>).

A complexity warning on one function is a symptom of this, not a separate job. Extracting that function into helpers leaves every helper in the same file, so the read-set is unchanged and the file gets longer. Measure the file first (wc -l), and when it clears the gate, propose the split instead of the in-place extraction.

Splitting is a separate PR from whatever you came to do. Land the move as its own base PR and branch your work on top — see /stacking-prs. Never bundle it into a feature diff, and say what you are doing in one line before you start: which file, and that the split lands separately. Nobody minds the base PR; they mind finding it inside a feature diff.

If a human has not asked for the split, propose it and let them decide.

Method

Commands assume the repo root. S=.agents/skills/splitting-oversized-modules/scripts.

1. Map the symbols and assign them to concerns

uv run --no-project python $S/split_module.py <module> --skeleton > layout.json

Edit layout.json into modules named after concerns (baselines, quarantine, ci_status), not layers (helpers, utils, core). Put module-level state every module needs its own copy of — a logger, a compiled regex — under "__shared__".

Read the full file on GitHub · 174 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 3d ago First seen · 174 lines · 197 tokens per session scan A f6dad5bf0c60

Subscribe to this mod's changes

splitting-oversized-modules is a skill published in the GitHub repository PostHog/posthog-foss (714 stars, last pushed today), licensed MIT. It adds 197 tokens to every session and 2,134 once invoked, about $0.0010 per session on Opus 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.