Communitygithub.com

ComeOnOliver/skillshub

由 Vercel 工程團隊提供的 React 與 Next.js 效能優化指南。適用於撰寫、審查或重構 React/Next.js 程式碼時,確保遵循最佳效能模式。觸發於涉及 React 元件、Next.js 頁面、資料擷取、套件最佳化或效能改善的任務。

skillshub 是什麼?

此技能為 Vercel 維護的 React 與 Next.js 應用程式全面效能最佳化指南。它包含按影響程度優先排序的 8 大類別共 45 條規則,涵蓋消除請求瀑布、套件大小最佳化、伺服器端與用戶端效能、重新渲染最佳化、渲染效能、JavaScript 效能以及進階模式等關鍵領域。開發者可在撰寫新元件、實作資料擷取、檢視程式碼或重構現有邏輯時參考此指南。每個規則都包含簡要說明、錯誤與正確的程式碼範例,並支援透過規則檔案進行詳細查閱。此技能適用於各種執行 React/Next.js 開發與程式碼審查的 AI 代理平台,協助自動產生高效能程式碼。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/jarrodwatts/claude-code-config/vercel-react-best-practices

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Vercel React 最佳實務

由 Vercel 維護的 React 與 Next.js 應用程式全面效能最佳化指南。包含依影響程度優先排序的 8 大類別共 45 條規則,可引導自動重構與程式碼產生。

何時套用

請在以下情況參考這些準則:

  • 撰寫新的 React 元件或 Next.js 頁面
  • 實作資料擷取(用戶端或伺服器端)
  • 檢視程式碼以找出效能問題
  • 重構現有的 React/Next.js 程式碼
  • 最佳化套件大小或載入時間

依優先順序排列的規則類別

優先順序類別影響程度前綴
1消除請求瀑布關鍵async-
2套件大小最佳化關鍵bundle-
3伺服器端效能高server-
4用戶端資料擷取中高client-
5重新渲染最佳化中rerender-
6渲染效能中rendering-
7JavaScript 效能低中js-
8進階模式低advanced-

快速參考

1. 消除請求瀑布(關鍵)

  • async-defer-await - 將 await 移至實際使用的分支中
  • async-parallel - 針對獨立操作使用 Promise.all()
  • async-dependencies - 對於部分相依性使用 better-all
  • async-api-routes - 在 API 路由中儘早啟動 Promise,後續再 await
  • async-suspense-boundaries - 使用 Suspense 來串流內容

2. 套件大小最佳化(關鍵)

  • bundle-barrel-imports - 直接匯入,避免使用 barrel 檔案
  • bundle-dynamic-imports - 針對大型元件使用 next/dynamic
  • bundle-defer-third-party - 在 hydration 之後載入分析/日誌功能
  • bundle-conditional - 僅在功能啟用時載入模組
  • bundle-preload - 在滑鼠懸停/聚焦時預載以提升感知速度

3. 伺服器端效能(高)

  • server-cache-react - 使用 React.cache() 進行每個請求的去重
  • server-cache-lru - 使用 LRU 快取進行跨請求解讀取
  • server-serialization - 最小化傳遞給用戶端元件的資料量
  • server-parallel-fetching - 重構元件以平行化擷取操作
  • server-after-nonblocking - 使用 after() 執行非封鎖操作

4. 用戶端資料擷取(中高)

  • client-swr-dedup - 使用 SWR 自動進行請求去重
  • client-event-listeners - 對全域事件監聽器進行去重

5. 重新渲染最佳化(中)

  • rerender-defer-reads - 不要訂閱僅在回呼中使用的狀態
  • rerender-memo - 將昂貴的工作提取到已 memo 化的元件中
  • rerender-dependencies - 在 effect 中使用基本型別相依性
  • rerender-derived-state - 訂閱衍生的布林值,而非原始值
  • rerender-functional-setstate - 使用 functional setState 以獲得穩定的回呼
  • rerender-lazy-state-init - 對昂貴的值傳遞函式給 useState
  • rerender-transitions - 使用 startTransition 處理非緊急更新

6. 渲染效能(中)

  • rendering-animate-svg-wrapper - 對 div 包裝器進行動畫,而非 SVG 元素本身
  • rendering-content-visibility - 對長列表使用 content-visibility
  • rendering-hoist-jsx - 將靜態 JSX 提取到元件外部
  • rendering-svg-precision - 降低 SVG 座標精度
  • rendering-hydration-no-flicker - 使用內嵌腳本來處理僅限用戶端的資料
  • rendering-activity - 使用 Activity 元件來控制顯示/隱藏
  • rendering-conditional-render - 使用三元運算子而非 && 進行條件渲染

7. JavaScript 效能(低中)

  • js-batch-dom-css - 透過類別或 cssText 批次處理 CSS 變更
  • js-index-maps - 建立 Map 以進行重複查詢
  • js-cache-property-access - 在迴圈中快取物件屬性
  • js-cache-function-results - 在模組層級的 Map 中快取函式結果
  • js-cache-storage - 快取 localStorage/sessionStorage 讀取
  • js-combine-iterations - 將多次的 filter/map 合併為一個迴圈
  • js-length-check-first - 在進行昂貴的比較前先檢查陣列長度
  • js-early-exit - 在函式中及早返回
  • js-hoist-regexp - 將正則表達式的建立提升到迴圈外部
  • js-min-max-loop - 使用迴圈尋找最小值/最大值,而非排序
  • js-set-map-lookups - 使用 Set/Map 以達到 O(1) 查詢
  • js-tosorted-immutable - 使用 toSorted() 以維持不可變性

8. 進階模式(低)

  • advanced-event-handler-refs - 將事件處理器儲存在 ref 中
  • advanced-use-latest - 使用 useLatest 來獲得穩定的回呼 ref

如何使用

閱讀個別規則檔案以取得詳細說明和程式碼範例:

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

每個規則檔案包含:

  • 為何重要的簡要說明
  • 附說明的錯誤程式碼範例
  • 附說明的正確程式碼範例
  • 其他背景資訊與參考資料

完整彙編文件

如需包含所有規則展開說明的完整指南,請參閱:AGENTS.md

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相關技能