code-splitting
Skill19 starsChanged 6 months agoMITView on GitHub
Use when a file or module is growing large, when deciding how to break up code, or when optimizing bundle size with lazy/dynamic imports. Applies to both source organization and runtime loading.
In this repository14 other files it gives its agents.
- automation-firstSkill
- clean-code-typescriptSkill
- final-responseSkill
- gauge-improvementsSkill
- karpathy-guidelinesSkill
- mobile-qaSkill
- orchestrationSkill
- qa-sharedSkill
- requirement-intelligenceSkill
- root-cause-analysisSkill
- technical-writingSkill
- ui-ux-pro-maxSkill
- web-design-guidelinesSkill
- web-qaSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Avoid circular deps (they signal a tangled boundary — extract the shared piece).
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Code splitting — organization and loading
When a file is too big (signal: it's doing too much)
- A file that mixes concerns (UI + data + formatting + types) or scrolls past a few hundred lines is a smell. Split by responsibility, not by line count.
- Extract: pure helpers →
utils; types → atypesmodule; a sub-feature → its own file/folder. - Each unit should answer cleanly: what does it do, how do you use it, what does it depend on? If you can't change its internals without breaking callers, the boundary is wrong.
Module boundaries
- Depend on interfaces, not internals. Keep public surface small; don't export incidental helpers.
- Avoid circular deps (they signal a tangled boundary — extract the shared piece).
- Co-locate things that change together; separate things that change for different reasons.
Runtime / bundle splitting (web & mobile)
- Lazy-load route-level and heavy/rarely-used chunks: dynamic
import(),React.lazy+Suspense. - Split vendor vs app; defer below-the-fold and modal/dialog code.
- Measure with the bundler analyzer before and after — split where it moves the metric, not
reflexively (see
gauge-improvements). Watch for over-splitting (too many tiny requests).
Checklist
Is this file one responsibility? Is the public API minimal? Any cycle? Does a lazy boundary actually reduce initial load (measured)?
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.

