Token导航 LogoToken导航TokenDH.com
开发规范需要联网github未标认证来源可访问许可证需确认审计通过

react-best-practicesReact 最佳实践

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

1,606

周安装

69

GitHub Stars

7,169

下载量

563
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:react-best-practices(React 最佳实践)
来源仓库:https://github.com/vudovn/antigravity-kit
仓库路径:skills/react-best-practices
安装命令:
npx skills add https://github.com/vudovn/antigravity-kit --skill react-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/vudovn/antigravity-kit --skill react-best-practices

简介

用于辅助前端页面、组件、样式和交互逻辑开发。

  • 适合生成或审查 React、Next.js、Vue、Tailwind、CSS 等代码。
  • 结合项目设计系统和路由方式使用,避免孤立片段。
  • 页面改动后应通过预览和构建检查确认效果。
  • react-best-practices 属于开发规范类 Skill,可作为该场景下的辅助能力补充。

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

FileImpactRulesWhen to Read
1-async-eliminating-waterfalls.md🔴 CRITICAL5 rulesSlow page loads, sequential API calls, data fetching waterfalls
2-bundle-bundle-size-optimization.md🔴 CRITICAL5 rulesLarge bundle size, slow Time to Interactive, First Load issues
3-server-server-side-performance.md🟠 HIGH7 rulesSlow SSR, API route optimization, server-side waterfalls
4-client-client-side-data-fetching.md🟡 MEDIUM-HIGH4 rulesClient data management, SWR patterns, deduplication
5-rerender-re-render-optimization.md🟡 MEDIUM12 rulesExcessive re-renders, React performance, memoization
6-rendering-rendering-performance.md🟡 MEDIUM9 rulesRendering bottlenecks, virtualization, image optimization
7-js-javascript-performance.mdLOW-MEDIUM12 rulesMicro-optimizations, caching, loop performance
8-advanced-advanced-patterns.md🔵 VARIABLE3 rulesAdvanced React patterns, useLatest, init-once
9-cache-components.md🔴 CRITICAL4 sectionsNext.js 16+ Only: use cache, cacheLife, PPR, cacheTag

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

🚀 **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

NeedSkill
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 await for independent operations
  • ❌ Import entire libraries when you need one function
  • ❌ Use barrel exports (index.ts re-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

For New Features:

  1. Check Section 1 & 2 while building (prevent waterfalls, keep bundle small)
  2. Use server components by default (Section 3)
  3. Apply memoization for expensive operations (Section 5)

For Performance Reviews:

  1. Start with Section 1 (waterfalls = biggest impact)
  2. Then Section 2 (bundle size)
  3. Then Section 3 (server-side)
  4. Finally other sections as needed

For Debugging Slow Performance:

  1. Identify the symptom (slow load, lag, etc.)
  2. Use Quick Decision Tree above
  3. Read relevant section
  4. Apply fixes in priority order

📚 Learning Path

Beginner (Focus on Critical): → Section 1: Eliminating Waterfalls → Section 2: Bundle Size Optimization

Intermediate (Add High Priority): → Section 3: Server-Side Performance → Section 5: Re-render Optimization

Advanced (Full Optimization): → All sections + Section 8: Advanced Patterns


🔍 Validation Script

ScriptPurposeCommand
scripts/react_performance_checker.pyAutomated performance auditpython scripts/react_performance_checker.py <project_path>

📖 Section Details

Section 1: Eliminating Waterfalls (CRITICAL)

Impact: Each waterfall adds 100-500ms+ latency Key Concepts: Parallel fetching, Promise.all(), Suspense boundaries, preloading

Section 2: Bundle Size Optimization (CRITICAL)

Impact: Directly affects Time to Interactive, Largest Contentful Paint Key Concepts: Dynamic imports, tree-shaking, barrel import avoidance

Section 3: Server-Side Performance (HIGH)

Impact: Faster server responses, better SEO Key Concepts: Parallel server fetching, streaming, API route optimization

Section 4: Client-Side Data Fetching (MEDIUM-HIGH)

Impact: Reduces redundant requests, better UX Key Concepts: SWR deduplication, localStorage caching, event listeners

Section 5: Re-render Optimization (MEDIUM)

Impact: Smoother UI, less wasted computation Key Concepts: React.memo, useMemo, useCallback, component structure

Section 6: Rendering Performance (MEDIUM)

Impact: Better rendering efficiency Key Concepts: Virtualization, image optimization, layout thrashing

Section 7: JavaScript Performance (LOW-MEDIUM)

Impact: Incremental improvements in hot paths Key Concepts: Loop optimization, caching, RegExp hoisting

Section 8: Advanced Patterns (VARIABLE)

Impact: Specific use cases Key Concepts: useLatest hook, init-once patterns, event handler refs


🎓 Best Practices Summary

Golden Rules:

  1. Measure first - Use React DevTools Profiler, Chrome DevTools
  2. Biggest impact first - Waterfalls → Bundle → Server → Micro
  3. Don't over-optimize - Focus on real bottlenecks
  4. Use platform features - Next.js has optimizations built-in
  5. Think about users - Real-world conditions matter

Performance Mindset:

  • Every await in sequence = potential waterfall
  • Every import = potential bundle bloat
  • Every re-render = wasted computation (if unnecessary)
  • Server components = less JavaScript to ship
  • Measure, don't guess

Source: Vercel Engineering Date: January 2026 Version: 1.0.0 Total Rules: 57 across 8 categories

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.28%
按下载量换算182

Claude

31.08%
按下载量换算175

Cursor

17.4%
按下载量换算98

Gemini CLI

9.71%
按下载量换算55

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills