/engineering-paved-path:frontend-ui-architecturefrom Engineering Paved Path
Frontend UI architecture and code organization for React & Next.js — deciding WHERE code should live (folder/file structure, feature- vs type-based layout, colocation, where components / hooks / business logic / utils / constants / types / Server Actions belong, module boundaries and imports, and organizing the Server/Client boundary). Use this skill WHENEVER the user asks how to structure or organize a React/Next.js project, where a file/component/hook/type should go, how to split a large component, where to put business logic or data access, utils-vs-lib-vs-helpers, or barrel files — or asks for an architecture/structure review — even if they don't say the word 'architecture' and even though such questions can look answerable directly. Structure & organization only — not in-component coding rules (use react-best-practices) or Next.js API/feature mechanics (use next-best-practices).
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.
Decisions about where code lives and how the project is organized for React & Next.js apps: folder structure, file placement, module boundaries, and the Server/Client boundary as an organizational concern.
This skill is about structure, not coding style. For in-component correctness and anti-patterns (hooks, state, rendering, memoization) use react-best-practices; for Next.js API/feature usage (RSC mechanics, data APIs, metadata, optimization) use next-best-practices.
When the honest answer is "it depends," default to these — they're the calls worth committing to explicitly, the ones that keep a codebase from drifting. The detail behind each is below.
src/{app, components/ui, features/<domain>, lib, hooks, utils, types, config}. Type-only folders are fine for a throwaway; commit to features past
~15–20 components instead of relitigating it later.index.ts; features never import each other's internals.
Enforce it (ESLint import/no-restricted-paths), don't just intend it — this is the boundary that
prevents the mess.lib/ = stateful integrations (db, auth, SDK clients); utils/ = pure functions. Never a
junk-drawer utils.ts — name files by what they provide (date.ts, currency.ts).server-only data-access layer is the sole reader of process.env/DB; Server Actions
stay thin and delegate to it. Secrets never enter a "use client" module graph."use client" only on interactive leaves;
pass Server Components as children into Client Components (a Client Component can't import one);
wrap context in a small client Providers so the rest of the tree stays server-rendered.Load on demand — keep this file in context, open a reference only when the task needs that depth.
Apply these in order — they resolve most "where does this go?" questions.
src/ with a few
folders. Introduce features/ and deeper boundaries only when the app grows. Don't pre-build
structure for scale you don't have.auth,
billing), not what it is (all-components, all-hooks). Type-based grouping is fine for small apps.components, hooks, lib, utils, types) →
features → app/routing. No cross-feature imports. If two features share code, lift it to shared.src/: app/ (or routing), components/ (shared UI), features/, hooks/, lib/,
utils/, types/, config/, stores/. These names are conventions, not framework rules — be consistent.features/<name>/{components,hooks,api,utils,types}
plus an optional index.ts public API. Internals stay private to the feature.components/, hooks/, utils/ only) is acceptable for small apps; migrate to
feature-based as the count of files-per-folder grows past comfort.| Code | Default location | Promote / escalate when |
|---|---|---|
| Component used by one feature | features/<f>/components/ | a 2nd feature needs it → components/ |
| Shared UI primitive (Button, Card) | components/ui/ | — |
| Custom hook (feature-specific) | features/<f>/hooks/ | reused elsewhere → hooks/ |
| Business logic | a custom hook, or features/<f>/api/services; server-side → a DAL | — |
| Constant used once | top of the file that uses it | feature-wide → <f>/constants.ts; app-wide → config/ |
| Pure, generic helper | utils/ | — |
| Project-specific helper | beside its feature (<f>/utils or *.helpers.ts) | becomes generic → utils/ |
| Type used once | same file as its use | shared → <f>/types.ts or *.types.ts; cross-package → shared package |
| API / data-fetch functions | features/<f>/api/ or lib/api | — |
| Server Action (Next.js) | <f>/actions.ts / _actions/, thin → delegates to DAL | — |
| Third-party client/init (db, auth, SDK) | lib/ | — |
Definitions and the reasoning (utils vs helpers vs lib vs services, type placement, business-logic placement) are in references/where-things-go.md.
import/no-restricted-paths): shared may
not import from features; features may not import from each other; routing/app sits on top.@/*) instead of ../../../ relative chains.index.ts): a thin, per-feature public-API barrel is fine. Avoid large or
app-wide barrels and deep barrel chains — they hurt tree-shaking and dev-server/HMR and create
import cycles. Prefer direct imports for internal and shared modules.When and whether to split — not how to write the component (that's react-best-practices).
children/slots; "lift content up" (give a wrapper its content via
children when it doesn't use it for logic); "push state down" to the component that needs it.children fails to remove the
prop drilling.Where state lives (organizational). For state-hook coding rules, see react-best-practices.
useState/useEffect. Keep it out of UI-state stores.Key rules (full detail in references/nextjs-app-router.md):
app/ is for routing only — push logic into features/.app/ (only page/route output ships); opt subtrees out of
routing with private folders (_folder); organize routes without changing URLs via route
groups ((group))."use client" to the leaves of the tree; pass Server Components into Client Components as
children/props rather than importing them.server-only package, a data-access layer); process.env and
secrets stay server-side.<feature>/actions.ts) and delegate to a server-only data layer.lib vs utils convention: lib/ = stateful integrations (db, auth, SDK clients), utils/ =
pure helpers. (Officially both names are arbitrary — pick one convention and hold it.)constants.ts, types.ts, hooks.ts. Suffix shared kinds:
*.types.ts, *.helpers.ts, *.store.ts.is/has/should. Event handlers: handle* (defining) / on* (prop). Utilities:
get/set/use. HOCs: with*.utils.ts / helpers.ts / misc.ts collecting unrelated functions — name files
by what they provide; group by cohesion.children/composition extraction would remove.shared/ abstraction with a single consumer.What SKILL.md sets; muted values are Claude Code's defaults
Trigger phrases: 'where should this file/component/hook go', 'how should I structure the folders', 'feature-based vs type-based', 'where do I put business logic / constants / types', 'utils vs helpers vs lib vs services', 'should I use barrel files', 'where does the API/data layer live', 'organize this React/Next project', 'review the project architecture', 'where to put use client / Server Actions'.
Other plugins' skills for the same job
npx claudepluginhub rostk/my-monkeys --plugin engineering-paved-path13 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./engineering-insightsCaptures durable engineering learnings to the touched module's learnings file (LEARNINGS.md by default, configurable). Use at the end of a substantive session (>30 min with a real problem, decision, or discovery) as a wrap-up, or mid-session when something non-obvious surfaces. Re-reads the target file first, then appends actionable-cold notes; never overwrites and never duplicates./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./next-best-practicesNext.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling/onion-architectureOnion / ports-and-adapters / layered architecture for a TypeScript/Node backend (Fastify modules plus a pure domain core) — deciding WHICH ring backend code belongs in and WHICH WAY its dependencies may point. Use this skill WHENEVER working server-side: adding or changing a route/service/repository, adding an adapter or port, wiring something into the DI Container, deciding whether a route or service may import Drizzle / an SDK / another module, or reviewing the backend's layering — even when the user does not say 'onion' or 'architecture'. It enforces the inward dependency rule, the ports-in-shared / implementations-in-adapters split, the Container as the single composition root, Drizzle-queries-only-in-the-repository, and the Zod contracts in your shared package as the shared domain + boundary type. Backend structure and boundaries only — not Drizzle query syntax (use engineering-paved-path:drizzle-orm-patterns), Fastify route mechanics (use engineering-paved-path:fastify-best-practices), Postgres schema design (use engineering-paved-path:postgresql-table-design), Zod syntax (use engineering-paved-path:zod), or frontend layout (use engineering-paved-path:frontend-ui-architecture)./postgresql-table-designUse this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features