Official程式設計與開發github.com

vercel-react-native-skills

React Native 與 Expo 的最佳實踐,協助打造高效能行動應用。

vercel-react-native-skills 是什麼?

這個技能提供了一組完整的 React Native 與 Expo 開發最佳實踐規則,涵蓋從列表效能、動畫、導航到 UI 模式等八大優先級類別。它專為在 Vercel、Cursor、Codex 等 AI 輔助開發環境中使用而設計,可作為開發者的即時參考指南。每個類別都包含具體的規則名稱與簡要說明,例如使用 FlashList 優化大型列表、使用 expo-image 處理圖片、使用原生導航器而非 JS 實作等。此外,它也提供了深入的規則文件(位於 rules/ 資料夾)與一份完整彙編文件(AGENTS.md),方便開發者進一步查看程式碼範例與解釋。此技能對於正在建構高效能、跨平台行動應用,並遵循社群公認最佳實務的團隊特別有幫助。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/vercel-labs/agent-skills/tree/main/skills/react-native-skills

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

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

說明文件

React Native 技能

React Native 和 Expo 應用程式的全面最佳實務。包含涵蓋效能、動畫、UI 模式以及平台特定最佳化的多個類別規則。

適用時機

在以下情況參考這些指南:

  • 建構 React Native 或 Expo 應用程式
  • 最佳化列表和滾動效能
  • 使用 Reanimated 實作動畫
  • 處理圖片和多媒體
  • 設定原生模組或字型
  • 使用原生相依性結構化 monorepo 專案

依優先級分類的規則

優先級類別影響程度前綴
1列表效能嚴重list-performance-
2動畫高animation-
3導航高navigation-
4UI 模式高ui-
5狀態管理中react-state-
6渲染中rendering-
7Monorepo中monorepo-
8設定低fonts-, imports-

快速參考

1. 列表效能 (嚴重)

  • list-performance-virtualize - 對大型列表使用 FlashList
  • list-performance-item-memo - 記憶列表項目元件
  • list-performance-callbacks - 穩定回呼參考
  • list-performance-inline-objects - 避免內聯樣式物件
  • list-performance-function-references - 將函式提取到渲染外部
  • list-performance-images - 最佳化列表中的圖片
  • list-performance-item-expensive - 將昂貴運算移到項目外部
  • list-performance-item-types - 對異質列表使用項目類型

2. 動畫 (高)

  • animation-gpu-properties - 僅對 transform 和 opacity 執行動畫
  • animation-derived-value - 對計算後的動畫使用 useDerivedValue
  • animation-gesture-detector-press - 使用 Gesture.Tap 代替 Pressable

3. 導航 (高)

  • navigation-native-navigators - 使用原生堆疊和原生標籤頁,而非 JS 導航器

4. UI 模式 (高)

  • ui-expo-image - 所有圖片使用 expo-image
  • ui-image-gallery - 使用 Galeria 實作圖片燈箱
  • ui-pressable - 使用 Pressable 代替 TouchableOpacity
  • ui-safe-area-scroll - 在 ScrollView 中處理安全區域
  • ui-scrollview-content-inset - 對標題使用 contentInset
  • ui-menus - 使用原生上下文選單
  • ui-native-modals - 盡可能使用原生模態
  • ui-measure-views - 使用 onLayout,而非 measure()
  • ui-styling - 使用 StyleSheet.create 或 Nativewind

5. 狀態管理 (中)

  • react-state-minimize - 最小化狀態訂閱
  • react-state-dispatcher - 對回呼使用 dispatcher 模式
  • react-state-fallback - 在首次渲染時顯示備用內容
  • react-compiler-destructure-functions - 為 React Compiler 解構
  • react-compiler-reanimated-shared-values - 使用編譯器處理 shared values

6. 渲染 (中)

  • rendering-text-in-text-component - 將文字包裹在 Text 元件中
  • rendering-no-falsy-and - 避免使用 falsy && 進行條件渲染

7. Monorepo (中)

  • monorepo-native-deps-in-app - 將原生相依性保留在應用程式套件中
  • monorepo-single-dependency-versions - 在套件間使用單一版本

8. 設定 (低)

  • fonts-config-plugin - 使用設定外掛程式處理自訂字型
  • imports-design-system-folder - 組織設計系統匯入
  • js-hoist-intl - 提升 Intl 物件的建立

如何使用

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

rules/list-performance-virtualize.md
rules/animation-gpu-properties.md

每個規則檔案包含:

  • 為何重要的簡要說明
  • 錯誤的程式碼範例與解釋
  • 正確的程式碼範例與解釋
  • 其他上下文和參考資料

完整彙編文件

如需包含所有展開規則的完整指南:AGENTS.md

Individual skills in this repo

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

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

vercel-cli-with-tokens

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g.

vercel-composition-patterns

React composition patterns that scale. Use when refactoring components with

vercel-labs/vercel-composition-patterns

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

vercel-labs/vercel-react-best-practices

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-labs/vercel-react-native-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

vercel-labs/vercel-react-view-transitions

Guide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components, animate list reorder, implement directional (forward/back) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.

vercel-optimize

Use for Vercel cost and performance optimization on deployed projects, especially Next.js, SvelteKit, Nuxt, and limited Astro apps. Collect Vercel metrics, usage, project config, and code scan results first; investigate only metric-backed candidates; produce ranked recommendations grounded in verified files and version-aware Vercel/framework docs. Trigger for Vercel bill reduction, slow or expensive routes, caching opportunities, Function Invocations, Build Minutes, Fast Data Transfer, Core Web Vitals, Bot Management, Fluid compute, or cost breakdown requests.

vercel-react-best-practices

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.

web-design-guidelines

Review UI code for Web Interface Guidelines compliance. Use when asked to

writing-guidelines

Review docs/prose for Writing Guidelines compliance. Use when asked to

相關技能