Prevent slow first loads in Next.js apps caused by dynamic root layouts, broad middleware, request-bound locale resolution, and client-side auth gating. Use when reviewing or refactoring App Router layouts, `proxy.ts`, localized routes, private app sections, dashboard-style routes, or deployment TTFB regressions.
Use this skill when a Next.js app has slow first loads, high TTFB, or private routes that feel blocked before useful UI appears.
app/layout.tsx reads headers(), cookies(), or request-derived locale/session state.params.locale.proxy.ts or middleware matches more routes than strictly necessary.app/layout.tsx unless unavoidable.app/[locale]/..., use params.locale as the source of truth.app/[locale]/layout.tsx.generateStaticParams() for known locales when appropriate.proxy.ts or middleware to the smallest possible matcher./ or legacy non-localized entry points.app/(group)/layout.tsx for private sections.ProtectedRoute to block the whole tree.Read references/performance-ttfb-and-routing.md when you need: