layered-module-structure
БесплатноБез исполняемых скриптовНе проверенUse only when the user explicitly invokes this skill.
от buYoung★ 21 звезда на GitHubОб этом скилле
Layered Module Structure
Organize a codebase into three visible layers whose dependencies flow one way, whose shared contracts have one source of truth, whose resources and tests live with their owners, and whose structure maximizes Developer Experience (DX): fast navigation, small edit blast radius, cohesive files, low ceremony, and zero unnecessary indirection.
Core principles
- User language lock. Communicate, ask questions, write brief step-by-step progress narration, and write every plan and report in the user's language throughout the entire session (including after context compaction). Keep paths, module names, commands, identifiers, and rule IDs verbatim.
- Language-neutral, mechanism-native. Apply every rule through the project's own toolchain mechanism (entry re-exports, visibility modifiers, build targets, or public headers). Never copy another language's file convention into a toolchain that works differently. Where a toolchain lacks mechanical enforcement, note the gap and address it through rule
V2where enforcement adds value. - DX litmus test. Architecture serves daily engineering ergonomics, not compliance theater. Before proposing a new module, interface, or injection boundary, verify that its benefit exceeds its maintenance cost:
- No trivial micro-modules. Do not split off a single-file build unit unless it protects a deployment/privilege boundary (
L4), breaks a real cycle (L2), or isolates heavy transitive dependencies from Layer 0 (L1). - No speculative single-implementation interfaces. Extract a Layer 0 contract to break a cycle, keep domain logic free of I/O/platform/UI dependencies, or cross a process/language boundary — not to wrap ordinary acyclic calls.
- No ceremony-heavy DI for ubiquitous read-only utilities. Distinguish hidden mutable/environmental state and service locators (which hurt determinism and testability) from process-wide read-only utilities initialized once at startup (such as localization lookup tables or stateless UI style helpers called across hundreds of view sites). Weigh constructor churn against actual testability value before proposing mass injection rewrites.
- Idiomatic low-friction mechanisms first. Prefer the toolchain's cleanest native mechanism (compile-excluded hook files, separate build targets, native visibility scopes) over scattered conditional blocks or bloated bridge interfaces.
- No trivial micro-modules. Do not split off a single-file build unit unless it protects a deployment/privilege boundary (
Key terms. Module: smallest unit declaring dependencies to the build system (or feature directories inside each layer in a single-build-unit project; layer folders themselves are containers, not modules). Unit: a module or cohesive source directory inside one. Execution unit: anything that starts on its own (app, CLI, service, worker, helper, design-time tool). Composition Root: the one place in an execution unit that constructs and wires concrete lower modules.
1. Settle the task
Infer the task from the invoking request and state any inferred task on the first line so the user can redirect:
| User asks to | Task | File edits |
|---|---|---|
| Design, set up, or scaffold a project or module | Design | Only when asked to create a skeleton |
| Check, review, or audit (or names no action when code exists) | Audit | None |
| Clean up, apply, restructure, migrate, or fix structure | Restructure | Only after Gate 2 approval |
| Add something or asks where code belongs | Place | As the request requires |
- Target: the named path, or the whole repository. For a narrow target inside a larger workspace/monorepo, still include modules it references in the layer map so layers stay meaningful, treat shared workspace packages outside the target as read-only by default, and require user approval plus affected-sibling verification before modifying any shared package.
- No action named & no code: Design from what the request describes (or ask what is being built).
- Combined request (e.g. "audit and fix"): run in sequence and deliver the final task's report containing earlier results.
2. Architecture & rule index
Every shipped module sits in one of three layers; developer tools, generators, shared test-support, examples, benchmarks, and design-time previews sit outside.
| Layer | Holds | Allowed dependencies |
|---|---|---|
| 0 Core | Shared contracts, types, constants, external config schema, raw low-level bindings | Other Layer 0 modules (acyclic); no external dependencies for behavior |
| 1 Services | Four roles: pure (stateless algorithms), domain (product rules/state), ui (views/rendering), platform (storage/network/OS/SDK adapters) |
Layer 0, plus Layer 1 roles along the L3 matrix below |
| 2 Apps | One module per execution unit (Composition Root: wiring, startup, app shell; no reusable domain logic) | Layer 1 and Layer 0 (never another Layer 2) |
Layer 1 same-layer matrix (L3) — all edges must be acyclic (any cycle is L2):
| From \ To | P
Установить layered-module-structure в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл layered-module-structure?
Use only when the user explicitly invokes this skill.
Как установить скилл layered-module-structure?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл layered-module-structure запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic