Our review
Prevents async waterfalls, reduces bundle size, secures Server Actions, and ensures correct production builds in Next.js applications.
Strengths
- Promotes best practices for data fetching with Promise.all
- Reduces bundle size by avoiding barrel imports and using dynamic imports
- Ensures security by checking authentication inside Server Actions
Limitations
- Focuses on specific Next.js patterns and may not cover all performance issues
- Requires familiarity with Next.js concepts like Server Actions and dynamic imports
Use when writing React components, data fetching, Server Actions, or optimizing bundle size in a Next.js project.
Not suitable for non-Next.js projects or when simple static pages without server-side logic.
Security analysis
SafeThe skill provides performance and security best practices for Next.js development without executing any commands, accessing external resources, or disabling safety features. It instructs on code patterns, not on system-modifying actions.
No concerns found
Examples
Help me optimize data fetching in my Next.js app to avoid waterfall requests.How can I reduce bundle size in Next.js by avoiding barrel imports?Show me how to properly secure Server Actions in Next.js.name: nextjs-performance description: | Next.js critical performance fixes. Prevents async waterfalls, reduces bundle size, secures Server Actions, and ensures correct production builds. Use when writing React components, data fetching, Server Actions, or optimizing bundle size.
Next.js Performance
Before Writing Code
- Read
docs/agent/architecture/nextjs-critical-fixes.mdfor full patterns - Check existing components in
apps/frontend/components/
Critical Rules
Waterfalls
- Use
Promise.all()for independent fetches - Wrap slow data in
<Suspense>boundaries - Defer
awaitinto branches where needed
// WRONG
const resumes = await fetchResumes();
const jobs = await fetchJobs();
// RIGHT
const [resumes, jobs] = await Promise.all([fetchResumes(), fetchJobs()]);
Bundle Size
- NO barrel imports:
import X from 'lucide-react'is WRONG - YES direct imports:
import X from 'lucide-react/dist/esm/icons/x' - Use
next/dynamicfor heavy components (editors, charts, PDF) - Defer analytics with
ssr: false
import dynamic from 'next/dynamic';
const HeavyEditor = dynamic(() => import('./HeavyEditor'), { ssr: false });
Server Actions
- ALWAYS check auth INSIDE the action, not just middleware
- Verify resource ownership before mutations
Production Build
- Run
npm run build && npm run start, NOTnpm run dev - Docker must use standalone output
Pre-PR Checklist
[ ] No sequential awaits for independent data
[ ] Icons imported directly (not barrel)
[ ] Heavy components use next/dynamic
[ ] Server Actions have auth inside
[ ] Suspense around slow fetches
Next.js App Router Expert
Development
A skill that turns Claude into a Next.js App Router expert.
README Generator
Development
Creates professional and comprehensive README.md files for your projects.
API Documentation Writer
Development
Generates comprehensive API documentation in OpenAPI/Swagger format.