From harness-claude
Structures Next.js 13+ applications using App Router file-system conventions for layouts, nested routes, route groups, dynamic segments, loading, error, and not-found states.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Structure Next.js 13+ applications using the App Router's file-system conventions for layouts, nested routes, and route segments
Guides Next.js App Router setup with app directory conventions, layouts/templates, loading/error boundaries, route groups, parallel routes, metadata/SEO, server/client components, navigation, and async params.
Guides Next.js App Router usage: file conventions for pages/layouts/loading/error states, dynamic/catch-all routes, route groups, and nested layouts.
Implements Next.js App Router with file-system routing, root/nested layouts, templates, loading/error/not-found states, dynamic routes, and generateStaticParams for modern Next.js 13+ apps.
Share bugs, ideas, or general feedback.
Structure Next.js 13+ applications using the App Router's file-system conventions for layouts, nested routes, and route segments
app/ directory conventions (layout.tsx, page.tsx, loading.tsx, error.tsx)app/. Each folder becomes a route segment; page.tsx makes it publicly accessible.layout.tsx to wrap route segments in shared UI — layouts persist across navigations and do not re-render.(groupName)/ to organize routes without affecting the URL path.[slug] for dynamic segments and [...catchAll] for catch-all segments. Access params via the params prop in page.tsx and layout.tsx.loading.tsx alongside page.tsx to stream a Suspense fallback during data fetching.error.tsx as a Client Component to catch runtime errors within the segment.not-found.tsx to render 404 UI and call notFound() from next/navigation to trigger it.template.tsx instead of layout.tsx when you need fresh state on every navigation (e.g., page-transition animations).layout.tsx Server Components by default; only add 'use client' if the layout needs interactivity.// app/dashboard/layout.tsx — shared layout for all /dashboard/* routes
export default function DashboardLayout({ children }: { children: React.ReactNode }) {
return (
<div className="flex">
<DashboardNav />
<main className="flex-1">{children}</main>
</div>
);
}
// app/dashboard/[teamId]/page.tsx — dynamic route segment
export default function TeamPage({ params }: { params: { teamId: string } }) {
return <h1>Team {params.teamId}</h1>;
}
The App Router replaces the Pages Router's getServerSideProps / getStaticProps model with React Server Components and async components. Every file in app/ is a Server Component by default.
File conventions: page.tsx (route UI), layout.tsx (shared wrapper), loading.tsx (Suspense fallback), error.tsx (error boundary), not-found.tsx (404), route.ts (API endpoint), template.tsx (per-navigation layout), default.tsx (parallel route fallback).
Route groups (groupName)/ exist only in the filesystem — they do not appear in the URL. Use them to co-locate files without coupling the URL structure.
Trade-offs:
searchParams prop in page.tsx insteadlayout.tsx is not re-mounted on navigation within its segment, so component state persists; use template.tsx if fresh state is neededMigration from Pages Router: Pages under pages/ continue to work alongside app/ — the two routers coexist during migration. Remove a page from pages/ only after its app/ equivalent is tested.
https://nextjs.org/docs/app/building-your-application/routing