Community程式設計與開發github.com

React Native 技能集

React Native 和 Expo 的最佳實踐,用於打造高效能的行動應用程式。在構建 React Native 元件、優化列表效能、實作動畫或處理原生模組時使用。當任務涉及 React Native、Expo、行動效能或原生平台 API 時觸發。

React Native 技能集 是什麼?

這是一個專為 React Native 和 Expo 開發者設計的 AI 代理技能集,提供全面的最佳實踐指南。它涵蓋了從關鍵的列表效能優化(如使用 FlashList 和記憶化列表項目)、高效能動畫技巧(像是僅對 transform 和 opacity 屬性進行動畫處理),到導航、UI 模式、狀態管理、渲染、單體倉庫配置等八大類別。每個類別都有明確的優先級和影響力評估(從 CRITICAL 到 LOW),幫助開發者快速識別和解決最關鍵的效能瓶頸。該技能集支援 Claude Code、Cursor 等主流 AI 編碼代理,透過對應的規則檔案提供詳細的程式碼範例與解釋,適合用於建構高效能、穩健的行動應用。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/callstackincubator/agent-skills/tree/main/plugins/vendored/.agents/skills/vercel-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 實作動畫
  • 處理圖片和多媒體
  • 設定原生模組或字型
  • 使用原生依賴項結構化單體倉庫專案

依優先級分類的規則類別

優先級類別影響力前綴
1列表效能關鍵list-performance-
2動畫高animation-
3導航高navigation-
4UI 模式高ui-
5狀態管理中react-state-
6渲染中rendering-
7單體倉庫中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 - 對回呼使用分發器模式
  • react-state-fallback - 首次渲染時顯示備用內容
  • react-compiler-destructure-functions - 為 React Compiler 解構函式
  • react-compiler-reanimated-shared-values - 使用編譯器處理共享值

6. 渲染(中)

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

7. 單體倉庫(中)

  • 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 15 individual skills — each has its own dedicated page.

agent-device

Automates interactions for Apple-platform apps (iOS, tvOS, macOS) and Android devices. Use when navigating apps, taking snapshots/screenshots, tapping, typing, scrolling, or extracting UI info across mobile, TV, and desktop targets.

assess-react-native-migration

Assesses whether and how an existing mobile product should migrate to React Native. Use when auditing one or more product repositories for migration readiness, including products whose iOS, Android, and other clients live in separate directories or repositories; choosing brownfield, greenfield, or a checkpoint-based path; defining a representative trial; or preparing a baseline and ROI decision before implementation. When product scope or material evidence is unavailable, grills the stakeholder with exactly one question per turn instead of sending a questionnaire.

callstackincubator/github

GitHub patterns using gh CLI for pull requests, stacked PRs, code review, branching strategies, and repository automation. Use when working with GitHub PRs, merging strategies, or repository management tasks.

callstackincubator/validate-skills

Validates skills in this repo against agentskills.io spec and Claude Code best practices. Use via /validate-skills command.

create-react-native-library

Scaffolds React Native libraries with create-react-native-library for standalone libraries or local native modules and views. Use when creating or working on React Native libraries or adding native functionality in an existing app.

dogfood

Systematically explore and test a mobile app on iOS/Android with agent-device to find bugs, UX issues, and other problems. Use when asked to "dogfood", "QA", "exploratory test", "find issues", "bug hunt", or "test this app" on mobile. Produces a structured report with reproducible evidence: screenshots, optional repro videos, and detailed steps for every issue.

github-actions

GitHub Actions workflow patterns for React Native iOS simulator and Android emulator cloud builds with downloadable artifacts. Use when setting up CI build pipelines or downloading GitHub Actions artifacts via gh CLI and GitHub API.

react-native-best-practices

Provides React Native performance optimization guidelines for FPS, TTI, bundle size, memory leaks, re-renders, and animations. Applies to tasks involving Hermes optimization, JS thread blocking, bridge overhead, FlashList, native modules, or debugging jank and frame drops.

react-native-brownfield-migration

Implements an accepted incremental brownfield migration from native iOS or Android to React Native or Expo using @callstack/react-native-brownfield. Use after the brownfield path has been selected, when setting up the integration, packaging XCFramework or AAR artifacts, or adding React Native surfaces to native hosts.

react-native-testing

Write tests using React Native Testing Library (RNTL) v13 and v14 (`@testing-library/react-native`). Use when writing, reviewing, or fixing React Native component tests. Covers: render, screen, queries (getBy/getAllBy/queryBy/findBy), Jest matchers, userEvent, fireEvent, waitFor, and async patterns. Supports v13 (React 18, sync render) and v14 (React 19+, async render). Triggers on: test files for React Native components, RNTL imports, mentions of "testing library", "write tests", "component tests", or "RNTL".

react-native-tv-best-practices

Reviews React Native TV apps for focus/D-pad navigation, 10-foot UI layout, TV playback/DRM integration, low-memory TV performance, and TV accessibility. Use when building, debugging, or reviewing react-native-tvos, Expo TV, Amazon Vega/Kepler, or React Native web TV targets where the issue depends on remote input, TV focus, TV packaging, TV hardware, or TV playback constraints.

react-navigation

Provides React Navigation UI patterns for stacks, tabs, drawers etc. Use when building navigation UIs with React Navigation, configuring headers, bottom sheets or handling safe areas and insets.

upgrading-react-native

Upgrades React Native apps to newer versions by applying rn-diff-purge template diffs, updating package.json dependencies, migrating native iOS and Android configuration, resolving CocoaPods and Gradle changes, and handling breaking API updates. Use when upgrading React Native, bumping RN version, updating from RN 0.x to 0.y, or migrating Expo SDK alongside a React Native upgrade.

validate-skills

Validates skills in this repo against agentskills.io spec and Claude Code best practices. Use via /validate-skills command.

writing-user-docs

House style for user-facing documentation — voice, scope, structure, and what to leave out. Use this skill whenever writing, editing, or reviewing anything a user reads to learn how to use a tool — help center articles, getting-started guides, tutorials, feature docs, README usage sections, in-app help, release notes, or FAQ entries. Trigger it even when the request is phrased plainly — "document this feature", "write docs for X", "explain this to users", "write a README for this library", "turn these notes into a guide" — and even when no style guidelines are mentioned. Also use it to review existing docs for tone, bloat, or leaked implementation detail. Do not use it for internal engineering docs, architecture write-ups, RFCs, or code comments.

相關技能