nextjs-react-expert
Originally fromvudovn/antigravity-kit
SKILL.md
Next.js & React Performance Expert
From Vercel Engineering - 57 optimization rules prioritized by impact Philosophy: Eliminate waterfalls first, optimize bundles second, then micro-optimize.
π― Selective Reading Rule (MANDATORY)
Read ONLY sections relevant to your task! Check the content map below and load what you need.
π΄ For performance reviews: Start with CRITICAL sections (1-2), then move to HIGH/MEDIUM.
π Content Map
| File | Impact | Rules | When to Read |
|---|---|---|---|
1-async-eliminating-waterfalls.md |
π΄ CRITICAL | 5 rules | Slow page loads, sequential API calls, data fetching waterfalls |
2-bundle-bundle-size-optimization.md |
π΄ CRITICAL | 5 rules | Large bundle size, slow Time to Interactive, First Load issues |
3-server-server-side-performance.md |
π HIGH | 7 rules | Slow SSR, API route optimization, server-side waterfalls |
4-client-client-side-data-fetching.md |
π‘ MEDIUM-HIGH | 4 rules | Client data management, SWR patterns, deduplication |
5-rerender-re-render-optimization.md |
π‘ MEDIUM | 12 rules | Excessive re-renders, React performance, memoization |
6-rendering-rendering-performance.md |
π‘ MEDIUM | 9 rules | Rendering bottlenecks, virtualization, image optimization |
7-js-javascript-performance.md |
βͺ LOW-MEDIUM | 12 rules | Micro-optimizations, caching, loop performance |
8-advanced-advanced-patterns.md |
π΅ VARIABLE | 3 rules | Advanced React patterns, useLatest, init-once |
Total: 57 rules across 8 categories
π Quick Decision Tree
What's your performance issue?
π Slow page loads / Long Time to Interactive
β Read Section 1: Eliminating Waterfalls
β Read Section 2: Bundle Size Optimization
π¦ Large bundle size (> 200KB)
β Read Section 2: Bundle Size Optimization
β Check: Dynamic imports, barrel imports, tree-shaking
π₯οΈ Slow Server-Side Rendering
β Read Section 3: Server-Side Performance
β Check: Parallel data fetching, streaming
π Too many re-renders / UI lag
β Read Section 5: Re-render Optimization
β Check: React.memo, useMemo, useCallback
π¨ Rendering performance issues
β Read Section 6: Rendering Performance
β Check: Virtualization, layout thrashing
π Client-side data fetching problems
β Read Section 4: Client-Side Data Fetching
β Check: SWR deduplication, localStorage
β¨ Need advanced patterns
β Read Section 8: Advanced Patterns
π Impact Priority Guide
Use this order when doing comprehensive optimization:
1οΈβ£ CRITICAL (Biggest Gains - Do First):
ββ Section 1: Eliminating Waterfalls
β ββ Each waterfall adds full network latency (100-500ms+)
ββ Section 2: Bundle Size Optimization
ββ Affects Time to Interactive and Largest Contentful Paint
2οΈβ£ HIGH (Significant Impact - Do Second):
ββ Section 3: Server-Side Performance
ββ Eliminates server-side waterfalls, faster response times
3οΈβ£ MEDIUM (Moderate Gains - Do Third):
ββ Section 4: Client-Side Data Fetching
ββ Section 5: Re-render Optimization
ββ Section 6: Rendering Performance
4οΈβ£ LOW (Polish - Do Last):
ββ Section 7: JavaScript Performance
ββ Section 8: Advanced Patterns
π Related Skills
| Need | Skill |
|---|---|
| API design patterns | @[skills/api-patterns] |
| Database optimization | @[skills/database-design] |
| Testing strategies | @[skills/testing-patterns] |
| UI/UX design principles | @[skills/frontend-design] |
| TypeScript patterns | @[skills/typescript-expert] |
| Deployment & DevOps | @[skills/deployment-procedures] |
β Performance Review Checklist
Before shipping to production:
Critical (Must Fix):
- No sequential data fetching (waterfalls eliminated)
- Bundle size < 200KB for main bundle
- No barrel imports in app code
- Dynamic imports used for large components
- Parallel data fetching where possible
High Priority:
- Server components used where appropriate
- API routes optimized (no N+1 queries)
- Suspense boundaries for data fetching
- Static generation used where possible
Medium Priority:
- Expensive computations memoized
- List rendering virtualized (if > 100 items)
- Images optimized with next/image
- No unnecessary re-renders
Low Priority (Polish):
- Hot path loops optimized
- RegExp patterns hoisted
- Property access cached in loops
β Anti-Patterns (Common Mistakes)
DON'T:
- β Use sequential
awaitfor independent operations - β Import entire libraries when you need one function
- β Use barrel exports (
index.tsre-exports) in app code - β Skip dynamic imports for large components/libraries
- β Fetch data in useEffect without deduplication
- β Forget to memoize expensive computations
- β Use client components when server components work
DO:
- β
Fetch data in parallel with
Promise.all() - β
Use dynamic imports:
const Comp = dynamic(() => import('./Heavy')) - β
Import directly:
import { specific } from 'library/specific' - β Use Suspense boundaries for better UX
- β Leverage React Server Components
- β Measure performance before optimizing
- β Use Next.js built-in optimizations (next/image, next/font)
π― How to Use This Skill
π§ Knowledge Modules (Fractal Skills)
1. For New Features:
2. For Performance Reviews:
3. For Debugging Slow Performance:
4. Section 1: Eliminating Waterfalls (CRITICAL)
5. Section 2: Bundle Size Optimization (CRITICAL)
6. Section 3: Server-Side Performance (HIGH)
7. Section 4: Client-Side Data Fetching (MEDIUM-HIGH)
8. Section 5: Re-render Optimization (MEDIUM)
9. Section 6: Rendering Performance (MEDIUM)
10. Section 7: JavaScript Performance (LOW-MEDIUM)
11. Section 8: Advanced Patterns (VARIABLE)
Weekly Installs
4
Repository
dokhacgiakhoa/aβ¦vity-ideGitHub Stars
383
First Seen
Feb 10, 2026
Security Audits
Installed on
amp4
gemini-cli4
antigravity4
github-copilot4
codex4
kimi-cli4