> nextjs-architecture
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. (triggers: src/features/**, src/entities/**, src/widgets/**, FSD, Feature Sliced Design, slices, segments)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/nextjs-architecture?format=md"Architecture (Feature-Sliced Design)
Priority: P2 (MEDIUM)
Adopt Feature-Sliced Design (FSD) for scalable applications. Warning: FSD introduces boilerplate. Use it only if the project is expected to grow significantly (e.g., 20+ features). For smaller projects, a simple module-based structure is preferred.
Workflow: Create a New Feature Slice
- Create feature folder —
src/features/auth/login/withui/,model/,api/segments. - Add public API — Export via
src/features/auth/login/index.ts. - Wire into page — Import the feature widget in
app/login/page.tsx(thin page). - Verify imports — Ensure no upward or cross-slice imports violate the layer hierarchy.
Layer Hierarchy
App (app/) -> Widgets -> Features -> Entities -> Shared
See implementation examples for a thin page example.
Strategy
- RSC Boundaries: Enforce strict serialization rules for props passed from Server to Client. See RSC Boundaries & Serialization.
- App Layer is Thin: The
app/directory (App Router) is only for Routing.- Rule:
page.tsxshould only import Widgets/Features. No business logic (useEffect,fetch) directly in pages.
- Rule:
- 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.
- Bad:
- Layer Hierarchy: Code can only import from layers below it.
App->Widgets->Features->Entities->Shared.
- Avoid Excessive Entities: Do not preemptively create Entities.
- Rule: Start logic in
FeaturesorPages. Move toEntitiesonly when data/logic is strictly reused across multiple differing features. - Rule: Simple CRUD belongs in
shared/api, notentities.
- Rule: Start logic in
- Standard Segments: Use standard segment names within slices.
ui(Components),model(State/actions),api(Data fetching),lib(Helpers),config(Constants).- Avoid:
components,hooks,servicesas segment names.
Structure Reference
For the specific directory layout and layer definitions, see the reference documentation.
Architecture Checklist (Mandatory)
-
Layer Imports: Does any layer import from a layer ABOVE it? (App > Widgets > Features > Entities > Shared)
-
Page Logic: Is
page.tsxthin, containing only Widgets/Features and zerouseEffect/fetch? -
RSC Boundaries: Are Server Components isolated from Client Components with proper 'use client' boundaries?
-
Public API: Is all access to a slice performed via the top-level
index.ts(public API)? -
Cross-Slice: Do slices within the same layer (e.g., two features) import from each other directly? (Prohibited)
-
Server Actions: Place them in the
model/folder of a Feature (e.g.,features/auth/model/actions.ts). -
Data Access (DAL): Place logic in the
model/folder of an Entity (e.g.,entities/user/model/dal.ts). -
UI Components: Base UI (shadcn) belongs in
shared/ui. Feature-specific UI belongs infeatures/*/ui.
Anti-Patterns
- No cross-slice imports: Slices in the same layer must not import from each other directly.
- No business logic in
page.tsx: Pages import Widgets/Features only; zerouseEffect/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.
> related_skills --same-repo
> common-store-changelog
Generate user-facing release notes for the Apple App Store and Google Play Store by collecting git history, triaging user-impacting changes, and drafting store-compliant changelogs. Enforces character limits (App Store ≤4000, Google Play ≤500), tone, and bullet format. Use when generating release notes, app store changelog, play store release, what's new, or version release notes for any mobile app. (triggers: generate changelog, app store notes, play store release, what's new, release notes, ve
> golang-tooling
Go developer toolchain — gopls LSP diagnostics, linting, formatting, and vet. Use when setting up Go tooling, running linters, or integrating gopls with Claude Code. (triggers: gopls, golangci-lint, golangci.yml, go vet, goimports, staticcheck, go tooling, go lint)
> common-ui-design
Design distinctive, production-grade frontend UI with bold aesthetic choices. Use when building web components, pages, interfaces, dashboards, or applications in any framework (React, Next.js, Angular, Vue, HTML/CSS). (triggers: build a page, create a component, design a dashboard, landing page, UI for, build a layout, make it look good, improve the design, build UI, create interface, design screen)
> common-owasp
OWASP Top 10 audit checklist for Web Applications (2021) and APIs (2023). Load during any security review, PR review, or codebase audit touching web, mobile backend, or API code. (triggers: security review, OWASP, broken access control, IDOR, BOLA, injection, broken auth, API review, authorization, access control)