NE

nextjs-architecture

Provides structure for large Next.js projects using FSD. Enforces thin page components and clear layer boundaries.

Install

mkdir -p .claude/skills/nextjs-architecture && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19511" && unzip -o skill.zip -d .claude/skills/nextjs-architecture && rm skill.zip

Installs to .claude/skills/nextjs-architecture

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Structure Next.js projects with Feature-Sliced Design layers, domain-grouped slices, and strict import hierarchy. Use when organizing features into FSD layers, enforcing slice boundaries, or keeping page.tsx thin.
213 chars✓ has a “when” trigger
Advanced

Key capabilities

  • Organize Next.js projects into FSD layers
  • Enforce strict import hierarchy between layers
  • Isolate business logic into domain-grouped slices
  • Separate Server and Client components via RSC boundaries
  • Expose slice functionality through public APIs

How it works

The architecture enforces a strict layer hierarchy (App, Widgets, Features, Entities, Shared) where code can only import from layers below it. It mandates grouping by business domain rather than file type to reduce coupling.

Inputs & outputs

You give it
Project directory structure and business domain requirements
You get back
Modularized codebase following Feature-Sliced Design layers

When to use nextjs-architecture

  • Initialize a new feature slice
  • Refactor business logic out of pages
  • Enforce layer import hierarchy
  • Group code by business domain

About this skill

Architecture (Feature-Sliced Design)

Priority: P2 (MEDIUM)

Warning: FSD introduces boilerplate. Use it only if project expected to grow significantly (e.g., 20+ features). For smaller projects, simple module-based structure preferred.

Workflow: Create New Feature Slice

  1. Create feature foldersrc/features/auth/login/ with ui/, model/, api/ segments.
  2. Add public API — Export via src/features/auth/login/index.ts.
  3. Wire into page — Import feature widget in app/login/page.tsx (thin page).
  4. Verify imports — Ensure no upward or cross-slice imports violate layer hierarchy.

Layer Hierarchy

App (app/) -> Widgets -> Features -> Entities -> Shared

See implementation examples for thin page example.

Strategy

  1. RSC Boundaries: Enforce strict serialization rules for props passed from Server to Client. See RSC Boundaries & Serialization.
  2. App Layer Thin: app/ directory (App Router) only for Routing.
  • Rule: page.tsx should only import Widgets/Features. No business logic (useEffect, fetch) directly in pages.
  1. Slices over Types: Group code by Business Domain (User, Product, Cart), not by File Type (Components, Hooks, Utils).
  • Bad: src/components/LoginForm.tsx, src/hooks/useLogin.ts
  • Good: src/features/auth/login/ containing both.
  1. Layer Hierarchy: Code can only import from layers below it.
  • App -> Widgets -> Features -> Entities -> Shared.
  1. Avoid Excessive Entities: not preemptively create Entities.
  • Rule: Start logic in Features or Pages. Move to Entities only when data/logic strictly reused across multiple differing features.
  • Rule: Simple CRUD belongs in shared/api, not entities.
  1. Standard Segments: Use standard segment names within slices.
  • ui (Components), model (State/actions), api (Data fetching), lib (Helpers), config (Constants).
  • Avoid: components, hooks, services as segment names.

Structure Reference

For specific directory layout and layer definitions, see reference documentation.

Architecture Checklist (Mandatory)

  • Layer Imports: any layer import from layer ABOVE it? (App > Widgets > Features > Entities > Shared)

  • Page Logic: page.tsx thin, containing only Widgets/Features and zero useEffect/fetch?

  • RSC Boundaries: Server Components isolated from Client Components with proper 'use client' boundaries?

  • Public API: all access to slice performed via top-level index.ts (public API)?

  • Cross-Slice: slices within same layer (e.g., two features) import from each other directly? (Prohibited)

  • Server Actions: Place them in model/ folder of Feature (e.g., features/auth/model/actions.ts).

  • Data Access (DAL): Place logic in model/ folder of Entity (e.g., entities/user/model/dal.ts).

  • UI Components: Base UI (shadcn) belongs in shared/ui. Feature-specific UI belongs in features/*/ui.

Anti-Patterns

  • No cross-slice imports: Slices in same layer must not import from each other directly.
  • No business logic in page.tsx: Pages import Widgets/Features only; zero useEffect/fetch.
  • No file-type folders: Group by domain (features/auth/), not type (components/, hooks/).
  • No premature Entity creation: Start in Features; move to Entities only on strict reuse.

When not to use it

  • Small projects with minimal expected growth
  • Projects requiring rapid prototyping without architectural constraints

Limitations

  • Introduces significant boilerplate
  • Prohibits cross-slice imports within the same layer

How it compares

This structure replaces standard file-type organization with domain-based slices to manage complexity in large-scale applications.

Compared to similar skills

nextjs-architecture side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
nextjs-architecture (this skill)013dNo flagsAdvanced
nextjs-best-practices316moNo flagsIntermediate
project-overview151moNo flagsBeginner
nx-generate16moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

nextjs-best-practices

davila7

Next.js App Router principles. Server Components, data fetching, routing patterns.

3164

project-overview

lobehub

Complete project architecture and structure guide. Use when exploring the codebase, understanding project organization, finding files, or needing comprehensive architectural context. Triggers on architecture questions, directory navigation, or project overview needs.

1548

nx-generate

nrwl

Generate code using nx generators. USE WHEN scaffolding code or transforming existing code - for example creating libraries or applications, or anything else that is boilerplate code or automates repetitive tasks. ALWAYS use this first when generating code with Nx instead of calling MCP tools or running nx generate immediately.

111

javascript-typescript-typescript-scaffold

sickn33

You are a TypeScript project architecture expert specializing in scaffolding production-ready Node.js and frontend applications. Generate complete project structures with modern tooling (pnpm, Vite, N

31

server-components

davepoon

This skill should be used when the user asks about "Server Components", "Client Components", "'use client' directive", "when to use server vs client", "RSC patterns", "component composition", "data fetching in components", or needs guidance on React Server Components architecture in Next.js.

13

supabase-architecture-variants

jeremylongshore

Execute choose and implement Supabase validated architecture blueprints for different scales. Use when designing new Supabase integrations, choosing between monolith/service/microservice architectures, or planning migration paths for Supabase applications. Trigger with phrases like "supabase architecture", "supabase blueprint", "how to structure supabase", "supabase project layout", "supabase microservice".

02

Search skills

Search the agent skills registry