跳到正文
cccskills
免费在 GitHub 公开中文介绍

vercel-react-best-practices

用于编写、审查和重构React及Next.js代码,按优先级检查数据获取等待、浏览器下载的代码体积和不必要的重新渲染,逐步改善性能。

原文查看原文说明

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

集成工具Vercel

实测评分 未实测

查看安装方法

适用场景

  • 检查React代码的性能问题
  • 减少数据获取的等待时间
  • 缩小发送到浏览器的JavaScript体积
  • 减少不必要的重新渲染

中文介绍

功能

这项技能为编写、审查和重构React及Next.js代码提供性能方面的指导。它将45条规则分为8个领域,并按照影响程度安排改进顺序。重点是消除依次等待数据请求的情况,以及缩小发送到浏览器的代码体积;同时检查服务器处理、不必要的重新渲染和JavaScript的处理方式。

适用场景

适合编写新组件或页面,也适合检查加载缓慢的现有界面。每条规则都有单独的文件,说明规则背后的原因,并提供正确与错误的代码示例,便于结合具体代码判断修改方向。

使用示例

  • “找出这个Next.js页面中可以并行执行的数据获取操作。”
  • “检查大型组件的加载方式,以及不必要的重新渲染。”

注意事项

这些指导面向React及Next.js应用。部分规则包含使用SWR和next/dynamic等工具的示例,因此需要根据目标代码选择适用的方法。许可证为MIT。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
A良好内容为代码改进指导,没有对外发送或删除的执行步骤。
安装难易度所需工具和 API 密钥是否少且有说明
A良好这是React和Next.js的参考资料,未指定需要API密钥或付费服务。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月23日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(47)

  • SKILL.md5.2 KB
  • AGENTS.md59.1 KB
  • rules/advanced-event-handler-refs.md1.4 KB
  • rules/advanced-use-latest.md1.2 KB
  • rules/async-api-routes.md1.1 KB
  • rules/async-defer-await.md2.0 KB
  • rules/async-dependencies.md942 B
  • rules/async-parallel.md654 B
  • rules/async-suspense-boundaries.md2.5 KB
  • rules/bundle-barrel-imports.md2.3 KB
  • rules/bundle-conditional.md866 B
  • rules/bundle-defer-third-party.md920 B
  • rules/bundle-dynamic-imports.md791 B
  • rules/bundle-preload.md1.1 KB
  • rules/client-event-listeners.md1.9 KB
  • rules/client-swr-dedup.md1.1 KB
  • rules/js-batch-dom-css.md1.9 KB
  • rules/js-cache-function-results.md1.9 KB
  • rules/js-cache-property-access.md532 B
  • rules/js-cache-storage.md1.6 KB
  • rules/js-combine-iterations.md753 B
  • rules/js-early-exit.md1.1 KB
  • rules/js-hoist-regexp.md1.0 KB
  • rules/js-index-maps.md837 B
  • rules/js-length-check-first.md1.7 KB
  • rules/js-min-max-loop.md2.1 KB
  • rules/js-set-map-lookups.md532 B
  • rules/js-tosorted-immutable.md1.7 KB
  • rules/rendering-activity.md564 B
  • rules/rendering-animate-svg-wrapper.md1.2 KB
  • rules/rendering-conditional-render.md980 B
  • rules/rendering-content-visibility.md815 B
  • rules/rendering-hoist-jsx.md1.0 KB
  • rules/rendering-hydration-no-flicker.md2.3 KB
  • rules/rendering-svg-precision.md588 B
  • rules/rerender-defer-reads.md973 B
  • rules/rerender-dependencies.md824 B
  • rules/rerender-derived-state.md724 B
  • rules/rerender-functional-setstate.md2.9 KB
  • rules/rerender-lazy-state-init.md2.0 KB
  • rules/rerender-memo.md1.1 KB
  • rules/rerender-transitions.md1.0 KB
  • rules/server-after-nonblocking.md2.0 KB
  • rules/server-cache-lru.md1.3 KB
  • rules/server-cache-react.md681 B
  • rules/server-parallel-fetching.md1.5 KB
  • rules/server-serialization.md996 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Vercel React Best Practices

Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Writing new React components or Next.js pages
  • Implementing data fetching (client or server-side)
  • Reviewing code for performance issues
  • Refactoring existing React/Next.js code
  • Optimizing bundle size or load times

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Eliminating WaterfallsCRITICALasync-
2Bundle Size OptimizationCRITICALbundle-
3Server-Side PerformanceHIGHserver-
4Client-Side Data FetchingMEDIUM-HIGHclient-
5Re-render OptimizationMEDIUMrerender-
6Rendering PerformanceMEDIUMrendering-
7JavaScript PerformanceLOW-MEDIUMjs-
8Advanced PatternsLOWadvanced-

Quick Reference

1. Eliminating Waterfalls (CRITICAL)

  • async-defer-await - Move await into branches where actually used
  • async-parallel - Use Promise.all() for independent operations
  • async-dependencies - Use better-all for partial dependencies
  • async-api-routes - Start promises early, await late in API routes
  • async-suspense-boundaries - Use Suspense to stream content

