nextjs-performance-architect

Audits and optimizes Next.js App Router applications for caching, rendering, bundles, and Core Web Vitals.

1|Updated May 4, 2026
One-click install
npx skills add https://github.com/Scardubu/SwarmXQ --skill nextjs-performance-architect-scardubu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-performance-architect
Source: https://github.com/Scardubu/SwarmXQ/tree/main/.ai/skills/nextjs-performance-architect
Command: npx skills add https://github.com/Scardubu/SwarmXQ --skill nextjs-performance-architect-scardubu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Next.js App Router performance issues are hard to diagnose because caching semantics, RSC boundaries, and rendering modes interact in counterintuitive ways. This Skill provides a structured audit protocol that pinpoints slow LCP, bloated bundles, misconfigured caches, and incorrect RSC vs client component placement, then produces concrete fixes. ## Core Features & Use Cases - Four-Layer Cache Audit: Analyzes Request Memoization, Data Cache, Full Route Cache, and Router Cache, then generates correct fetch configurations with revalidate, tags, and on-demand invalidation. - RSC Architecture Review: Detects anti-patterns like 'use client' at layout roots, sequential await waterfalls, and client-side fetching, and rewrites them into parallel server-component patterns. - PPR, Turbopack & Bundle Analysis: Configures Partial Prerendering with Suspense boundaries, migrates builds to Turbopack, and interprets @next/bundle-analyzer output to shrink client JavaScript. - Core Web Vitals Fixes: Provides targeted code for LCP (priority images, next/font), CLS (explicit dimensions, reserved space), and INP (startTransition, debouncing). - Use Case: A developer says "my Next.js dashboard is slow." The Skill audits the page, finds a 'use client' root and sequential fetches, converts it to an RSC with Promise.all and ISR caching, and wraps dynamic content in Suspense for PPR. ## Quick Start Ask the assistant to audit your Next.js app for performance problems and share the page or component code you want optimized.

Frequently Asked Questions about nextjs-performance-architect

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

FAQPage Schema
How do I fix a slow Next.js App Router page?

Start by identifying whether the issue is slow LCP, large bundle, slow API response, or stale data. Then audit for anti-patterns like 'use client' at the layout root, sequential await fetches, and missing cache directives, and apply parallel fetching with explicit revalidate settings.

When should I use RSC vs 'use client' in Next.js?

Use Server Components by default for anything non-interactive, and add 'use client' only on leaf components that need useState, useEffect, event handlers, or browser APIs. Placing 'use client' on a layout or page root strips RSC benefits from the entire subtree.

How does caching work in Next.js 15 App Router?

Next.js has four cache layers: Request Memoization, Data Cache, Full Route Cache, and Router Cache. Since Next.js 15, fetch defaults to no-store, so you must explicitly set cache: 'force-cache' or next: { revalidate: N } to get caching behavior.

Does Next.js Partial Prerendering work with dynamic data?

Yes, PPR renders a static shell at build time and streams dynamic content through Suspense boundaries per request. All dynamic content must be wrapped in Suspense, and static sections must not call cookies(), headers(), or Math.random().

Why is my Next.js bundle size so large?

Common causes are client components importing heavy libraries, barrel imports like import * from a package, and date or icon libraries bundled entirely. Run ANALYZE=true with @next/bundle-analyzer, use named imports, and move non-interactive logic to Server Components.

How do I improve Core Web Vitals in Next.js?

For LCP, mark hero images with priority and use next/font with display swap. For CLS, always set explicit width and height on images and reserve space for dynamic content. For INP, wrap expensive state updates in startTransition and debounce frequent updates.