split-file
Skill1 starsChanged 14 days agoMITView on GitHub
Split a file or function that has grown too big, keeping every import working (/split-file).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- grafana/mimirtheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- grafana/mimir★ 5.3ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- compactSkill
- lean-codeSkill
- learn-correctionsSkill
- mapSkill
- reuse-firstSkill
- safe-refactorSkill
- self-checkSkill
- setupSkill
- terseSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Run the tests and note the result.
- Distinctive: line 23
Run the tests after each move.
- Very specific: line 24
When everything passes, update callers to the new locations only if the user wants that.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
split-file
Big files cost tokens every time they are read and are risky to change. Split them by responsibility, so each future task opens only the part it needs.
When
python scripts/find_large.pylists the file (over ~400 lines) or function (over ~80), or- you keep re-reading the same large file across tasks. Skip data files, generated code and files that are long but simple (a list of constants).
Steps
- Run the tests and note the result. No tests cover the file? Write a quick one for its public behaviour first, or tell the user the split is unverified.
- Group the contents by responsibility (parsing, storage, formatting...). Aim for files of 100-300 lines with one clear job each. Name files after that job.
- Move one group at a time. Keep every public name importable from its old location by re-exporting it there, so no caller has to change in the same step.
- Run the tests after each move. Stop and undo the last move if anything fails.
- When everything passes, update callers to the new locations only if the user wants
that; otherwise the re-exports stay. Run
/mapso the code map shows the new files.
Language details (read only the one you need)
- Python:
${CLAUDE_SKILL_DIR}/references/python.md - JavaScript and TypeScript:
${CLAUDE_SKILL_DIR}/references/javascript.md
Report
split: <old file> -> <new files>; re-exports kept in <old file>; tests: pass
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

