askill
nextjs-performance

nextjs-performanceSafety 95Repository

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.

26k stars
519.2k downloads
Updated 2/13/2026

Package Files

Loading files...
SKILL.md

Next.js Performance

Before Writing Code

  1. Read docs/agent/architecture/nextjs-critical-fixes.md for full patterns
  2. Check existing components in apps/frontend/components/

Critical Rules

Waterfalls

  • Use Promise.all() for independent fetches
  • Wrap slow data in <Suspense> boundaries
  • Defer await into 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/dynamic for 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, NOT npm 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

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

78/100Analyzed 2/20/2026

High-quality Next.js performance skill with clear WRONG/RIGHT code examples, structured rules, and a useful checklist. Covers waterfalls, bundle optimization, Server Action security, and production builds well. Deducted points for internal path references that reduce reusability, and missing some advanced topics like caching. The when-to-use trigger and tags improve discoverability. Suitable for Next.js projects but could be more standalone."

95
90
65
75
85

Metadata

Licenseunknown
Version-
Updated2/13/2026
Publishersrbhr

Tags

ci-cdsecurity