/system-design:codebase-layoutfrom system-design
Designs, audits, or migrates physical source trees, packages, build targets, placement rules, and import-direction enforcement. Produces evidence-backed layouts, dependency rules, and staged migration plans.
Ships in system-design. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Design the physical source tree as an accurate map of product capability, ownership, runtime boundaries, and change cohesion. Do not start from a universal template. Choose the smallest honest structure that makes real boundaries visible and mechanically enforced.
Before you propose a tree or a migration, read each reference whose condition applies:
| Reference | Read when |
|---|---|
references/web-layouts.md | Structuring or auditing web backends, BFFs (backend-for-frontend hosts), frontends, full-stack meta-frameworks, design systems, or workspace and linter boundary rules |
references/ios-layouts.md | Structuring or auditing iOS, watchOS, or extension apps, local Swift Packages, build targets, Xcode project organisation, or Apple platform adapters |
references/migration-and-enforcement.md | Moving existing code, changing directory or package depth, or designing automated import, manifest, or build-target boundary checks |
Order the tree from broadest meaning to narrowest detail:
Treat directory names as claims. Prove every claimed boundary with packages, build targets, public visibility rules, static import checks, or architecture tests.
| Axis | Answers | Do not confuse with |
|---|---|---|
| Capability | Why does this code exist and change? | A technical layer |
| Bounded context | Where do domain language and model authority change? | A single noun, database table, team name, or convenience folder |
| Hexagon | Which policy must run and test without external technology? | Every pure utility, a generic core folder, or domain modelling alone |
| Feature or use case | Which behaviour changes together? | A mandatory separate package or bounded context |
| Public interface leaf | Where does an external request or command enter? | The owner of shared workflow state or domain policy |
| Package or build target | Which boundary can build and lint tools enforce? | A business boundary by itself |
| Composition root | Where is the live object graph constructed and wired? | A mandatory folder inside libraries or every feature |
Before you read deeply or propose edits, classify the request as an audit, a proposal, a migration plan, or authorised file edits.
Do not design from directory listings alone. Read enough real code and project configuration to ground every boundary in evidence:
Record uncertainty explicitly. Treat unverified context or package splits as hypotheses until language, invariants, ownership, or dependency direction prove them.
Match the physical shape to observed evidence:
| Observed signal | Primary shape |
|---|---|
| Tiny library or early prototype | Flat or nearly flat module |
| Ordinary service or app without ports and adapters | Feature-first or use-case-first |
| Bounded contexts without ports and adapters | Context-first with explicit public contracts |
| Explicitly opted-in ports-and-adapters system | Capability first, then visible inside/outside, then featureful interior |
| Public-interface-heavy host (for example HTTP API, BFF, or CLI) | Public interface tree (endpoints or commands) plus sibling workflows and composition |
| Framework-constrained host | Thin required framework entry points delegating to feature modules |
| Small UI client | Framework-native screen or route tree with shallow colocation |
| Feature-rich UI client | Screen or route composition plus product-feature modules and named foundations |
| Multi-runtime or full-stack app | Explicit runtime separation (for example client versus server) enforced in the build graph |
| Multi-app or multi-platform workspace | Product or capability grouping plus enforceable leaf packages or build targets |
| Operational or automation tool | Workflow-first or command-first |
| Established coherent structure | Preserve it unless the requested scope and measured pain justify migration |
Combine shapes where needed. A workspace or multi-target package is an enforcement overlay. An edge host can invoke hexagonal modules without becoming a hexagon itself.
Introduce a visible inside/outside hexagonal tree only when the project explicitly opts into ports and adapters and every condition below holds:
Do not build ceremonial hexagonal trees for simple CRUD services, thin provider wrappers, operational scripts, or vocabulary-only type libraries. Hand semantic port, Domain Probe, read-model, and fake-swappability rules to hexagonal-architecture instead of duplicating them here.
Every layout proposal or audit must deliver all seven parts:
refactoring and hidden-dependency breaking to test-seams), tooling discovery verification, and dependency inversion separately from mechanical file moves (see references/migration-and-enforcement.md).monetary-values or order-event-contracts). Never create unowned shared, common, utils, helpers, or services dumping grounds.Reject these physical structures:
hexagon or core directories that still import provider SDKs or allow outward imports without enforcement.controllers, services, models, repositories, components, hooks, viewmodels, stores) spanning unrelated capabilities.shared, common, utils, helpers, or managers catch-all directories.Keep physical layout, placement rules, target/package boundaries, import enforcement, and tree migration planning in codebase-layout. Name each owning companion skill explicitly when routing adjacent concerns; when handing off complexity reduction to reducer, state explicitly that a physical folder move alone is not complexity reduction:
| Need | Hand off to |
|---|---|
| Logical module boundaries, module depth, caller-first types and function signatures | architect |
| Semantic ports-and-adapters design (inside/outside zones, driving/driven ports, Domain Probes, CQRS-lite, stateful fakes and swappability) | hexagonal-architecture |
| Read-only repository-wide architectural hotspot discovery and investment ranking | architecture-audit |
| Safe behaviour-preserving file moves, decomposition, and characterisation tests | refactoring |
| Breaking hidden dependencies in untestable legacy code before writing tests | test-seams |
| Proving whole-system complexity reduction (a folder move alone is not complexity reduction) | reducer |
| UI state ownership and view data flow without ViewModels on Apple platforms | swiftui-architecture |
| App Intents design and entity/dependency patterns on Apple platforms | app-intent-driven-development |
| Statechart and actor modelling inside the layer this skill declares as owner | xstate |
| Architecture and dependency diagram syntax and evidence rules | mermaid-generator |
Before you finish, verify every gate:
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mintuz/skills --plugin system-design5 skills in this plugin
/architecture-auditWHEN auditing an existing repository or multi-module subsystem to discover and rank bounded architectural hotspots and decide where investment pays off now; NOT for designing one already-selected module contract (architect), auditing physical directory, package or build-target layout and import enforcement (codebase-layout), breaking hidden dependencies in untestable code (test-seams), simplifying one chosen path (reducer), or editing code (refactoring); returns a read-only Markdown and Mermaid report with qualitative ranking, confidence, counterevidence and next-skill handovers.
/hexagonal-architectureWHEN a repository or user explicitly opts into hexagonal (ports and adapters) architecture via README, AGENTS.md, CLAUDE.md, ADR, or explicit adoption request — apply to every code change in that opted-in repo alongside tdd; NOT for repositories that have not opted in, generic test-seam or isolation requests, or physical folder layout alone; enforces inside/outside zones, application-owned ports, thin adapters, composition roots, and stateful-fake testing.
/mermaid-generatorWHEN creating Mermaid diagrams from code or architecture; NOT for diagrams without a code or system-design source; analyzes the relevant structure and returns a scoped, renderable diagram with evidence and assumptions.
/twelve-factorWHEN configuring, auditing, or refactoring deployable service or app operational boundaries—deploy-time configuration and secrets, backing services, process startup and graceful shutdown, structured logging, dev/prod parity, or one-off admin tasks; NOT for pure UI styling, internal logic refactoring, or domain design with no deployment or operational boundary; applies the twelve factors through an upfront platform applicability gate so server-only rules never misapply to edge functions or client apps.Other plugins' skills for the same job