| name | frontend-nextjs |
| description | NextJS frontend development patterns. Use when developing frontend code with NextJS, React, Tailwind, and TypeScript. |
| triggers | ["nextjs","next","react","frontend","tailwind","typescript frontend","ui","components"] |
NextJS Frontend Development
When to Use This Skill
Use when developing frontend code in a NextJS project with React, Tailwind, and TypeScript.
Recommended Project Structure
src/
āāā app/ # Routes, layouts, server components
āāā components/
ā āāā ui/ # Design system primitives (shadcn/ui)
ā āāā common/ # Reusable generic components
ā āāā layout/ # Header, Footer, Sidebar
ā āāā icons/
āāā features/
ā āāā <domain>/
ā āāā components/
ā āāā hooks/
ā āāā stores/
ā āāā services/
ā āāā constants/
ā āāā types/
āāā shared/
ā āāā hooks/
ā āāā utils/
ā āāā stores/
ā āāā services/
ā āāā constants/
ā āāā types/
āāā styles/
Organization Rules
components/ui ā Design system primitives only
components/common ā Generic components used across features
features/<domain> ā Domain-specific UI and logic (isolated)
shared/* ā Truly global hooks, utils, services
app/* ā Pages, layouts, data fetching; no business logic
Import Order
@/components/ui
@/components/common
@/features/<domain>
@/shared/...
Features must NOT import from other features.
Naming Conventions
- Folders and files: kebab-case
- Hooks:
use- prefix
- Stores:
-store.ts suffix
- Types: feature-local; export only when necessary
State & Data
- Server Components by default;
'use client' only when necessary
- Data fetching in
app/* or features/<domain>/services
- Global state only when crossing features; otherwise keep local
Styles (Tailwind)
- Use
cn helper (clsx + tailwind-merge) for conditional classes
- Mobile first approach
- Class order: layout -> box model -> typography -> visual -> states
- Avoid inline
style={{}}
Testing
- Stack: Vitest + Testing Library + MSW
- Test hooks, stores, services, components with real interactions
- Don't test: "renders without crash", CSS, third-party UI
- Naming: "should do X when Y"
- All tests in English
Pre-commit Checklist
- File in correct directory?
- Imports follow allowed graph?
'use client' only where needed?
- State properly localized?
- Tailwind formatted, no inline styles?
- Minimum accessibility applied?