extract-module
Skill1 starsChanged 2 months agoMITView on GitHub
Split a file or module that's grown too big — find the real seams, pull out a cohesive piece with a narrow interface, move the tests with it, keep every commit green. Behaviour-preserving only. Use when asked to "split this file", "extract X into its own module", "this file is too big", or a review flags a god-object.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- JetBrains/intellij-communitytheir own version, first seen Nov 7, 2026
- castacks/AirStacktheir own version, first seen Oct 9, 2026
- DetachHead/rebasedtheir own version, first seen Oct 8, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- JetBrains/intellij-community★ 21ksame name
- DetachHead/rebased★ 6.5ksame name
- castacks/AirStack★ 93same 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 repository73 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bigquery-analyticsSkill
- cache-invalidationSkill
- mongo-aggregationSkill
- mongo-modelingSkill
- postgres-aggregationSkill
- postgres-indexingSkill
- redis-coordinationSkill
- redis-patternsSkill
- review-querySkill
- code-migrationSkill
- cut-releaseSkill
- data-migrationSkill
- deploy-serviceSkill
- hotfixSkill
- rollbackSkill
- design-endpointSkill
- design-eventSkill
- design-schemaSkill
- evolve-contractSkill
- scaffold-nestjs-moduleSkill
- scaffold-projectSkill
- incident-responseSkill
- investigate-bugSkill
- on-callSkill
- postmortemSkill
- audit-skillsSkill
- distill-review-styleSkill
- write-skillSkill
- debug-with-tracesSkill
- define-alertsSkill
- instrument-serviceSkill
- evaluate-dependencySkill
- grillSkill
- handoffSkill
- orientSkill
- phased-deliverySkill
- spikeSkill
- to-questionnaireSkill
- write-adrSkill
- write-prdSkill
- devops-pr-reviewSkill
- go-backend-pr-reviewSkill
- nestjs-backend-pr-reviewSkill
- python-backend-pr-reviewSkill
- react-frontend-pr-reviewSkill
- bisectSkill
- break-couplingSkill
- dead-code-sweepSkill
- deslopifySkill
- rebase-cleanSkill
- resolve-merge-conflictsSkill
- split-commitSkill
- tddSkill
- wait-whatSkill
- wide-renameSkill
- bullmqSkill
- kafkaSkill
- sqs-consumerSkill
- audit-dependenciesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
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 12
Don't split by line count — split by cohesion.
- Distinctive: line 22
If nothing has a clean seam, the file may be fine as-is.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Extract a module
Behaviour must not change. Every commit compiles and passes tests.
Find the seam
Don't split by line count — split by cohesion. Look for:
- A cluster of functions that only talk to each other and share private state.
- A set of functions that all take the same 2–3 parameters (they want to be a type with methods, or a module with that state closed over).
- A concern that has its own vocabulary (parsing, formatting, a protocol, a cache).
- Code the rest of the file only calls through 1–2 entry points — that's the interface of the new module.
If nothing has a clean seam, the file may be fine as-is. A big file of unrelated small functions is a naming problem, not a structure problem.
Do it
- Name the new module for what's in it, not generically (
billing-period, notutils). Match the project's layout — for NestJS, a new feature module gets its ownv1/folders and module-localconstants.ts(design/scaffold-nestjs-module). - Move, don't rewrite. Cut the code, paste it, fix imports. Resist improving it in the same pass.
- Keep the interface narrow — export only what callers use. Everything else stays unexported.
- Move the tests that cover the extracted code into a spec beside it. Don't leave them testing through the old file.
- One commit (
refactor: extract <module> from <file>), green. - Then — a separate commit/PR for any cleanup the extraction revealed.
Anti-patterns
- ❌ Splitting by size with no cohesive seam.
- ❌ Rewriting logic during the move.
- ❌ A wide interface that exposes internals "just in case".
- ❌ Tests left behind, still coupled to the old module.
- ❌ Bundling the extraction with a behaviour change.
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.

