nextjs-app-router-file-conventions
Installation
SKILL.md
Next.js App Router File Conventions
Special Files
| File | Purpose | Required | Component Type |
|---|---|---|---|
layout.tsx |
Shared UI for route segment | Yes (root only) | Server |
page.tsx |
Unique UI for route | Yes | Server (default) |
loading.tsx |
Loading UI (Suspense fallback) | No | Server |
error.tsx |
Error UI (Error Boundary) | No | Client |
not-found.tsx |
404 UI | No | Server |
route.ts |
API endpoint | No | N/A (API) |