nextjs-architecture
БесплатноБез исполняемых скриптовНе проверенStructure Next.js projects with Feature-Sliced Design layers, domain-grouped slices, and strict import hierarchy. Use when organizing features into FSD…
от HoangNguyen0403★ 598 звёзд на GitHubОб этом скилле
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
- 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 feature widget in
app/login/page.tsx(thin page). - 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
- RSC Boundaries: Enforce strict serialization rules for props passed from Server to Client. See RSC Boundaries & Serialization.
- App Layer Thin:
app/directory (App Router) only for Routing.
- Rule:
page.tsxshould only import Widgets/Features. No business logic (useEffect,fetch) directly in pages.
- 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.
- Layer Hierarchy: Code can only import from layers below it.
App->Widgets->Features->Entities->Shared.
- Avoid Excessive Entities: not preemptively create Entities.
- Rule: Start logic in
FeaturesorPages. Move toEntitiesonly when data/logic strictly reused across multiple differing features. - Rule: Simple CRUD belongs in
shared/api, notentities.
- 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 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.tsxthin, containing only Widgets/Features and zerouseEffect/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 infeatures/*/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; 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.
Установить nextjs-architecture в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл 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.
Как установить скилл nextjs-architecture?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nextjs-architecture запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic