app-router

Creates organizes App.jsx Router routes and file conventions for app directories.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/dr-code/beacon --skill app-router-dr-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: app-router
Source: https://github.com/dr-code/beacon/tree/main/plugins/nextjs-expert/skills/app-router
Command: npx skills add https://github.com/dr-code/beacon --skill app-router-dr-code

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Developers often struggle to correctly structure and organize Next.js app directory routes, leading to broken navigation, inconsistent layouts, and hard-to-maintain code. This Skill provides clear, actionable conventions so teams can build predictable route hierarchies and UI boundaries.

Core Features & Use Cases

  • File & Folder Conventions: Explains page, layout, loading, error, not-found, template, and default file roles and placement.
  • Routing Patterns: Covers dynamic segments, catch-all, optional catch-all, route groups, private folders, parallel routes, and intercepting routes.
  • UX States & Metadata: Advises on loading and error boundaries, not-found handling, static and dynamic metadata, and layout composition for nested routes.
  • Real-world Use Case: Use to add a blog with dynamic slugs, nested dashboard layouts, and modal intercepting routes while preserving layout state.

Quick Start

Use the app-router skill to add a new app/blog/[slug]/page that implements dynamic routing, fetches the post, and returns notFound when missing.

Frequently Asked Questions about app-router

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure dynamic routes in Next.js App Router?

Dynamic routes in the Next.js App Router are structured using bracket notation like [slug] within the app directory to create page components that fetch data and handle specific path segments. You can also use catch-all and optional catch-all segments for more complex routing hierarchies.

What is the purpose of loading.tsx and error.tsx files in Next.js?

In Next.js, loading.tsx creates loading states for immediate UI feedback during route rendering, while error.tsx establishes error boundaries to catch and handle unexpected runtime errors gracefully within specific route segments.

Do I need a root layout for my Next.js app directory?

Yes, a root layout is required for your Next.js app directory. It must be defined in the top-level layout file and include the required html and body tags to ensure proper rendering and structure for all nested route layouts.

What are parallel and intercepting routes in Next.js and when should I use them?

Parallel routes in Next.js allow you to render multiple pages simultaneously within a single layout using slots, while intercepting routes load routes within the current layout context, commonly used for modals while preserving the background layout state.

How do I handle not-found pages with Next.js App Router?

To handle not-found pages in the Next.js App Router, you add a not-found.tsx file to your route segment. This file renders a custom UI when the notFound function is called or when a requested route segment cannot be matched.

Can I use route groups and private folders to organize Next.js routing?

Yes, you can use route groups denoted by parentheses to organize routes without affecting the URL path, and private folders prefixed with an underscore to collocate internal files safely outside of the Next.js routing hierarchy.