reorganize
Skill1 starsChanged 3 months agoMITView on GitHub
Splits oversized files and groups related code into a coherent folder tree. One concern per file; related modules sit together under domain folders; names stay descriptive. Use when the user asks to reorganize code, split a large file, untangle mixed modules, extract related files into folders, clean a messy tree, or stop unrelated logic from living in one place — not for shortening names, behavior changes, or general smell cleanup.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- kborovik/spec-driven-devtheir own version, first seen Aug 4, 2026
- kborovik/grok-skillstheir own version, first seen Jul 19, 2026
- NYTC69/review-looptheir own version, first seen May 10, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- NYTC69/review-loop★ 3same name
- kborovik/grok-skills★ 2same name
- kborovik/spec-driven-dev★ 2same 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 repository81 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agents-mdSkill
- base-uiSkill
- better-authSkill
- brainstormSkill
- bullmqSkill
- bunSkill
- clickhouseSkill
- clone-to-tempSkill
- compound-uiSkill
- copywritingSkill
- create-durable-planSkill
- d3Skill
- date-fnsSkill
- decimal-jsSkill
- deduplicateSkill
- design-engineerSkill
- designSkill
- drizzle-ormSkill
- effectSkill
- elysia-architectureSkill
- elysiaSkill
- evlogSkill
- feedsmithSkill
- grokSkill
- handoffSkill
- heyapiSkill
- impitSkill
- intlayerSkill
- jsdocSkill
- kafkaSkill
- kill-legacySkill
- legend-stateSkill
- loopSkill
- mantine-hooksSkill
- mobbinSkill
- motionSkill
- oxfmtSkill
- oxlintSkill
- permixSkill
- plain-languageSkill
- playwrightSkill
- react-boundariesSkill
- react-emailSkill
- reactSkill
- researchSkill
- schema-dtsSkill
- sentrySkill
- seoSkill
- setup-competitors-mdSkill
- setup-copywriting-mdSkill
- setup-icp-mdSkill
- setup-project-mdSkill
- simplify-layoutSkill
- storybookSkill
- subagentsSkill
- tailwindSkill
- tailwind-variantsSkill
- takumiSkill
- tanstack-chartsSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 19 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
19
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Do not shorten names for scannability.
- Distinctive: line 18
Before/after trees: references/examples.md
- Distinctive: line 24
Ask once if the boundary is ambiguous.
- Distinctive: line 26
Default to propose (read-only split/move map).
- Very specific: line 31
Read project layout or ownership guidance if present (AGENTS.md, CONTRIBUTING, nested module docs, package exports).
- Distinctive: line 58
Put siblings that change together in the same folder (and subfolders when the set is large).
- Distinctive: line 69
Do not rename solely to shorten
- Distinctive: line 70
Do not invent cryptic 2–3 letter abbreviations
- Distinctive: line 77
Add a subfolder when a cluster has a shared identity
- Distinctive: line 78
Do not add empty scaffolding folders "for later"
- Very specific: line 79
Do not nest utils/helpers/lib chains
- Distinctive: line 91
After a split, internals may import siblings.
- Very specific: line 95
Prefer a folder with a real entry file over a new barrel.
- Distinctive: line 111
Call out what must not move (applied migrations, public SDK paths, persisted resource IDs, framework route files, generated output) unless …
- Distinctive: line 146
Do not flag a name for being long if it is accurate.
- Distinctive: line 147
Do not flag a cohesive long file (single mapper, single protocol codec).
- Distinctive: line 151
Prefer split/move over rewriting logic
- Distinctive: line 153
Keep unrelated worktree changes untouched
- Distinctive: line 154
Read-only unless the user requests implementation
- Distinctive: line 159
Use the project's existing quality commands for touched files or packages only (format, lint, typecheck, tests).
- Distinctive: line 163
If schema, migrate, or generated-path artifacts moved, run the project's usual migration or codegen step for that surface.
- Very specific: line 216
When this skill runs inside a multi-agent implementation or repair workflow, each subagent runs only targeted checks for its assigned …
- Distinctive: line 220
If no multi-agent harness is available, run the same targeted checks in chat.
“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
Reorganize
Make file trees cohesive: related code lives together; unrelated code does not share a file or folder; large files split into a readable tree.
Do not shorten names for scannability. Prefer clear, descriptive folder and file names that match what the code owns.
Load after first steps:
- Model: references/organization-model.md
- Split rules: references/split-heuristics.md
- Before/after trees: references/examples.md
Scope
- User-provided path first (package, feature, file, or subtree).
- Current git changes if no path is given and the diff is organization-shaped.
- Ask once if the boundary is ambiguous.
Default to propose (read-only split/move map). Only rewrite files when the user says apply / migrate / implement.
First Steps
- Read project layout or ownership guidance if present (
AGENTS.md,CONTRIBUTING, nested module docs, packageexports). - Glob the target tree. Record large files (LOC), mixed folders, and public
entrypoints (
package.jsonexports, route files, SDK barrels already in use). - Load the three references above.
- Compare against 1–2 sibling folders of similar role (optional, for local
conventions like
public//private/trust buckets). - Inventory each hotspot file: export groups, section comments, types vs runtime vs UI vs I/O. That inventory is the split seed.
Principles
1. One primary concern per file
A file owns one job: one type family, one workflow, one UI surface, one adapter. Split when it mixes unrelated export groups or grows past ~250–400 LOC with continued growth expected.
A long file that is still one concern (exhaustive mapper, generated-looking table, single state machine) may stay. Length alone is not a defect — mixed jobs are.
Name split pieces after what they own. Do not dump leftovers into helpers,
misc, shared2, or utils.ts.
2. Related code shares a parent
Put siblings that change together in the same folder (and subfolders when the set is large). Prefer a domain tree over a flat dump of unrelated files, and over scattering related modules across distant roots.
Gravity test: if several files import each other densely, they belong under one parent. If they never change together and share no types, they do not.
3. Names stay descriptive
- Folder and file names should say the domain or aspect clearly
- Multi-word kebab-case is fine:
password-reset.ts,invoice-summary.ts - Do not rename solely to shorten
- Do not invent cryptic 2–3 letter abbreviations
- Repeating a parent in a leaf is acceptable when it disambiguates
(
events/event-kinds.ts) — cohesion beats brevity
4. Depth serves grouping, not ceremony
- Split a flat folder when it mixes domains
- Add a subfolder when a cluster has a shared identity
- Do not add empty scaffolding folders "for later"
- Do not nest
utils/helpers/libchains - Respect existing trust boundaries (
public//private//internal/) — reorganize inside them; do not flatten them away
5. Extract, do not rewrite behavior
Moves and splits preserve public exports, types, and call sites. New files are mechanical extractions plus import updates — not redesigns, API changes, or drive-by refactors.
6. Dependency direction
After a split, internals may import siblings; avoid new cycles. Extract shared types/constants first, then leaf helpers, then workflows, then a thin facade if a public path must remain.
Prefer a folder with a real entry file over a new barrel. Add
index.ts / index.js only when that subtree already uses barrels.
Workflow
Propose (default)
- Map current tree (abbreviated). List hotspot files with LOC and mixed export groups.
- Flag friction using references/split-heuristics.md.
- Propose a target tree using references/organization-model.md and references/examples.md, adapted to this archetype (package vs feature vs UI — do not force data-layer folder names onto UI).
- Emit an old → new path table. For splits, list which exports/sections go to which file. Note any compatibility re-export at the old path.
- Call out what must not move (applied migrations, public SDK paths, persisted resource IDs, framework route files, generated output) unless the user explicitly asks.
- Order the apply steps so types/constants move before dependents.
Apply (only when asked)
- [ ] Extract shared types/constants first (break cycles before they start)
- [ ] Create/move/split files per the map
- [ ] Update imports, package exports, and path aliases as needed
- [ ] Keep a thin re-export at the old public path only when that import path
is a published contract; otherwise delete the old file
- [ ] Move colocated tests with their sources; split tests to match sources
- [ ] Update nearest ownership/layout docs if paths changed
- [ ] Delete emptied leftovers
- [ ] Run the project's targeted format/lint/typecheck/tests for touched areasPreserve behavior. Do not rename applied migrations or external contracts.
Defects To Flag
- Files that mix unrelated export groups (schema + HTTP + UI + cron in one module)
- Files past ~250–400 LOC that keep growing and mix jobs
- Flat directories with many unrelated domains as siblings
- Related modules split across distant folders without a shared parent
utils/,helpers/,common/,misc/dumping grounds- A single
foo.ts/foo.service.tsthat should be afoo/folder of related pieces - Deep trees where every segment is a vague layer name (
core/common/shared) - Empty or speculative folders
- Tests that still cover five source files in one blob after the source split
Do not flag a name for being long if it is accurate. Do not flag a cohesive long file (single mapper, single protocol codec).
Fix Rules
- Prefer split/move over rewriting logic
- Match local archetype conventions while applying cohesion rules
- Keep unrelated worktree changes untouched
- Read-only unless the user requests implementation
- One reviewable pass per cluster; do not reorganize the whole repo unasked
Verification
Use the project's existing quality commands for touched files or packages only (format, lint, typecheck, tests). Prefer targeted checks over full-repo gates unless the split spans shared contracts.
If schema, migrate, or generated-path artifacts moved, run the project's usual migration or codegen step for that surface.
Review Output
## Scope
[path]
## Current (abbrev)
[tree]
## Hotspots
| File | LOC | Mixed groups |
| ---- | --- | ------------ |
## Friction
1. …
## Target
[tree]
## Split / move map
| Before | After | What moves |
| ------ | ----- | ---------- |
## Apply order
1. types/constants …
2. leaves …
3. facades / import updates …
## Do not move
- …
## Compatibility
Old public path kept as re-export? yes/no — why
## Apply?
Propose only / ready to apply when askedMulti-Agent Verification
When this skill runs inside a multi-agent implementation or repair workflow, each subagent runs only targeted checks for its assigned files/package/surface and reports broader gate needs. The orchestrator owns the project's full quality gate sequence and routes final-gate failures back to responsible subagents. If no multi-agent harness is available, run the same targeted checks in chat.
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.

