split-monolith

split-monolith is a skill for Claude Code, Codex from yerdaulet-damir/vibe-coding-rules. It costs 63 tokens per session (1,085 once invoked), scanned A, original, MIT.

A procedure for splitting a very large Python file, sometimes called a monolith, into smaller files inside a package while keeping existing imports working.

In plain words
What is it for?
Use it when a file exceeds the stated size limits or combines several responsibilities, such as user operations, administration, history, and storage.
Why use it?
It reduces the risk that reorganising code will break callers and discourages meaningless splits based only on file size.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/yerdaulet-damir/vibe-coding-rules/split-monolith
Any agent
npx skills add yerdaulet-damir/vibe-coding-rules --skill split-monolith
Clone the repo
git clone --depth 1 https://github.com/yerdaulet-damir/vibe-coding-rules

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 split-monolith

README.md
[![agentmods](https://agentmods.dev/badge/skills/yerdaulet-damir/vibe-coding-rules/split-monolith.svg)](https://agentmods.dev/skills/yerdaulet-damir/vibe-coding-rules/split-monolith)
Your own site
<a href="https://agentmods.dev/skills/yerdaulet-damir/vibe-coding-rules/split-monolith"><img src="https://agentmods.dev/badge/skills/yerdaulet-damir/vibe-coding-rules/split-monolith.svg" alt="Measured on agentmods" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,085 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00063 $0.01085
Opus 5 $0.00032 $0.00543
Sonnet 5 $0.00013 $0.00217
Haiku 4.5 $0.00006 $0.00109

Measured 5d ago against content hash b40479993344, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

split-monolith 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 5d 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.

.claude/skills/split-monolith/SKILL.md · 166 lines

How it starts

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

split-monolith

A file split done wrong breaks every caller. Follow this procedure exactly — it is reversible at every step.


Step 0 — Confirm the file needs splitting

wc -l app/services/<file>.py
Lines Action
< 400 Do not split — you're solving a non-problem
400–600 Plan the split now, execute when convenient
> 600 Split immediately (Principle A7 hard cap)

Also ask: does this file mix multiple concerns? A file that is long but cohesive is better than a premature split.


Step 1 — Identify the domain splits

Do NOT split by size. Split by type of responsibility.

Good splits (by domain):

wallet_service.py (1200 LOC) →
  wallet/user.py      ← user-facing operations (charge, refund)
  wallet/admin.py     ← admin operations (top-up, override)
  wallet/history.py   ← read-only queries

Good splits (by layer):

generation_service.py (1000 LOC) →
  generation/orchestrator.py   ← coordinates the flow
  generation/cost.py           ← cost calculation logic
  generation/storage.py        ← result persistence

Bad splits (by size only — don't do this):

big_service.py →
  big_service_part1.py   ← meaningless
  big_service_part2.py   ← meaningless

Write the target structure before touching any file.


Step 2 — Create the package directory

mkdir app/services/<domain>/

Do NOT move any code yet.


Step 3 — Create sub-files one at a time

For each sub-file, copy (not move) the relevant functions:

# Create the new file with the relevant subset
touch app/services/<domain>/user.py
# Copy relevant classes/functions from the original

Each sub-file must:

  • Have its own imports (do not rely on * imports)
  • Be under 200 LOC (you're splitting — keep it lean)
  • Contain one cohesive responsibility

Step 4 — Create __init__.py with ALL old names re-exported

This is the most important step. Every name that existed in the original file must still be importable from the same path.

Read the full file on GitHub · 166 lines

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. 5d ago First seen · 166 lines · 63 tokens per session scan A b40479993344

Subscribe to this mod's changes

split-monolith is a skill published in the GitHub repository yerdaulet-damir/vibe-coding-rules (10 stars, last pushed 4mo ago), licensed MIT. It adds 63 tokens to every session and 1,085 once invoked, about $0.0003 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-08-31.

Related

Other skills, from other repositories

eval-agents

Audit Claude Code agents defined in .claude/agents/ for description specificity, model tier appropriateness, tools scoping, and system prompt quality. Detects dispatch ambiguity between agents, flags over-permissive tool grants, and checks for human-in-the-loop patterns that break programmatic orchestration. Use when…

FlorianBruniaux/claude-code-ultimate-guide · 93 tokens

land-and-deploy

Merge PR, wait for CI, verify deploy, run canary. The complete landing pipeline.

FlorianBruniaux/claude-code-ultimate-guide · 24 tokens

axum-idioms

Axum HTTP framework patterns — routing, extractors, middleware, state management. For Rust see rust-idioms.

irahardianto/awesome-agv · 30 tokens

git-ai-archaeology

Analyze AI config evolution in a git repo. Use when mapping AI adoption history, finding when configs were first introduced, charting commit velocity by month, or identifying maturity phases in a project's AI tooling.

FlorianBruniaux/claude-code-ultimate-guide · 47 tokens

investigate

Systematic root-cause debugging: find the cause before writing any fix.

FlorianBruniaux/claude-code-ultimate-guide · 17 tokens

sandbox-unblock

Diagnostic protocol to run before reporting a sandbox blocker or asking for a configuration change. Eight checks that eliminate false positives, then a report template the person holding the settings can act on. On one measured day, six of eight reported blockers turned out to be false, all from the same handful of…

FlorianBruniaux/claude-code-ultimate-guide · 65 tokens