/engineering-paved-path:onion-architecturefrom engineering-paved-path
Decides which backend layer (ring) a piece of code belongs to and who may import it — whether logic goes in a route/controller, a service, a repository, an adapter, a port, or a pure domain core; where a new port/adapter pair is declared; and how to keep web frameworks, ORMs and vendor SDKs out of the core. Use before adding a backend file, a query or an SDK call, when a module has no service or repository tier, when auditing which tiers every module has, and when reviewing a change for layer violations. Reads the repository's own architecture docs first and applies them over the defaults here. Does NOT cover web-framework APIs, ORM query syntax, or schema libraries (see fastify-best-practices, drizzle-orm-patterns, zod).
Ships in engineering-paved-path. 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.
This skill answers one question: which ring does this code belong to, and
who is allowed to import it? It is the backend counterpart to
frontend-ui-architecture.
Before applying anything below, read the repository's architecture sources, in this order, and stop at the first that defines the layers:
CLAUDE.md / AGENTS.md at the root and in the touched package.docs/architecture*, ARCHITECTURE.md, ADRs..dependency-cruiser.*, ESLint boundary
rules, tsconfig paths) — it states the enforced rules.Where the repository names its layers or folders differently, use its names and treat the layout below as the default vocabulary. If nothing documents the layers, say so and apply the defaults, labelling findings "per default layout".
Coupling points inward only: inner layers define interfaces, outer layers implement them (Palermo, Onion Architecture part 1).
domain core (pure: no I/O, no framework, no ORM)
← ports (interfaces and data contracts the core and use cases need)
← repository (queries; the only place that touches the database)
← service (business rules and orchestration, no queries)
← routes (transport: HTTP shape, input validation, no business logic)
adapters implement the ports ─┘ (wired only at the composition root)
| Ring | Responsibility | May import |
|---|---|---|
| Domain core | Pure transforms and rules | Nothing from outer rings; no framework or ORM |
| Ports | Interfaces for outbound integrations, shared contracts | Domain core |
| Repository | Queries, row-to-domain mapping | Ports, domain core, ORM |
| Service | Business rules, orchestration | Repository, ports, domain core |
| Routes | Transport, validation, status codes | Service, contracts |
| Adapters | Implement ports for vendor SDKs, clocks, secrets | Ports, vendor SDKs |
| Composition root | Builds adapters and services, the one place that knows concrete classes | Everything |
| Kind of code | Goes in |
|---|---|
| Transport shape, input validation, status codes | routes / controllers, no business logic |
| Orchestration, invariants, business rules | service, no queries |
| Any database query | repository, scoped by whatever the repository's tenancy rule requires |
| Pure transforms, row → DTO mapping | sibling helpers |
| Literals, thresholds | sibling constants |
| New outbound integration | port + adapter + a getter at the composition root + a test double |
| Cross-cutting (errors, config, jobs, logging) | a platform / shared module, not a feature module |
| Secrets | one provider behind a port; a single place reads the environment |
Use this when asked "which modules are missing a tier" or before a PR that adds a module. Per-file placement answers one question; the audit answers the whole-tree one.
For each feature module (skip shared and platform folders):
| Tier | Required when |
|---|---|
| routes | always |
| service | the module has any business rule or orchestration |
| repository | the module has any database query |
Apply these rules in order:
Collect the raw table with ls and grep over the module folders. Read the
output as evidence, not the verdict: a module with no repository and no query
is fine, and a repository/ folder counts as the repository tier. Open each
flagged line before reporting it with file:line.
Copy this and tick off before finishing a backend change:
- [ ] Adding a query? Is there a repository? If the module has none, create
it; do not add a second inline query.
- [ ] Is the query scoped the way the repository's tenancy rule requires?
- [ ] New SDK import? Does it belong in an adapter behind a port?
- [ ] Service constructing a concrete adapter? Resolve it from the
composition root instead.
- [ ] Importing another module's internals? Go through ports, platform, or
shared contracts.
- [ ] Touching the domain core? Still no I/O and no framework imports?
- [ ] Returning an ORM row outward? Map it to a DTO.
- [ ] Ran the repository's dependency-rule check (see reference/enforcement.md)?
- [ ] New or touched module? Run the tier audit.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub olena-shabetia/olena-shabetia-dev-digest-ai-marketplace --plugin engineering-paved-path12 skills in this plugin
/drizzle-orm-patternsProvides comprehensive Drizzle ORM patterns for schema definition, CRUD operations, relations, queries, transactions, and migrations. Proactively use for any Drizzle ORM development including defining database schemas, writing type-safe queries, implementing relations, managing transactions, and setting up migrations with Drizzle Kit. Supports PostgreSQL, MySQL, SQLite, MSSQL, and CockroachDB./fastify-best-practicesGuides development of Fastify Node.js backend servers and REST APIs using TypeScript or JavaScript. Use when building, configuring, or debugging a Fastify application — including defining routes, implementing plugins, setting up JSON Schema validation, handling errors, optimising performance, managing authentication, configuring CORS and security headers, integrating databases, working with WebSockets, and deploying to production. Covers the full Fastify request lifecycle (hooks, serialization, logging with Pino) and TypeScript integration via strip types. Trigger terms: Fastify, Node.js server, REST API, API routes, backend framework, fastify.config, server.ts, app.ts./frontend-ui-architectureDecides where frontend code belongs and who may import it — which folder a component, hook, constant, style, helper or type goes in, when to split a component into siblings or a nested folder, when to promote route-local code to the shared layer, and where business logic lives. Use before creating a frontend file, when a component or page is growing, when choosing between a route-local and a shared component, when a helper or constant needs a home, or when reviewing a change for structural drift. Reads the repository's own frontend conventions first and applies them over the defaults here. Does NOT cover React internals, hooks rules, state or rendering (see react-best-practices) or Next.js file conventions (see next-best-practices)./mermaid-diagramCreate Mermaid diagrams in markdown. Use when the user wants to visualize workflows, architectures, API flows, data models, state machines, or system designs. Covers flowcharts, sequence diagrams, class diagrams, ER diagrams, state diagrams, and more./next-best-practicesNext.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling/postgresql-table-designUse this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced featuresOther plugins' skills for the same job