nextjs-react-expert
它能做什么
这项技能为你的 AI 提供一套适用于 React 和 Next.js 应用的性能规则。适合页面加载缓慢或反应迟钝的开发者。
适用场景
- ✓当 React 或 Next.js 页面加载缓慢,或很久才能变得可交互的时候。
- ✓当你想减小发送到浏览器的 JavaScript 体积的时候。
- ✓当你想检查某个 React 组件的性能问题的时候。
技能链接
https://github.com/vudovn/ag-kit/blob/main/.agents/skills/nextjs-react-expert/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的 Next.js 页面加载很慢。请帮我检查,并优先修复影响最大的性能问题。”
每周 5 个新技能,1 分钟读完。
工作原理
技能按影响程度排列规则,把最重要的规则放在前面,例如消除加载瀑布。AI 只阅读相关部分,并应用修复。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Next.js & React Performance Expert
From Vercel Engineering - 58 optimization rules prioritized by impact, plus Next.js 16 Cache Components 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 | 6 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 |
9-cache-components.md |
🔴 CRITICAL | 4 sections | Next.js 16+ Only: use cache, cacheLife, PPR, cacheTag |
Total: 58 rules across 8 categories, plus Section 9 (Cache Components) for Next.js 16+
🚀 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
🚀 **Next.js 16+ Performance (Caching & PPR)**
→ Read Section 9: Cache Components
📊 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
🔥 **MODERN (Next.js 16+):**
└─ Section 9: Cache Components (Replaces most traditional revalidation)
🔗 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] |
| D |
常见问题
它应该先修复哪些问题?
技能说明应从关键项目开始,例如加载瀑布和过大的代码包。
它涵盖服务器端的速度吗?
涵盖。它包含一节关于服务器端性能的内容。
它只适用于 Next.js 吗?
不是。它也涵盖 React 性能,并额外加入 Next.js 专属规则。
详情
作者的原始描述
React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.
repo: vudovn/ag-kit
热度
- GitHub 星标
- 8.2k
- 排名
- #12537
- 许可证
- MIT
- 更新时间
- 2026/10/18
评论
- …