Simplify Layout
Make file trees short-named and well-grouped: folder context carries the
noun; leaf files stay short verbs/aspects; related code sits together.
Canonical shape: references/layout-model.md.
Scope
- User-provided path first (package, feature, or subtree).
- Current git changes if no path is given and the diff is layout-shaped.
- Ask once if the boundary is ambiguous.
Default to propose (read-only rename/group map). Only rewrite paths when the
user says apply / migrate / implement.
First Steps
- Read project naming or layout guidance if present (
AGENTS.md, CONTRIBUTING,
nested ownership docs, design-system docs).
- Glob the target tree; sketch an abbreviated current layout.
- Load the layout model: references/layout-model.md.
- Compare against 1–2 sibling folders of similar role (optional, for local
conventions like
public/ / private/ trust buckets).
Principles
1. Path context replaces filename prefixes
Do not repeat the parent folder (or package) in the leaf name.
| Avoid |
Prefer |
queries/user-profile-query.ts |
queries/users/profile.ts |
auth/auth-token-helper.ts |
auth/token.ts |
rows/events/event-row-mapper.ts |
rows/events/map.ts |
billing-invoice-summary.ts under packages/billing |
invoices/summary.ts |
2. Folder = noun / domain; file = aspect / operation
- Domain folders:
users/, billing/, auth/, orders/, seed/
- Leaf files:
card.ts, detail.ts, overview.ts, create.ts, sync.ts, map.ts
- Stable role folders when the archetype needs them:
queries/, services/,
components/, hooks/, errors/, utils/ — keep those short too
3. Group related code under one parent
Put siblings that change together in the same folder. Prefer:
queries/
users/profile.ts
users/list.ts
orders/detail.ts
orders/overview.ts
billing/invoice.ts
Over a flat dump of users-profile.ts, orders-detail.ts, billing-invoice.ts
at one level, or scattering related modules across unrelated roots.
4. Short names; spell out only when ambiguous
- Prefer one word when clear:
day, stamp, lookup, list, card
- Use kebab-case multi-word only when needed:
dimension-filters.ts,
currency-fraction-digits.ts
- Do not invent cryptic 2–3 letter abbreviations that need a glossary
- Service or package folder identities may stay longer
(
analytics-traffic-read) when they are the public domain name; files inside
stay short (service.ts, errors/…)
5. Depth serves grouping, not ceremony
- Split a flat folder when it mixes domains or names start carrying prefixes
- Do not add empty scaffolding folders "for later"
- Do not nest
utils/helpers/lib chains; one private helper bucket is enough
- Respect existing trust boundaries (
public/ / private/ / internal/) —
shorten names inside them; do not flatten them away
6. One primary concern per file
Split when a file mixes unrelated export groups or grows past ~250–400 LOC with
continued growth expected. Name the split pieces by aspect, not by
helpers / misc / shared2.
Workflow
Propose (default)
- Map current tree (abbreviated).
- Flag friction: long names, repeated path segments, mixed domains, scattered
siblings, god files, useless nesting.
- Propose a target tree using the layout model 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 every rename/move.
- Call out what must not rename (migrations on disk, public SDK paths,
persisted resource IDs, API routes) unless the user explicitly asks.
Apply (only when asked)
- [ ] Create/move/rename files per the map
- [ ] Update imports, package exports, and path aliases as needed
- [ ] Move colocated tests with their sources
- [ ] Update nearest ownership/layout docs if paths changed
- [ ] Delete emptied leftovers
- [ ] Run the project's targeted format/lint/typecheck/tests for touched areas
Preserve behavior. No barrels (index.ts / index.js) unless that subtree
already uses them. Do not rename applied migrations or external contracts.
Defects To Flag
- Leaf names that restate parent folders (
…/events/event-*.ts)
- Package or brand restated in paths inside the owning package
(
acme-* under packages/acme)
- Flat directories with many prefix-disambiguated files (
foo-bar-baz.ts siblings)
- Related modules split across distant folders without a shared parent
utils/, helpers/, common/, misc/ dumping grounds
something.service.ts collapsing a service folder (prefer
something/service.ts when that is the local service shape)
- Deep trees where every segment is a vague layer name
Fix Rules
- Prefer rename/move over rewriting logic
- Match local archetype conventions (feature trust buckets, UI primitives) while
applying short-name + grouping rules
- Keep unrelated worktree changes untouched
- Read-only unless the user requests implementation
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 rename 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]
## Friction
1. …
## Target
[tree]
## Rename map
| Before | After |
| ------ | ----- |
## Do not rename
- …
## Apply?
Propose only / ready to apply when asked
Related Skills
| Skill |
Use when |
unsmell |
Maintainability beyond naming/grouping (duplication, complexity, types) |
Multi-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.
1---2name: simplify-layout3description: Shortens file and folder names and groups related code so paths stay scannable. Folder context carries the noun; leaf files stay short verbs or aspects; related modules sit together. Use when the user asks to simplify names, shorten paths, or make a package or feature layout easier to scan — not for cohesion-only splits that keep descriptive names, broad boundary or scalability migrations, or general smell cleanup.4---56# Simplify Layout78Make file trees **short-named** and **well-grouped**: folder context carries the9noun; leaf files stay short verbs/aspects; related code sits together.1011Canonical shape: [references/layout-model.md](references/layout-model.md).1213## Scope14151. User-provided path first (package, feature, or subtree).162. Current git changes if no path is given and the diff is layout-shaped.173. Ask once if the boundary is ambiguous.1819Default to **propose** (read-only rename/group map). Only rewrite paths when the20user says apply / migrate / implement.2122## First Steps23241. Read project naming or layout guidance if present (`AGENTS.md`, `CONTRIBUTING`,25 nested ownership docs, design-system docs).262. Glob the target tree; sketch an abbreviated current layout.273. Load the layout model: [references/layout-model.md](references/layout-model.md).284. Compare against 1–2 sibling folders of similar role (optional, for local29 conventions like `public/` / `private/` trust buckets).3031## Principles3233### 1. Path context replaces filename prefixes3435Do not repeat the parent folder (or package) in the leaf name.3637| Avoid | Prefer |38| --- | --- |39| `queries/user-profile-query.ts` | `queries/users/profile.ts` |40| `auth/auth-token-helper.ts` | `auth/token.ts` |41| `rows/events/event-row-mapper.ts` | `rows/events/map.ts` |42| `billing-invoice-summary.ts` under `packages/billing` | `invoices/summary.ts` |4344### 2. Folder = noun / domain; file = aspect / operation4546- Domain folders: `users/`, `billing/`, `auth/`, `orders/`, `seed/`47- Leaf files: `card.ts`, `detail.ts`, `overview.ts`, `create.ts`, `sync.ts`, `map.ts`48- Stable role folders when the archetype needs them: `queries/`, `services/`,49 `components/`, `hooks/`, `errors/`, `utils/` — keep those short too5051### 3. Group related code under one parent5253Put siblings that change together in the same folder. Prefer:5455```text56queries/57 users/profile.ts58 users/list.ts59 orders/detail.ts60 orders/overview.ts61 billing/invoice.ts62```6364Over a flat dump of `users-profile.ts`, `orders-detail.ts`, `billing-invoice.ts`65at one level, or scattering related modules across unrelated roots.6667### 4. Short names; spell out only when ambiguous6869- Prefer one word when clear: `day`, `stamp`, `lookup`, `list`, `card`70- Use kebab-case multi-word only when needed: `dimension-filters.ts`,71 `currency-fraction-digits.ts`72- Do not invent cryptic 2–3 letter abbreviations that need a glossary73- Service or package **folder** identities may stay longer74 (`analytics-traffic-read`) when they are the public domain name; files inside75 stay short (`service.ts`, `errors/…`)7677### 5. Depth serves grouping, not ceremony7879- Split a flat folder when it mixes domains or names start carrying prefixes80- Do not add empty scaffolding folders "for later"81- Do not nest `utils/helpers/lib` chains; one private helper bucket is enough82- Respect existing trust boundaries (`public/` / `private/` / `internal/`) —83 shorten names inside them; do not flatten them away8485### 6. One primary concern per file8687Split when a file mixes unrelated export groups or grows past ~250–400 LOC with88continued growth expected. Name the split pieces by aspect, not by89`helpers` / `misc` / `shared2`.9091## Workflow9293### Propose (default)94951. Map current tree (abbreviated).962. Flag friction: long names, repeated path segments, mixed domains, scattered97 siblings, god files, useless nesting.983. Propose a target tree using the layout model adapted to this archetype99 (package vs feature vs UI — do not force data-layer folder names onto UI).1004. Emit an old → new path table for every rename/move.1015. Call out what **must not** rename (migrations on disk, public SDK paths,102 persisted resource IDs, API routes) unless the user explicitly asks.103104### Apply (only when asked)105106```text107- [ ] Create/move/rename files per the map108- [ ] Update imports, package exports, and path aliases as needed109- [ ] Move colocated tests with their sources110- [ ] Update nearest ownership/layout docs if paths changed111- [ ] Delete emptied leftovers112- [ ] Run the project's targeted format/lint/typecheck/tests for touched areas113```114115Preserve behavior. No barrels (`index.ts` / `index.js`) unless that subtree116already uses them. Do not rename applied migrations or external contracts.117118## Defects To Flag119120- Leaf names that restate parent folders (`…/events/event-*.ts`)121- Package or brand restated in paths inside the owning package122 (`acme-*` under `packages/acme`)123- Flat directories with many prefix-disambiguated files (`foo-bar-baz.ts` siblings)124- Related modules split across distant folders without a shared parent125- `utils/`, `helpers/`, `common/`, `misc/` dumping grounds126- `something.service.ts` collapsing a service folder (prefer127 `something/service.ts` when that is the local service shape)128- Deep trees where every segment is a vague layer name129130## Fix Rules131132- Prefer rename/move over rewriting logic133- Match local archetype conventions (feature trust buckets, UI primitives) while134 applying short-name + grouping rules135- Keep unrelated worktree changes untouched136- Read-only unless the user requests implementation137138## Verification139140Use the project's existing quality commands for touched files or packages only141(format, lint, typecheck, tests). Prefer targeted checks over full-repo gates142unless the rename spans shared contracts.143144If schema, migrate, or generated-path artifacts moved, run the project's usual145migration or codegen step for that surface.146147## Review Output148149```markdown150## Scope151152[path]153154## Current (abbrev)155156[tree]157158## Friction1591601. …161162## Target163164[tree]165166## Rename map167168| Before | After |169| ------ | ----- |170171## Do not rename172173- …174175## Apply?176177Propose only / ready to apply when asked178```179180## Related Skills181182| Skill | Use when |183| --- | --- |184| `unsmell` | Maintainability beyond naming/grouping (duplication, complexity, types) |185186## Multi-Agent Verification187188When this skill runs inside a multi-agent implementation or repair workflow,189each subagent runs only targeted checks for its assigned files/package/surface190and reports broader gate needs. The orchestrator owns the project's full quality191gate sequence and routes final-gate failures back to responsible subagents.192If no multi-agent harness is available, run the same targeted checks in chat.