Community程式設計與開發github.com

react-native-brownfield-migration

實作從原生 iOS/Android 逐步遷移至 React Native 或 Expo 的公認褐地遷移方案,使用 @callstack/react-native-brownfield。適用於已選定褐地路徑後的整合設定、封裝 XCFramework 或 AAR 成品,或將 React Native 介面加入原生宿主應用。

react-native-brownfield-migration 是什麼?

這項技能提供一套規範化的工作流程,幫助開發者在既有原生 iOS 或 Android 應用中,逐步引入 React Native,採用褐地遷移策略,並依賴 @callstack/react-native-brownfield 工具。支援 Expo 與 Bare React Native 兩種路徑,使用前必須先透過 assess-react-native-migration 技能確認遷移策略。技能涵蓋初始設定、封裝 XCFramework(iOS)或 AAR(Android)成品、將 React Native 介面整合至原生宿主、以及階段性功能/畫面迭代上線。它定義了全局智能防護規則,包括路徑擇一、佔位符解析、指令驗證、偏好設定檔而非重複旗標、以及透過 agent-device 進行啟動與執行時驗證。此外,技能內含詳細的參考文件清單與問題對照表,能快速引導開發者找到對應的整合指南。

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

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

在你喜歡的 AI 中提問

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

說明文件

遷移至 React Native

僅在已決定採用褐地遷移路徑後,才使用此技能。當使用者仍在比較褐地、綠地、基於檢查點的路徑、延遲遷移或完全不遷移時,請先使用 assess-react-native-migration。

概述

使用 @callstack/react-native-brownfield 在現有原生應用中逐步採用 React Native 的規範化工作流程,從初始設定到階段性宿主整合。

  • Expo 軌道
  • Bare React Native 軌道

每個任務使用單一軌道,除非使用者明確要求進行遷移或比較。

遷移策略

褐地遷移規劃與執行請使用此策略:

  1. 評估應用狀態,選擇 Expo 或 Bare 路徑。
  2. 使用 @callstack/react-native-brownfield 進行初始設定。
  3. 從 React Native 來源應用封裝 RN 成品(XCFramework/AAR)。
  4. 將一個 RN 介面整合到宿主應用,並驗證啟動與執行階段。
  5. 按功能/畫面重複整合,以利階段性上線。

智能防護規則(全域)

這些規則適用於所有參考文件:

  1. 先選擇一條路徑(Expo 或 Bare),不要混合步驟。
  2. 使用文件中的佔位符(<framework_target_name>、<android_module_name>、<registered_module_name>)並從專案檔案中解析。
  3. 每個封裝指令在進入宿主整合前都須驗證。
  4. 依賴任何參考文件中的旗標表前,先執行 npx brownfield <command> --help;幫助輸出為準。
  5. 將穩定的專案設定寫入 brownfield.config.* 一次,而非重複使用旗標——參見 cli-and-config.md。
  6. 長篇幅平台程式碼片段與 CLI 選項細節,優先使用官方文件。
  7. 盡可能保持宿主應用與直接 React Native API 隔離(外觀模式)。
  8. 啟動/執行時驗證時,使用 agent-device 開啟宿主應用,導航至 RN 介面,擷取快照/螢幕截圖,並收集裝置證據。若 agent-device 缺失且驗證需要,透過環境認可/可信任的路徑安裝,或請使用者安裝或啟用。

規範文件

路徑選擇閘(必須先執行)

在選取任何參考文件前,先分類專案:

  1. 若尚無 React Native 應用,使用 Expo 建立路徑:
  2. 若已有 React Native 應用,檢查 package.json 與 app.json:
    • 若 expo 存在或需要 Expo 插件工作流程,則為 Expo。
    • 若使用原生資料夾與直接 RN CLI 工作流程,且無 Expo 路徑需求,則為 Bare RN。
  3. 若仍不清楚,提出一個區分問題。
  4. 只繼續使用單一路徑。

何時使用

在以下情況參考此套件:

  • 實作從純原生應用到 React Native 或 Expo 的公認逐步遷移
  • 為 Expo 或 Bare React Native 專案建立褐地整合流程
  • 使用 @callstack/react-native-brownfield 進行初始設定
  • 從 React Native 應用產生 iOS XCFramework 成品
  • 從 React Native 應用產生並發布 Android AAR 成品
  • 將產生的成品整合到 iOS/Android 宿主應用

快速參考

檔案描述
quick-start.md共享前置檢查與強制性路徑選擇閘
cli-and-config.mdCLI 指令、完整旗標集、設定檔、成品佈局、程式碼生成副作用
runtime-api.md宿主 <-> RN API 表面(JS、Swift、Kotlin)與參考應用
expo-create-app.md在 Expo 褐地設定前建立新的 Expo 應用
expo-quick-start.mdExpo 插件設定與封裝就緒
expo-ios-integration.mdExpo iOS 封裝與宿主啟動整合
expo-android-integration.mdExpo Android 封裝、發布與宿主整合
bare-quick-start.mdBare React Native 基準設定
bare-ios-xcframework-generation.mdBare iOS XCFramework 生成
bare-android-aar-generation.mdBare Android AAR 生成與發布
bare-ios-native-integration.mdBare iOS 宿主整合
bare-android-native-integration.mdBare Android 宿主整合

問題 -> 技能對照表

問題從此開始
需要先決定遷移路徑assess-react-native-migration
需要決定 Expo vs Bare 路徑quick-start.md
需要 CLI 旗標、設定檔形式或成品路徑cli-and-config.md
需要宿主 <-> RN API 名稱、簽名或可運作的範例應用runtime-api.md
需要宿主與 RN 之間的共享狀態,或型別的 RN -> 原生導航brownie / brownfield-navigation 技能
需要為褐地建立新的 Expo 應用expo-create-app.md
需要 Expo 褐地設定與插件接線expo-quick-start.md
需要 Expo iOS 褐地整合expo-ios-integration.md
需要 Expo Android 褐地整合expo-android-integration.md
需要 Bare RN 基準設定bare-quick-start.md
需要 Bare RN iOS XCFramework 生成bare-ios-xcframework-generation.md
需要 Bare RN Android AAR 生成/發布bare-android-aar-generation.md
需要 Bare RN iOS 宿主整合bare-ios-native-integration.md
需要 Bare RN Android 宿主整合bare-android-native-integration.md

相關技能

  • 在選擇遷移路徑前使用 Assess React Native migration。
  • brownie(共享宿主 <-> RN 狀態)與 brownfield-navigation(型別的 RN -> 原生導航)來自另一個儲存庫:透過名稱引用它們,若未安裝則回退至規範文件。

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

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.

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.

相關技能