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.
npx skills add PostHog/posthog-foss --skill splitting-oversized-modulesgit clone --depth 1 https://github.com/PostHog/posthog-fossWrote 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.
[](https://agentmods.dev/skills/posthog/posthog-foss/splitting-oversized-modules)<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>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.
| Model | Per session | Once 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 |
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.
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.
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__".
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.
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.
- 3d ago First seen · 174 lines · 197 tokens per session scan A f6dad5bf0c60
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.
Other skills, from other repositories
mcore-linting-and-formatting
Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.
splitting-oversized-modules
Split an oversized Python module (a thousand-plus-line logic.py, models.py, api.py, or its test file) into a package of one module per concern, mechanically and provably without changing behavior. Use on a request to split / break up / decompose a god module or move functions out of one, once a human has agreed to…
plankton-code-quality
Write-time code quality enforcement using Plankton — auto-formatting, linting, and Claude-powered fixes on every file edit via hooks.
coding.make_function_private
Identify private / public functions in a file and rename them with an underscore or not.
code-review-python
Provides Python-specific code review rules for the dh code-reviewer agent. Activates on pyproject.toml or .py file detection — enforces uv, ruff, ty, pytest, type annotation, error handling, and Python 3.11+ idioms including pathlib, match statements, and modern union syntax.
coding_qa.review
Review Python files for bugs, suggest fixes, and provide test cases.