module-boundaries
Skill12 starsChanged 4 months agoMITView on GitHub
Evaluates where module boundaries are drawn and whether modules should be merged or split. Use when deciding whether to combine or separate two modules, when modules are tightly coupled, or when a change to one forces changes to another. Not for depth within a single module (use deep-modules) or abstraction-layer quality (use abstraction-quality).
In this repository16 other files it gives its agents.
- AGENTS.mdAGENTS.md
- abstraction-qualitySkill
- code-evolutionSkill
- comments-docsSkill
- complexity-recognitionSkill
- deep-modulesSkill
- design-it-twiceSkill
- design-reviewSkill
- diagnoseSkill
- error-designSkill
- general-vs-specialSkill
- information-hidingSkill
- naming-obviousnessSkill
- pull-complexity-downSkill
- red-flagsSkill
- strategic-mindsetSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 11 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
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 10
When invoked with $ARGUMENTS, focus the analysis on the specified file or module.
- Distinctive: line 17
When two modules seem tightly coupled
- Distinctive: line 18
When a change to one module frequently requires changes to another
- Distinctive: line 19
When reviewing a decomposition decision
- Distinctive: line 41
Different knowledge domains: No shared secrets
- Distinctive: line 44
General-purpose from special-purpose: Keep the general-purpose layer clean
- Distinctive: line 48
When combining doesn't simplify and separating doesn't either, look for the abstraction underneath both.
- Distinctive: line 53
Ask what it looks like alone: If you extracted just the shared concern, what would the type or interface be?
- Distinctive: line 73
When splitting is warranted, the goal is for each resulting method to own a complete operation, not a fragment.
- Distinctive: line 90
Apply merge signals: Should any modules be combined?
- Distinctive: line 91
Apply split signals: Should any module be divided?
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Module Boundaries Review Lens
When invoked with $ARGUMENTS, focus the analysis on the specified file or module. Read the target code first, then apply the checks below.
Evaluate where module boundaries are drawn: are related things together and unrelated things apart?
When to Apply
- Deciding whether to split a large class or merge small ones
- When two modules seem tightly coupled
- When a change to one module frequently requires changes to another
- When reviewing a decomposition decision
Core Principles
The Default Instinct Is Wrong
Most developers assume smaller is better, which produces systems full of shallow, pass-through components that increase cognitive load without hiding anything. The right answer is always whichever arrangement results in lower overall system complexity. Not smaller. Not more separated. Simpler.
Merge Signals (Better Together)
- They share information: Same format, protocol, or data structure knowledge
- They simplify each other: Together, code is simpler than pieces apart
- They always change together: The boundary is fiction
- One is incomplete without the other: Callers must always use both
- It eliminates duplication: The same code appears in both places. Merging lets it exist once
- It resolves pass-throughs: A forwarding method adds a layer without adding an abstraction
Four costs of every split: more components to track, connective tissue to manage the boundary, separation of related code (producing unknown unknowns) and duplication.
Split Signals (Better Apart)
- Pieces are independent: Can be understood and modified separately
- Different knowledge domains: No shared secrets
- A clear, simple interface exists at the boundary
- Different rates of change: One stable, one evolving
- General-purpose from special-purpose: Keep the general-purpose layer clean
The Third Option
When combining doesn't simplify and separating doesn't either, look for the abstraction underneath both. Forcing a merge produces a module with two identities. Forcing a split produces conjoined modules. The relationship between the two things points at a concept that neither one is.
Discovery Process
- Name the shared concern: What specific knowledge or capability do they share? Not "they're both used in X." Be precise.
- Ask what it looks like alone: If you extracted just the shared concern, what would the type or interface be? Does it have a clean, simple API?
- Express the originals in terms of it: Can each component be redefined as a use of the extracted concept?
- Verify simplification: Does the new abstraction have a simple interface? Do the originals become simpler through it? Is duplicated knowledge now in one place? If not all three, the problem is elsewhere.
Recognizable situations
Two types sharing representation (extract a value type), two modules sharing a subroutine (extract a standalone utility, not a base class), two interfaces that overlap (factor out the shared surface), two workflows sharing a phase (extract the phase as an independent operation).
Validation
A genuine third option has its own identity (nameable without referencing either original), is simpler than either original, and is useful beyond the current context. If you can't name it precisely ("CommonStuff", "SharedUtils"), it's not a real abstraction.
Conjoined Methods
Two methods are conjoined when you can't understand one without reading the other. This is a red flag that the split was wrong.
A 200-line method with a simple interface that reads top to bottom is deep and fine. Five 40-line methods that must be read together are shallow and worse. The test is never "is this method too long?" It is "can this method be understood independently?"
Method Splitting
When splitting is warranted, the goal is for each resulting method to own a complete operation, not a fragment.
Two valid forms:
- Extract a subtask: Factor out a child method that is general-purpose and independently understandable. The parent calls the child. Test: can someone read the child without knowing about the parent, and vice versa? If you find yourself flipping between them, the split was wrong.
- Divide into peer methods: Split the original into two caller-visible methods, each with a simpler interface. Test: do most callers only need one of the new methods? If callers must invoke both, the split likely added complexity.
Shared-Information Boundary Criterion
The most reliable criterion for drawing boundaries: which module is the authoritative owner of this piece of knowledge?
A well-placed boundary fully encloses a design decision. If two modules share knowledge about the same format or protocol, they belong together. If they happen to run one after the other but own unrelated knowledge, they belong apart. Execution order should never determine where a boundary goes.
Review Process
- Map dependencies: For each module pair, what knowledge do they share?
- Apply merge signals: Should any modules be combined?
- Apply split signals: Should any module be divided?
- Test for conjoined methods: Can each be understood independently?
- Check boundary criterion: Boundaries drawn around knowledge ownership?
- Recommend adjustments: Specific merges, splits, or restructurings
Red flag signals for module boundaries are cataloged in red-flags (Conjoined Methods).
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.

