Community编程与开发github.com

vercel-react-native-skills

为构建高性能移动应用而设的 React Native 与 Expo 最佳实践。在开发 React Native 组件、优化列表性能、实现动画或处理原生模块时使用。

vercel-react-native-skills 是什么?

该技能提供了一套全面的 React Native 和 Expo 最佳实践规则集,涵盖性能优化、动画实现、UI 模式、导航、状态管理、渲染、monorepo 结构及配置等多个方面。其核心价值在于帮助开发者避免常见陷阱,并针对不同场景提供优先级明确(从 CRITICAL 到 LOW)的解决方案。例如,在列表性能方面,它强制使用 FlashList 并记忆化列表项;在动画方面,鼓励仅对 transform 和 opacity 进行 GPU 加速。该技能通过清晰的分类和前缀(如 `list-performance-`)组织规则,方便开发者按需查找。它适用于任何 React Native 或 Expo 项目,尤其是在处理大型列表、复杂动画、原生模块集成或跨平台配置时,能显著提升应用性能和维护性。

兼容平台~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 实现动画
  • 处理图片和媒体
  • 配置原生模块或字体
  • 构建包含原生依赖的 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 - 对回调使用调度器模式
  • react-state-fallback - 在首次渲染时显示回退
  • react-compiler-destructure-functions - 为 React Compiler 解构函数
  • react-compiler-reanimated-shared-values - 配合 Compiler 处理共享值

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 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.

相关技能