2. Bundle Size Optimization (CRITICAL)

  • bundle-barrel-imports - Import directly, avoid barrel files
  • bundle-dynamic-imports - Use next/dynamic for heavy components
  • bundle-defer-third-party - Load analytics/logging after hydration
  • bundle-conditional - Load modules only when feature is activated
  • bundle-preload - Preload on hover/focus for perceived speed

3. Server-Side Performance (HIGH)

  • server-cache-react - Use React.cache() for per-request deduplication
  • server-cache-lru - Use LRU cache for cross-request caching
  • server-serialization - Minimize data passed to client components
  • server-parallel-fetching - Restructure components to parallelize fetches
  • server-after-nonblocking - Use after() for non-blocking operations

4. Client-Side Data Fetching (MEDIUM-HIGH)

  • client-swr-dedup - Use SWR for automatic request deduplication
  • client-event-listeners - Deduplicate global event listeners

5. Re-render Optimization (MEDIUM)

  • rerender-defer-reads - Don't subscribe to state only used in callbacks
  • rerender-memo - Extract expensive work into memoized components
  • rerender-dependencies - Use primitive dependencies in effects
  • rerender-derived-state - Subscribe to derived booleans, not raw values
  • rerender-functional-setstate - Use functional setState for stable callbacks
  • rerender-lazy-state-init - Pass function to useState for expensive values
  • rerender-transitions - Use startTransition for non-urgent updates

6. Rendering Performance (MEDIUM)

  • rendering-animate-svg-wrapper - Animate div wrapper, not SVG element
  • rendering-content-visibility - Use content-visibility for long lists
  • rendering-hoist-jsx - Extract static JSX outside components
  • rendering-svg-precision - Reduce SVG coordinate precision
  • rendering-hydration-no-flicker - Use inline script for client-only data
  • rendering-activity - Use Activity component for show/hide
  • rendering-conditional-render - Use ternary, not && for conditionals

7. JavaScript Performance (LOW-MEDIUM)

  • js-batch-dom-css - Group CSS changes via classes or cssText
  • js-index-maps - Build Map for repeated lookups
  • js-cache-property-access - Cache object properties in loops
  • js-cache-function-results - Cache function results in module-level Map
  • js-cache-storage - Cache localStorage/sessionStorage reads
  • js-combine-iterations - Combine multiple filter/map into one loop
  • js-length-check-first - Check array length before expensive comparison
  • js-early-exit - Return early from functions
  • js-hoist-regexp - Hoist RegExp creation outside loops
  • js-min-max-loop - Use loop for min/max instead of sort
  • js-set-map-lookups - Use Set/Map for O(1) lookups
  • js-tosorted-immutable - Use toSorted() for immutability

8. Advanced Patterns (LOW)

  • advanced-event-handler-refs - Store event handlers in refs
  • advanced-use-latest - useLatest for stable callback refs

How to Use

Read individual rule files for detailed explanations and code examples:

rules/async-parallel.md
rules/bundle-barrel-imports.md
rules/_sections.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

open-pr

免费有简介

检查代码变更的测试情况及对现有功能的影响,按仓库模板创建PR,并继续处理评审请求、反馈意见和CI检查。

  • 按指定模板创建PR
  • 检查现有功能与新功能的测试
  • 本地验证受限时请求机器人评审
Significant-Gravitas/AutoGPT18.8万2026年10月23日 更新

orchestrate

免费有简介

在独立工作目录中运行多个Claude Code,统一分配开发任务、监控进度、协助恢复停止的会话,并检查PR测试及评审反馈的处理情况。

  • 向多个代理分配开发任务
  • 查看进度及空闲worktree
  • 恢复停止工作的代理
Significant-Gravitas/AutoGPT18.8万2026年10月23日 更新

perf-compare

免费有简介

利用Sentry测量数据比较变更前后或不同环境的速度与失败率,考虑统计波动,判定加速、减速、未检测到变化或数据不足,并输出比较结果。

  • 比较发布前后的性能
  • 验证预览环境与对照环境
  • 检查其他操作是否变慢
Significant-Gravitas/AutoGPT18.8万2026年10月23日 更新

pr-address

免费有简介

收集PR审查意见,推进代码修改、提交、回复及讨论串解决,同时持续检查CI失败、合并冲突和新增评论,跟进直至审查事项处理完成。

  • 修改PR审查指出的问题
  • 回复人工和机器人审查
  • 调查并修复推送后的CI失败
Significant-Gravitas/AutoGPT18.8万2026年10月23日 更新

pr-polish

免费有简介

反复审查和修复PR,检查未解决的讨论、评论回复、自动检查及合并冲突,并等待延迟到达的评论,将PR整理到可以合并的状态。

  • 将PR整理到可合并状态
  • 反复修复直到没有新问题
  • 处理延迟到达的机器人审查
Significant-Gravitas/AutoGPT18.8万2026年10月23日 更新

pr-review

免费有简介

审查拉取请求的目的和代码差异,检查正确性、安全性、设计及测试,避免重复已有评论,并将标注严重程度的问题发布到对应代码行。

  • 合并前审查拉取请求
  • 检查代码变更的安全性
  • 查找边界情况的测试缺口
Significant-Gravitas/AutoGPT18.8万2026年10月23日 更新

查看 Significant-Gravitas 的全部技能

报告此技能的问题