nextjs-app-router
/nextjs-app-router
Konfiguruje routing oparty na plikach w Next.js App Router: zagnieżdżone layouty, grupy tras, trasy równoległe, granice błędów oraz stany ładowania i błędów.
- Autor
- HoangNguyen0403 ↗
- Repozytorium
- agent-skills-standard ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 22.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 4
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 22.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Konfiguruje routing oparty na plikach w Next.js App Router: zagnieżdżone layouty, grupy tras, trasy równoległe, granice błędów oraz stany ładowania i błędów.
Oryginalny opis (EN)
Configure file-system routing with nested layouts, route groups, parallel routes, and error boundaries in Next.js App Router. Use when creating page routes, adding loading/error states, or organizing routes with groups and dynamic segments.
Jak działa
- Priority: P0 (CRITICAL)
- Workflow: Add New Route
- Route Group Example
- Implementation Guidelines
- File Conventions
- Structure Patterns
- Best Practices
- Anti-Patterns
Podgląd SKILL.md
---
name: nextjs-app-router
description: Configure file-system routing with nested layouts, route groups, parallel routes, and error boundaries in Next.js App Router. Use when creating page routes, adding loading/error states, or organizing routes with groups and dynamic segments.
metadata:
triggers:
files:
- 'app/**/page.tsx'
- 'app/**/layout.tsx'
- 'app/**/loading.tsx'
keywords:
- App Router
- Layout
- Route Group
- parallel routes
---
## **Priority: P0 (CRITICAL)**
## Workflow: Add New Route
1. **Create page** — Add `app/dashboard/page.tsx` as Server Component.
2. **Add layout** — Create `app/dashboard/layout.tsx` returning `{children}`.
3. **Add loading state** — Create `app/dashboard/loading.tsx` for Suspense boundary.
4. **Add error boundary** — Create `app/dashboard/error.tsx` with `'use client'` and `reset` prop.
5. **Await async APIs** — In Next.js 15+, `await params`, `cookies()`, `headers()`.
## Route Group Example
See [implementation examples](references/implementation.md)
## Implementation Guidelines
### Routing Architecture
- **Structure**: Use **`app/` directory**. Define routes with **`app/dashboard/layout.tsx`** returning **`{children}`**; shared UI nests inside `app/layout.tsx` automatically. Handle states with **`loading.tsx`**, **`error.tsx`**, and **`not-found.tsx`**.
- **Segments**: Organize features with **Route Groups** (brackets **`(auth)`**) to **excluded from URL path**. Use **Dynamic Routes** (brackets `[slug]`) and define static paths via **`generateStaticParams`**.
- **Specialized**: Use **Parallel Routes** (**`@modal`**) by adding slot to parent layout and providing **`default.tsx`** fallback. Use **Intercepting Routes** (`(.)route`) for advanced layouts like dashboards.
### Data & Functions
- **Next.js 15+ Async**: Always **`await`** **`params: Promise`**, **`searchParams`**, **`cookies()`**, and **`headers()`**.
- **Security**: Use **`middleware.ts`** for edge-side authentication and redirection. Ensure all **Route Handlers (`route.ts`)** secured with appropriate auth checks.
- **RSC**: Default to **React Server Components (RSC)**. Only use **`'use client'`** at leaf nodes for interactivity (hooks/events).
- **Error Boundaries**: Create **`app/dashboard/loading.tsx`** to auto-wrap routes in **Suspense boundary**. In **`error.tsx`**, use **`'use client'`** and provide **`reset: () => void`** function.
## File Conventions
- **page.tsx**: UI for route.
- **layout.tsx**: Shared UI wrapping children. Persists across navigation.
- **loading.tsx**: Suspense boundary for loading states.
- **error.tsx**: Error boundary (Must Client Component).
- **route.ts**: Server-side API endpoint.
## Structure Patterns
- **Route Groups**: Use parenthesis `(auth)` to organize without affecting URL path.
- **Private Folders**: Use underscore `_lib` to exclude from routing.
- **Dynamic Routes**: Use brackets `[slug]` or `[...slug]` (catch-all).
## Best Practices
- **RSC Boundaries**: Ensure props passed to Client Components serializable. See [RSC Boundaries & Serialization](../nextjs-architecture/references/RSC_BOUNDARIES.md).
- **Parallel Routes (`@folder`)**: Render multiple pages in same layout. Use `default.tsx` for fallback.
- **Intercepting Routes (`(..)folder`)**: Load routes within current layout context.
- **Colocation**: Keep component files, styles, and tests inside route folder.
- **Layouts**: Use Root Layout (`app/layout.tsx`) for `<html>` and `<body>` tags.
- [**Self-Hosting Standard**](references/SELF_HOSTING.md)
## Anti-Patterns
- **No unawaited async APIs**: `params`, `cookies()`, `headers()` Promises in Next.js 15+; always await.
- **No `'use client'` at tree root**: Place at leaves; keep layouts and pages as Server Components.
- **No `<html>`/`<body>` in nested layouts**: Only `app/layout.tsx` (root layout) should include them.
- **No missing `error.tsx`**: Every route segment needs Client Component error boundary.
Pliki w paczce (4)
- SKILL.md 4 KB
- evals/evals.json 2 KB
- references/SELF_HOSTING.md 1 KB
- references/implementation.md 1 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · HoangNguyen0403/agent-skills-standard | 100 | MIT |
| peterbamuhigire/chwezi-dev-engine | 100 | MIT |
| SkillMedev/skills | 100 | MIT |
| nextboxis/library-skill-agents | 100 | MIT |
| sabahattink/antigravity-fullstack-hq | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
| giuseppe-trisciuoglio/developer-kit | 100 | MIT |
| claude-dev-suite/claude-dev-suite | 95 | MIT |
| TheBushidoCollective/han | 95 | Apache-2.0 |
Migawka bazy z 13.11.2026 · wersja paczki 27a0d011efd1 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 3 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100nextjs-routes-layouts
Dodaje lub przebudowuje trasy w Next.js 16 App Router: strony, layouty, segmenty dynamiczne, grupy tras, granice loading i error, strony not-found oraz typowanie params. - 100app-router
Prowadzi przez konwencje plików i routing Next.js App Router: trasy, układy, stany ładowania, granice błędów i trasy dynamiczne. - 100nextjs
Opisuje wzorce Next.js 15+ z App Router: Server i Client Components, pobieranie danych, layouty, server actions, stany ładowania, granice błędów, nawigacja i metadane. - 100nextjs-routing
Obsługuje routing w Next.js App Router: trasy plikowe, segmenty dynamiczne, grupy tras, trasy równoległe i przechwytujące, middleware, nawigację programową i linki. - 95nextjs-expert
Wspiera budowę aplikacji Next.js 14 i 15 z App Routerem: routing, układy, komponenty serwerowe i klienckie, Server Actions, middleware, cache, streaming, trasy równoległe i przechwytujące. - 100nextjs-conventions
Stosuje konwencje Next.js: struktura projektu, pliki App Router, layouty, granice błędów, metadane SEO i OpenGraph, optymalizacja obrazów i fontów oraz konfiguracja next.config.js.