Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

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.

Licencja
MIT
Ostatnia zmiana repozytorium
22.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
4
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 22.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

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

  1. Priority: P0 (CRITICAL)
  2. Workflow: Add New Route
  3. Route Group Example
  4. Implementation Guidelines
  5. File Conventions
  6. Structure Patterns
  7. Best Practices
  8. Anti-Patterns
Sekcje z nagłówków SKILL.md, w oryginale · 59 linii, 419 słów
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

RepozytoriumWynikLicencja
Ta strona · HoangNguyen0403/agent-skills-standard100MIT
peterbamuhigire/chwezi-dev-engine100MIT
SkillMedev/skills100MIT
nextboxis/library-skill-agents100MIT
sabahattink/antigravity-fullstack-hq100MIT
chrishuffman5/domain-expert100MIT
giuseppe-trisciuoglio/developer-kit100MIT
claude-dev-suite/claude-dev-suite95MIT
TheBushidoCollective/han95Apache-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.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.