
expo-migrate-module
Migrate an existing Apple/Swift Expo native module from the Expo Modules API 1.0 definition DSL to the 2.0 macro API (sometimes called v2) while preserving its JavaScript and TypeScript contract. Use when converting or incrementally adopting @ExpoModule, @JS, @Event, @SharedObject, or @Record in an existing module. Do not use for creating a new module, general Expo SDK upgrades, or Android/Kotlin migrations.
- Installs
- 19.7K
- Last 24h
- +303
- Trending rank
- #952
- Security
- Pass
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/expo/skills --skill expo-migrate-module- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads expo-migrate-module automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
Security audits
Independent scans of the skill's instructions and bundled files.
SKILL.md
The instructions your agent reads when the skill is triggered.
Migrate an Expo Module
Migrate the Swift side of an existing Expo module without changing its observable JS API. Treat the current JS/TypeScript surface and tests as the compatibility contract. Leave Kotlin on the 1.0 DSL unless the user explicitly expands the task.
Prerequisite
Use expo 57.0.21 or newer. Earlier 57.x versions can compile the macros but lack many of the 2.0 features and performance optimizations, so do not target them. Before editing, check the target's installed version (expo in package.json/lockfile, or npm ls expo). If it is older, stop and tell the user to upgrade first.
Check the example app's own package.json too, not only the module root. The example app is the integration surface you build and launch in step 4, so it needs the same floor.
This is a floor, not a guarantee: the exact macro and core surface still varies within 57.x, so step 2 must still verify the checked-out source.
SDK 57 ships the macros as experimental and undocumented, with the official beta in SDK 58. The API can still change under you. Say this to the user before a large migration, and prefer incremental mixed mode over converting a module wholesale.
References
- Read
references/migration-map.mdbefore changing source. It contains the 1.0-to-2.0 mappings, semantic traps, and mixed-mode rules. - Read
references/example.mdfor a full before/after walkthrough of one module through mixed mode to a complete migration. Consult it when you need to see how the per-member rules compose. - Read
references/compatibility.mdwhen the checked-outexpo-modules-coreversion or branch is not known to support every requested macro. It explains how to verify the actual compile-time and runtime surface instead of guessing from a version number, and lists what the macros plugin gained through0.10.0.
Workflow
1. Establish the contract
Inspect repository instructions and the worktree before editing. Locate the Swift module classes, records, shared objects, native views, JS/TS bindings, tests, example app, podspec, expo-module.config.json, and installed or checked-out expo-modules-core.
Inventory every exported item before rewriting it:
- module and shared-object JS names
- function names, arity, labels, defaults, nullability, sync/async behavior, errors, and queue/thread semantics (note which
AsyncFunctionbodies do blocking or long-running work, and any.runOnQueue(...)) - property names, mutability, and constant caching behavior
- event wire names and payload shapes
- record field names, defaults, requiredness, and nullability
- shared-object constructors and instance/static placement (
FunctionvsStaticFunction/StaticAsyncFunction) - lifecycle hooks and views
Use the TypeScript declarations and JS call sites to resolve ambiguity. Do not silently "improve" requiredness, rename an event, or change sync behavior during a syntax migration.
2. Verify the available 2.0 surface
Inspect the macro declarations and matching core hooks in the dependency actually used by the target. Do not assume that all items in the 2.0 design are present because one macro compiles.
Classify each 1.0 item as:
- Migrate: both its macro and required core runtime support exist.
- Keep in DSL: mixed mode preserves it safely, or 2.0 lacks an equivalent.
- Blocked: migration would alter the JS contract or requires unavailable runtime support.
Prefer an incremental mixed-mode result over speculative generated code. Keep definition() for any remaining DSL elements; delete it only when it is empty and the resolved module name is preserved by @ExpoModule.
3. Apply the migration
Migrate one semantic group at a time: module naming, functions, properties/constants, events, shared objects, then records. Keep the diff narrow.
Follow these invariants:
- Preserve every existing JS-visible name explicitly when Swift naming rules or macro defaults differ.
- Keep original optional/default behavior. An optional 1.0 record field must not become required merely because 2.0 can express required fields.
- Do not migrate same-JS-name overloads unless the checked-out macro groups and dispatches them.
- Preserve async threading behavior. A 1.0
AsyncFunctionbody ran off the JS thread; a 2.0async@JSmember starts on it and leaves only at the firstawait. A body that never awaits therefore blocks the JS thread, with no change to the JS signature. Audit what runs before the firstawait, and never leave blocking I/O on the JS actor. Fix with@JS(.concurrent), or restructure onto Swift Concurrency or a continuation. Queue-pinned functions get the same treatment. See the threading section inreferences/migration-map.md. - Verify core support before migrating views, unions, synchronous events, shared-object static members, or free-form
Anyarguments. The macros plugin has shipped ahead of core on every one of these, so check the checked-out core rather than a plugin version, and leave unsupported members on the 1.0 DSL.references/compatibility.mdhas the per-capability checks. - Keep
expo-module.config.jsonlisting every module class underapple.modules. The entries are bare Swift class names, so renaming a class during migration detaches the module silently: it builds, then is absent at runtime. A migrated class must also staypublicoropen. SDK 58's auto-discovery is what retires these entries. - Do not change Kotlin, JS wrappers, or public
.d.tsfiles unless the user requested an API change. - Never write macro-generated symbols into the module's source. The macro emits them; hand-writing or overriding them is not part of a migration.
After each group, search for old DSL entries and call sites that should have moved. Avoid broad formatting or unrelated cleanup.
When a 2.0 equivalent is missing or a group fails
When step 2 classified an item as Blocked, or a migrated group fails to build or breaks the contract, do not force it. Stop on that group and:
-
Ask the user how to proceed for that item, with two options:
- Co-exist: keep the item in the 1.0
definition()DSL alongside the migrated@ExpoModule(mixed mode) and continue with the other groups. - Revert: back out the group's edits, leaving it untouched on 1.0, and move on.
Default to co-existence when mixed mode is verified safe, since it preserves the most progress. Revert when the half-applied change left the module in a non-building state and cannot be salvaged incrementally.
- Co-exist: keep the item in the 1.0
-
Open a tracking issue on
expo/exponoting the functionality that 2.0 does not yet cover, so the gap is recorded rather than silently worked around. Usegh issue create --repo expo/expoand confirm with the user before posting (per repo conventions, do not post outward-facing comments without approval). Include:- the 1.0 member and its JS contract
- the specific macro or core hook that is missing (cite the evidence gap from
references/compatibility.md) - the
expo-modules-coreversion/branch checked out
Reference the issue in the handoff so the remaining DSL entry is traceable to a known limitation.
Keep going with the groups that do migrate cleanly; one blocked member does not block the rest.
4. Verify behavior
Run the narrowest available checks first, then the real integration surface:
- Build or type-check the Apple module against the target
expo-modules-core. - Run native unit tests and JS/TS tests.
- Build and launch the example app when the repository provides one.
- Confirm
expo-module.config.jsonstill names every module class underapple.modules, matching the Swift class names as they now stand. A stale entry builds clean and fails only at runtime, so the example app must actually resolve the module, not merely compile. - Compare the final exported surface with the inventory from step 1.
- Search for stale
Name, migratedFunction/AsyncFunction/StaticFunction/StaticAsyncFunction/Property/Constant/Eventsentries, oldsendEventcalls,@Field, and duplicate registrations. Search the source you wrote, not macro expansion output.
Expansion tests alone are insufficient: generated macro code can look correct while failing to link or run against a mismatched core. If dependencies changed or macro plugin flags are missing, reinstall JS dependencies as appropriate, run the repository's CocoaPods installation workflow, and restart Xcode before diagnosing plugin communication failures.
Handoff
Never print macro-generated or core-internal symbol names to the user. references/compatibility.md cites them so you can grep for them, but they are implementation details that change between plugin revisions, and they are noise in a report. Name a capability by its macro (@JS static, @Event(sync:)) and by observable JS behavior. Say "the installed core does not support decoding free-form dictionary arguments yet", not the name of the missing method. The exception is a tracking issue on expo/expo, where the specific missing hook is the point.
Report:
- which members moved to 2.0
- which members intentionally remain in the 1.0 DSL and why
- any compatibility-sensitive choices, especially event names, record requiredness, constants, and queues
- the commands run and any verification not completed
Submitting Feedback
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:
npx --yes @expo/agent-cli@latest feedback --category skills --subject "expo-migrate-module" "<actionable feedback>"
Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
If an agent repeatedly fails at an Expo task or the user has to step in, submit a brief report of the task, expected result, and what went wrong using --category evals and the relevant Expo package or command as --subject.
FAQ
What does the expo-migrate-module skill do?
Migrate an existing Apple/Swift Expo native module from the Expo Modules API 1.0 definition DSL to the 2.0 macro API (sometimes called v2) while preserving its JavaScript and TypeScript contract. Use when converting or incrementally adopting @ExpoModule, @JS, @Event, @SharedObject, or @Record in an existing module. Do not use for creating a new module, general Expo SDK upgrades, or Android/Kotlin migrations.
How do I install expo-migrate-module?
Run npx skills add https://github.com/expo/skills --skill expo-migrate-module in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/expo-migrate-module/ (personal) or .claude/skills/expo-migrate-module/ (project).
Which AI agents can use expo-migrate-module?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is expo-migrate-module safe to install?
Security partners have reviewed it: Gen Agent Trust Hub passed; Socket passed; Snyk passed. As with any skill, read the SKILL.md and bundled scripts before installing.
Who maintains expo-migrate-module?
It is published by expo in expo/skills. It has 19,738 recorded installs.
More from expo/skills
expo-dev-client
expo/skills
Build and distribute Expo development clients locally or via TestFlight for internal testing. For production TestFlight releases and store submission, use the eas-app-stores skill.
building-native-ui
expo/skills
Build beautiful, native-feeling Expo screens. Covers Apple HIG styling, semantic colors, native controls, SF Symbols, media, animations, visual effects, gradients, storage, and responsive layout. For routing and navigation, use the expo-router skill.
expo-tailwind-setup
expo/skills
Framework (OSS). Set up Tailwind CSS v4 in Expo with react-native-css and NativeWind v5 for universal styling
native-data-fetching
expo/skills
Use when implementing or debugging ANY network request, API call, or data fetching. Covers fetch API, React Query, SWR, error handling, caching, offline support, and Expo Router data loaders (useLoaderData).
expo-module
expo/skills
Guide for creating and writing Expo native modules and views using the Expo Modules API (Swift, Kotlin, TypeScript). Covers module definition DSL, native views, shared objects, config plugins, lifecycle hooks, autolinking, and type system. Use when building or modifying native modules for Expo. Not for migrating an existing Swift module from the definition DSL to the Expo Modules API 2.0 macros; use expo-migrate-module (from the expo-experiments plugin) for that.
upgrading-expo
expo/skills
Guidelines for upgrading Expo SDK versions and fixing dependency issues
Popular mobile skills
design-mobile-apps
designed-by-ai/skills
Design mobile app screens with Sleek, edit Sleek projects, and implement their designs in React Native or HTML.
ios-design
uizze.sh
Design and review iOS UI/UX for iPhone apps in SwiftUI, UIKit, or React Native. Use for mobile app design, screen redesigns, navigation flows, typography, forms, keyboard and safe-area layout, and accessibility checks. Apply Apple Human Interface Guidelines and consult real product references through the optional Uizze connection.
vercel-react-native-skills
vercel-labs/agent-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.
animate-expo
emilkowalski/skills
Build animations in React Native and Expo, making the decisions in the order that determines whether they feel right — should it animate, which thread it runs on, which properties, spring or timing, how the gesture hands off, how it degrades. Writes the implementation with Reanimated, Gesture Handler, Expo Router and expo-haptics. Use when animating anything in an Expo app, adding gestures, sheets, screen transitions, press feedback or haptics, or fixing motion that stutters on device. For web animation use animate.
xcode-project-setup
firebase/agent-skills
Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).
firebase-remote-config-basics
firebase/agent-skills
Manages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Android, iOS). Use when downloading/deploying remoteconfig JSON templates, managing version history/feature flags, setting in-app defaults, fetchAndActivate(), real-time listeners, or SDK setup. Don't use for Firebase Hosting, Auth, Firestore, Data Connect, Crashlytics, or App Hosting.