nextjs-app-router

Installation
SKILL.md

Priority: P0 (CRITICAL)

Implementation Guidelines

Routing Architecture

  • Structure: Use the 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 be excluded from URL path. Use Dynamic Routes (brackets [slug]) and define static paths via generateStaticParams.
  • Specialized: Use Parallel Routes (@modal) by adding the slot to the parent layout and providing a default.tsx fallback. Use Intercepting Routes ((.)route) for advanced layouts like dashboards.

Data & Functions

  • Next.js 15+ Async: Always await the params: Promise, searchParams, cookies(), and headers().
  • Security: Use middleware.ts for edge-side authentication and redirection. Ensure all Route Handlers (route.ts) are 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 a Suspense boundary. In error.tsx, use 'use client' and provide a reset: () => void function. const theme = cookieStore.get('theme');
Installs
3
GitHub Stars
60
First Seen
Apr 14, 2026
nextjs-app-router — comeonoliver/skillshub