File Structure Optimization
Quick Index (Action-Routed)
Read First (All Actions)
Mission
Use This Skill When
Scope Boundary
Core Principles
Action Modules (Read As Needed)
- Structural assessment:
Structure Audit
Smell Detection
- Refactoring strategy:
Normalization Rules
Migration Safety Rules
- Long-term hygiene:
Ownership and Boundaries
Acceptance Checklist
Output
Deliverable Format
Anti-Patterns
Mission
Keep repository layout predictable, modular, and easy to navigate while minimizing duplication and stale artifacts.
Authority and Artifact Policy
- Activating this skill grants no authority to create, move, rename, merge, or delete files or directories.
- Read-only structure work produces an assessment or proposed map only.
- Implement a structural migration only when the task separately authorizes its affected paths and operations.
Use This Skill When
- adding major features introducing new directories/files
- repo navigation or discoverability has become difficult
- duplicate or near-duplicate files are accumulating
- refactors require moving modules, docs, or scripts
- monorepo boundaries are unclear or leaking responsibilities
Scope Boundary
This skill governs filesystem information architecture and structural hygiene.
Use Doc Maintenance and File Maintenance for:
- content-level documentation correctness and lifecycle maintenance
Use Order of Operations for:
- dependency-safe execution order for moves/renames
Core Principles
- organize by stable domain boundaries, not temporary implementation details
- one canonical home per concern
- explicit boundaries between app code, tooling, tests, docs, and generated artifacts
- minimize path depth for high-frequency files
- prevent duplicated truth sources
Structure Audit
Evaluate current structure for:
- discoverability of core app entrypoints
- cohesion of modules inside each directory
- coupling/leakage across domains
- duplicate docs/scripts/config fragments
- dead or orphaned files
Smell Detection
Flag these smells:
- multiple directories claiming same ownership domain
- files named with vague terms (
misc, temp, new2, copy-final)
- deeply nested directories with single-child chains
- duplicated docs differing by small stale edits
- generated files mixed with hand-edited source without clear separation
Normalization Rules
- define top-level directory purposes explicitly
- separate source, tests, docs, tooling, and build artifacts
- keep naming conventions consistent across sibling paths
- co-locate files that change together
- centralize shared utilities instead of cloning copies
Migration Safety Rules
- batch moves by domain and keep PR scope legible
- update imports, references, and docs in same change
- preserve history with rename/move-aware operations where possible
- validate commands, tests, and CI paths after moves
- capture temporary compatibility shims only when necessary and time-bound
Ownership and Boundaries
- define directory ownership or steward role for critical areas
- maintain clear public/internal module boundaries
- document canonical paths for runbooks and policy artifacts
- treat structure drift as maintenance debt with explicit remediation
Acceptance Checklist
- each top-level directory has a clear purpose
- duplicate/stale artifacts are removed or consolidated
- references/imports/docs updated to new paths
- structure supports fast onboarding and maintenance
- no orphaned files remain from migration
Deliverable Format
When applying this skill, provide:
- structure audit findings
- proposed/implemented directory map
- files moved/merged/removed summary
- validation results for references and tooling
- residual cleanup backlog
Source Reference
Primary references:
- Apple modular code organization guidance:
- Google engineering consistency/style guidance:
- MIT software construction modularity and abstraction principles:
Anti-Patterns
- organizing primarily by framework internals over domain purpose
- preserving duplicate files "just in case" without ownership
- mixing generated and source artifacts without boundaries
- moving files without synchronized reference/doc updates
- deep nesting that hides high-traffic files
Related Skills
1---2name: file-structure-optimization3description: Use for designing and maintaining repository file structure for clarity, modularity, discoverability, and low-duplication across app and documentation surfaces.4---56# File Structure Optimization78## Quick Index (Action-Routed)9### Read First (All Actions)101. `Mission`112. `Use This Skill When`123. `Scope Boundary`134. `Core Principles`1415### Action Modules (Read As Needed)161. Structural assessment:17 - `Structure Audit`18 - `Smell Detection`192. Refactoring strategy:20 - `Normalization Rules`21 - `Migration Safety Rules`223. Long-term hygiene:23 - `Ownership and Boundaries`24 - `Acceptance Checklist`2526### Output271. `Deliverable Format`282. `Anti-Patterns`2930## Mission31Keep repository layout predictable, modular, and easy to navigate while minimizing duplication and stale artifacts.3233## Authority and Artifact Policy341. Activating this skill grants no authority to create, move, rename, merge, or delete files or directories.352. Read-only structure work produces an assessment or proposed map only.363. Implement a structural migration only when the task separately authorizes its affected paths and operations.3738## Use This Skill When391. adding major features introducing new directories/files402. repo navigation or discoverability has become difficult413. duplicate or near-duplicate files are accumulating424. refactors require moving modules, docs, or scripts435. monorepo boundaries are unclear or leaking responsibilities4445## Scope Boundary46This skill governs filesystem information architecture and structural hygiene.4748Use [Doc Maintenance](../doc-maintenance/SKILL.md) and [File Maintenance](../file-maintenance/SKILL.md) for:491. content-level documentation correctness and lifecycle maintenance5051Use [Order of Operations](../order-of-operations/SKILL.md) for:521. dependency-safe execution order for moves/renames5354## Core Principles551. organize by stable domain boundaries, not temporary implementation details562. one canonical home per concern573. explicit boundaries between app code, tooling, tests, docs, and generated artifacts584. minimize path depth for high-frequency files595. prevent duplicated truth sources6061## Structure Audit62Evaluate current structure for:631. discoverability of core app entrypoints642. cohesion of modules inside each directory653. coupling/leakage across domains664. duplicate docs/scripts/config fragments675. dead or orphaned files6869## Smell Detection70Flag these smells:711. multiple directories claiming same ownership domain722. files named with vague terms (`misc`, `temp`, `new2`, `copy-final`)733. deeply nested directories with single-child chains744. duplicated docs differing by small stale edits755. generated files mixed with hand-edited source without clear separation7677## Normalization Rules781. define top-level directory purposes explicitly792. separate source, tests, docs, tooling, and build artifacts803. keep naming conventions consistent across sibling paths814. co-locate files that change together825. centralize shared utilities instead of cloning copies8384## Migration Safety Rules851. batch moves by domain and keep PR scope legible862. update imports, references, and docs in same change873. preserve history with rename/move-aware operations where possible884. validate commands, tests, and CI paths after moves895. capture temporary compatibility shims only when necessary and time-bound9091## Ownership and Boundaries921. define directory ownership or steward role for critical areas932. maintain clear public/internal module boundaries943. document canonical paths for runbooks and policy artifacts954. treat structure drift as maintenance debt with explicit remediation9697## Acceptance Checklist981. each top-level directory has a clear purpose992. duplicate/stale artifacts are removed or consolidated1003. references/imports/docs updated to new paths1014. structure supports fast onboarding and maintenance1025. no orphaned files remain from migration103104## Deliverable Format105When applying this skill, provide:1061. structure audit findings1072. proposed/implemented directory map1083. files moved/merged/removed summary1094. validation results for references and tooling1105. residual cleanup backlog111112## Source Reference113Primary references:1141. Apple modular code organization guidance:115 - https://developer.apple.com/documentation/xcode/organizing-your-code-with-local-packages1162. Google engineering consistency/style guidance:117 - https://google.github.io/styleguide/1183. MIT software construction modularity and abstraction principles:119 - https://ocw.mit.edu/courses/6-005-software-construction-spring-2016/120121## Anti-Patterns1221. organizing primarily by framework internals over domain purpose1232. preserving duplicate files "just in case" without ownership1243. mixing generated and source artifacts without boundaries1254. moving files without synchronized reference/doc updates1265. deep nesting that hides high-traffic files127128## Related Skills129- [Order of Operations](../order-of-operations/SKILL.md): sequence structural changes safely.130- [Regression Prevention](../regression-prevention/SKILL.md): validate no behavior regressions during structural refactors.131- [Doc Maintenance](../doc-maintenance/SKILL.md): keep structural docs aligned with moves.132- [File Maintenance](../file-maintenance/SKILL.md): sustain structure quality through ongoing audits.