agents/openai.yaml
interface:
display_name: "Migrate Expo Module"
short_description: "Migrate Swift Expo modules from 1.0 DSL to 2.0"
default_prompt: "Use $expo-migrate-module to migrate this Expo module's Swift implementation from the 1.0 definition DSL to the 2.0 macro API without changing its JavaScript contract."
references/compatibility.md
# Expo Modules API 2.0 Compatibility Checks
The Expo Modules API 2.0 design and implementation evolve across the macros plugin and `expo-modules-core`. Verify the checked-out dependency instead of relying on an SDK-number claim.
## Find the actual declarations
Locate `ExpoModulesMacros.swift` in the target repository or installed dependencies (use your search tool, or portable shell commands - do not assume `rg` is installed):
```bash
find . -name 'ExpoModulesMacros.swift' -not -path '*/node_modules/.cache/*'
```
Inspect the declarations that the user's source can import:
```bash
grep -nE 'public macro (ExpoModule|JS|Event|SharedObject|Record|Union|ViewProps|ExpoView)' <path-to-ExpoModulesMacros.swift>
```
A declaration proves only that Swift recognizes the attribute. Also inspect the corresponding macro implementation and core runtime hooks.
## Check paired core support
Search the actual core source for the feature being migrated:
```bash
grep -rnE '_decorateModule|_decorateSharedObject|_constructSharedObject|_jsName|EventEmitter|emitSync|StaticProperty|AnyViewProps|PropsDiff|_updateViewProps|didCreate|__expo_onStartListeningToEvent' <expo-modules-core>
```
Use compile errors and symbol call sites to confirm signatures. The macros plugin and core can drift independently; a successful macro expansion does not prove the generated code compiles or is called at runtime.
## Capability gates
Treat these as independent capabilities:
| Capability | Evidence required before migration |
| --- | --- |
| Module functions/properties | `@ExpoModule`/`@JS`, generated `_decorateModule`, and the core call site |
| Module name | generated `_jsName` and core registration/name lookup that reads it |
| Records | `@Record`, coding conformance/assertions, and field decode/encode support |
| Async events | `@Event`, `EventEmitter`, and `BaseModule`/`SharedObject` conformance |
| Shared-object instances | `_decorateSharedObject`, construction hook, and core invocation |
| Shared-object static functions | constructor object passed to decoration and static function routing |
| Synchronous events | `@Event(sync:)` plus core `emitSync` overloads |
| Task-returning functions | `JavaScriptEncodable` conformance for `Task` in core (encode-only) |
| Views | `@ViewProps`/`@ExpoView` plus the complete typed props update and event runtime |
| Module lifecycle methods | `AnyModule` requirements/base implementations and holder call sites |
If any required evidence is absent, keep that item in the 1.0 DSL.
## Known migration hazards in the July 2026 plan
Use this only as a warning list; checked-out source wins.
- Same-JS-name `@JS` overload grouping/dispatch was designed but not built; duplicate bindings could silently overwrite each other.
- `@Union` was not built.
- Decode errors lacked the 1.0 argument-index wrapper. This affects diagnostics rather than call semantics, but tests asserting exact messages may fail.
- `@ViewProps` had only an initial pure-macro slice; the UIKit typed props runtime and `@ExpoView` contract were still gated on core.
- Shared-object instance functions, properties, setters, construction, and static properties were implemented; verify constructor-side routing before migrating static functions.
- `@Event(sync: true)` macro generation existed, but core `emitSync` was still required.
- Default asynchronous `@Event` was supported after core added `EventEmitter` to modules and shared objects.
- `@JS` functions/properties, range-based arity, default/optional-aware calls, `@Record` field synthesis, async `@JavaScriptActor`, and instance shared-object decoration had landed in the macros work.
## Integration verification
Use the target project's own commands. A robust sequence is:
1. Run macro/unit tests if working inside the macros package.
2. Compile the migrated native module against the paired core checkout.
3. Re-run CocoaPods installation when plugin dependencies or injection changed.
4. Restart Xcode after swapping a macro plugin binary; cleaning DerivedData alone may not reload it.
5. Build the example app and execute existing JS/TS behavior tests.
Do not report a migration complete based only on textual expansion tests.
references/example.md
# Worked Example: Full Module Migration
This walks a single small module from the 1.0 DSL through mixed mode to a fully migrated 2.0 form. Every per-member rule lives in `migration-map.md`; this shows how they compose and how mixed mode is an intermediate state, not a failure.
The module below is representative: a name, a sync function, two async functions (one that suspends, one that blocks), a settable property, a constant, an event with observing hooks, and a record.
## Starting point: 1.0 DSL
```swift
import ExpoModulesCore
@Record
struct DownloadOptions {
var url: URL // required
var retries: Int = 3 // omittable, default 3
var label: String? // omittable and nullable
}
public final class DownloaderModule: Module {
private var volume: Double = 1
public func definition() -> ModuleDefinition {
Name("Downloader")
Events("onProgress")
OnStartObserving {
self.beginProgressUpdates()
}
OnStopObserving {
self.stopProgressUpdates()
}
Constant("buildInfo") { computeBuildInfo() }
Function("clamp") { (value: Double) -> Double in
return min(max(value, 0), 1)
}
Property("volume") { self.volume }
.set { self.volume = $0 }
AsyncFunction("download") { (options: DownloadOptions) -> String in
return try await self.performDownload(options)
}
AsyncFunction("clearCache") {
try FileManager.default.removeItem(at: self.cacheDirectory)
}
}
private func report(percent: Double) {
sendEvent("onProgress", ["percent": percent])
}
}
```
The observable contract to preserve:
| Member | JS name | Contract |
| --- | --- | --- |
| Module | `Downloader` | `requireNativeModule("Downloader")` |
| `clamp` | `clamp` | sync, 1 arg, returns number |
| `volume` | `volume` | read/write number |
| `buildInfo` | `buildInfo` | read-only constant |
| `download` | `download` | async, 1 record arg, returns string |
| `clearCache` | `clearCache` | async, no args, blocking work runs off the JS thread |
| `onProgress` | `onProgress` | event, payload `{ percent }` |
| observing hooks | n/a | progress updates start/stop with the listener count |
| `DownloadOptions` | n/a | `url` required; `retries` default 3; `label` nullable |
## Intermediate: mixed mode
Suppose the checked-out core supports everything used above: `@ExpoModule`, `@JS` functions/properties/constants, async `@JavaScriptActor`, `@Record`, default async `@Event`, and the module lifecycle hooks. One member is still blocked, by semantics rather than support: `clearCache` has a body that blocks and never suspends, and a 1.0 `AsyncFunction` runs it on a background queue automatically, while a 2.0 async member starts on the JS actor. Migrating it as-is would move blocking I/O onto the JS thread, so it stays in the DSL.
The record migrates first because it is a pure data type and the function that consumes it depends on it. Its shape is already correct, so migration is just verifying each field decodes: `url`, `retries`, `label` all map cleanly, so `@Record` stays as-is (it was already using the macro here).
```swift
import ExpoModulesCore
@Record
struct DownloadOptions {
var url: URL
var retries: Int = 3
var label: String?
}
@ExpoModule("Downloader")
public final class DownloaderModule: Module {
// Explicit wire name: default @Event would strip "on" and emit "progress".
@Event("onProgress")
var onProgress: (ProgressEvent) -> Void
@JS("clamp")
func clamp(value: Double) -> Double {
return min(max(value, 0), 1)
}
// Stored var -> JS getter + setter, matching the 1.0 get/set pair.
@JS
var volume: Double = 1
// A let is a natural constant: read-only from JS.
@JS
let buildInfo = computeBuildInfo()
@JS
func download(options: DownloadOptions) async throws -> String {
return try await performDownload(options)
}
// override: the hooks are inherited from the Module base class.
override func didStartListening(event: String) {
beginProgressUpdates()
}
override func didStopListening(event: String) {
stopProgressUpdates()
}
// Kept on the DSL: the body blocks without suspending, and a 2.0 async
// member would start it on the JS actor instead of a background queue.
public func definition() -> ModuleDefinition {
AsyncFunction("clearCache") {
try FileManager.default.removeItem(at: self.cacheDirectory)
}
}
private func report(percent: Double) {
onProgress(ProgressEvent(percent: percent))
}
}
@Record
struct ProgressEvent {
var percent: Double
}
```
Notes on the choices, each traceable to `migration-map.md`:
- `Name("Downloader")` moved into `@ExpoModule("Downloader")`; the custom name is carried explicitly, never dropped.
- `@Event("onProgress")` uses the explicit wire name to avoid the `on`-stripping default; the untyped dictionary became a typed `ProgressEvent`.
- The duplicate `private var volume` field was removed once `@JS var volume` became the single source of truth. Watch for this: a 1.0 backing field plus a migrated `@JS var` of the same name is a double-declaration.
- `Constant("buildInfo")` became `@JS let buildInfo`. Evaluation moves from the lazy 1.0 closure to module initialization, acceptable here because `computeBuildInfo()` is cheap; an expensive value would keep lazy storage behind a getter-only computed `@JS var`.
- `OnStartObserving`/`OnStopObserving` became the `didStartListening(event:)`/`didStopListening(event:)` hooks, with `override` because the class inherits `Module`. The 1.0 hooks were module-wide, so the event argument is ignored.
- `definition()` remains but now holds only the queue-sensitive `clearCache`. It is not deleted because it is non-empty.
## Fully migrated (after explicitly moving the blocking work off the JS actor)
The DSL entry for `clearCache` was the semantics-preserving default. To finish the migration, replace the implicit background queue with an explicit hop so the blocking work still never runs on the JS thread, then delete the empty `definition()`.
```swift
import ExpoModulesCore
@Record
struct DownloadOptions {
var url: URL
var retries: Int = 3
var label: String?
}
@Record
struct ProgressEvent {
var percent: Double
}
@ExpoModule("Downloader")
public final class DownloaderModule: Module {
@Event("onProgress")
var onProgress: (ProgressEvent) -> Void
@JS("clamp")
func clamp(value: Double) -> Double {
return min(max(value, 0), 1)
}
@JS
var volume: Double = 1
@JS
let buildInfo = computeBuildInfo()
@JS
func download(options: DownloadOptions) async throws -> String {
return try await performDownload(options)
}
@JS
func clearCache() async throws {
// Explicit hop: the body blocks, so it must not run on the JS actor.
try await Task.detached {
try FileManager.default.removeItem(at: self.cacheDirectory)
}.value
}
override func didStartListening(event: String) {
beginProgressUpdates()
}
override func didStopListening(event: String) {
stopProgressUpdates()
}
private func report(percent: Double) {
onProgress(ProgressEvent(percent: percent))
}
}
```
`definition()` is gone only because it was empty and `@ExpoModule("Downloader")` preserves the resolved name. If any member had stayed blocked or unverified, the mixed-mode form above is the correct place to stop, not a broken end state.
references/migration-map.md
# 1.0 to 2.0 Migration Map
Use this reference while editing. Preserve behavior first; macro adoption is secondary.
## Module and naming
Convert the module class and remove `Name(...)` only when the paired core reads the macro-synthesized name:
```swift
// 1.0
public final class CameraModule: Module {
public func definition() -> ModuleDefinition {
Name("Camera")
}
}
// 2.0
@ExpoModule("Camera")
public final class CameraModule: Module {}
```
Always carry a custom 1.0 name into `@ExpoModule("...")`. A stale `Name(...)` can override or conflict with the 2.0 name depending on the core revision. In mixed mode, remove `Name(...)` only after verifying the installed `_jsName` contract.
## Functions
Move a DSL closure into a real method and use `@JS("wireName")` when the Swift method name is different:
```swift
// 1.0
Function("sum") { (a: Double, b: Double) -> Double in
return a + b
}
// 2.0
@JS("sum")
func add(a: Double, b: Double) -> Double {
return a + b
}
```
Preserve:
- the JS name
- positional arity
- optional arguments and Swift defaults
- thrown errors and return type
- whether the result is synchronous or a Promise
Do not migrate functions that resolve to the same JS name unless the checked-out macro has overload grouping and collision diagnostics. Older 2.0 implementations install one property per declaration, so the last overload silently wins.
Reject or keep in DSL any unsupported signature such as variadics, `inout`, unresolved generics, or closure parameters without verified callback support. A `Promise` parameter is also unsupported; refactor it as described under Async functions.
### Async functions
A `Promise` parameter is not supported in a `@JS` signature; 2.0 drops the trailing-`Promise` argument entirely. A Promise-returning function has three shapes in 2.0. Pick by how the underlying work produces its result.
**1. Standard `async` method.** The common case. Swift `async` maps to a JS Promise:
```swift
// 1.0
AsyncFunction("load") { (url: URL) -> String in
return try loadSynchronously(url)
}
// 2.0
@JS
func load(url: URL) async throws -> String {
return try await loadResource(url)
}
```
**2. Checked continuation.** When the result arrives through a delegate or completion handler that fires once, wrap it with `withCheckedThrowingContinuation` (or `withCheckedContinuation` for non-throwing callbacks, or an `AsyncStream` for repeated values). This is the usual refactor for a 1.0 `AsyncFunction` that took a trailing `Promise` instance:
```swift
// 1.0
AsyncFunction("start") { (promise: Promise) in
scanner.start(
onSuccess: { result in promise.resolve(result) },
onFailure: { error in promise.reject(error) }
)
}
// 2.0
@JS
func start() async throws -> ScanResult {
return try await withCheckedThrowingContinuation { continuation in
scanner.start(
onSuccess: { result in continuation.resume(returning: result) },
onFailure: { error in continuation.resume(throwing: error) }
)
}
}
```
Resume the continuation exactly once on every path. If the callback API cannot guarantee that, or the refactor is otherwise unsafe, keep the function on the DSL instead of forcing it.
**3. Synchronous method returning a `Task`.** The `Task` encodes to a promise that settles with its result. Use it when the work is naturally a `Task`, or when a promise is needed as a value nested inside another encoded result rather than as the function's own return:
```swift
// 2.0
@JS
func download(url: URL) -> Task<DownloadResult, any Error> {
return Task {
try await self.downloader.download(url)
}
}
```
This shape requires the `JavaScriptEncodable` conformance for `Task` in the checked-out core (encode-only; a JS promise does not decode back into a `Task`). Verify it exists before using this shape; prefer shape 1 or 2 when it is absent.
Do not assume scheduling is unchanged. 2.0 async members are `@JavaScriptActor`-isolated and begin on the JS thread until their first real suspension. A 1.0 `.runOnQueue(...)` function or a workload that relied on automatic background execution must not be migrated as-is. Never move blocking I/O directly onto the JS actor.
For a queue-pinned 1.0 function, prefer restructuring the work onto the Swift Concurrency model (structured concurrency, an actor, or a detached task for blocking work). When that is not feasible because the queue itself is the contract, for example a library that must be called from one serial queue, convert to an `async` method that dispatches to that queue inside a checked continuation:
```swift
// 1.0
AsyncFunction("process") { (input: String) -> String in
return try self.processor.process(input)
}
.runOnQueue(processingQueue)
// 2.0
@JS
func process(input: String) async throws -> String {
return try await withCheckedThrowingContinuation { continuation in
processingQueue.async {
do {
continuation.resume(returning: try self.processor.process(input))
} catch {
continuation.resume(throwing: error)
}
}
}
}
```
## Properties and constants
Map a getter to a getter-only `@JS var`; map a getter/setter pair to a settable stored or computed `@JS var`:
```swift
// 1.0
Property("volume") { self.volume }
.set { self.volume = $0 }
// 2.0
@JS
var volume: Double = 1
```
Access control does not define JS mutability. Verify whether the declaration is syntactically settable; a stored `var` normally produces a JS setter.
Map a 1.0 `Constant` to a `@JS let`; a `let` property is a natural constant and produces a read-only JS property:
```swift
// 1.0
Constant("apiVersion") { 3 }
// 2.0
@JS
let apiVersion = 3
```
Evaluation timing shifts: a 1.0 `Constant` closure runs lazily, while a `let` initializes with the module instance. When the value is expensive and must stay deferred, keep private lazy storage and expose a getter-only computed property (a `var` with a `{ }` getter body and no storage of its own), not a stored `lazy var`:
```swift
private lazy var cachedInfo = computeInfo()
@JS
var info: Info { // computed: recomputes nothing, just returns the cached value
return cachedInfo
}
```
Do not expose a cached value as a settable `lazy @JS var`.
## Events
Replace `Events(...)` plus `sendEvent(...)` with a typed function property:
```swift
@Record
struct ProgressEvent {
var percent: Double
}
// Explicit string preserves the old wire name.
@Event("onProgress")
var onProgress: (ProgressEvent) -> Void
func report(percent: Double) {
onProgress(ProgressEvent(percent: percent))
}
```
The default `@Event` wire name strips a leading `on` and decapitalizes the remainder: Swift `onProgress` emits `progress`. 1.0 modules commonly expose `onProgress`. During migration, pass the original wire name explicitly unless an intentional JS breaking change was approved.
Use `() -> Void` for no-payload events. For payloads, create or reuse a `JavaScriptEncodable` type instead of preserving an untyped dictionary. Migrate `OnStartObserving` and `OnStopObserving` to the `didStartListening(event:)`/`didStopListening(event:)` lifecycle hooks (see Views and lifecycle).
Default `@Event` dispatch schedules onto the JS thread and is callable from other isolation contexts. Do not use `sync: true` unless core provides the matching `emitSync` overloads.
## Shared objects
Move instance behavior from a `Class(...)` block onto the `SharedObject` subclass:
```swift
// 2.0
@SharedObject
final class Download: SharedObject {
@JS
init(url: URL) {
self.url = url
}
@JS
func pause() {}
@JS
var progress: Double { currentProgress }
// Installs on the JS class (constructor) object, not the prototype.
@JS
static let maxConcurrent = 4
}
@ExpoModule(classes: [Download.self])
final class DownloadModule: Module {}
```
Drop the leading owner argument used by instance DSL closures; use `self` in the real instance method. Preserve constructor arity and JS member names.
Migrate only when the checked-out core supplies the shared-object decoration and construction hooks. Static properties migrate as Swift `static` or `class` properties and install on the JS class (constructor) object rather than the prototype; verify constructor-side routing for static functions before migrating them, since instance support does not imply static-function support. Never create both a 1.0 `Class(...)` entry and a 2.0 registration for the same class without confirming that core intentionally merges them.
Static members belong to shared objects, not modules: a module is exported to JS as an instance, so Swift `static` members on a `Module` class are not useful there. Keep module-level values as instance `@JS` members.
## Records
Attach `@Record`, remove field wrappers, and encode requiredness in the declaration:
```swift
@Record
struct Options {
var source: URL // required
var retries: Int = 3 // omittable; default applies
var label: String? // omittable and nullable
}
```
Rules:
- non-optional with no default: required
- any property with a default: omittable
- optional type: omittable and nullable
Preserve the 1.0 contract exactly. For example, migrate `@Field var source: URL? = nil` to `var source: URL?`, not to `var source: URL`, unless the user approved a breaking change.
Every stored property is part of the 2.0 record surface. If the old type contains stored bookkeeping that was not a 1.0 field, move it out of the record or leave the type on 1.0; there is no field opt-out. Verify that each field supports the required `JavaScriptDecodable`/`JavaScriptEncodable` direction.
Do not adopt `@Union` until that macro and its coding witnesses exist in the target.
## Views and lifecycle
Keep UIKit `View`, `Prop`, view `Events`, and `OnViewDidUpdateProps` DSL entries until the target includes the complete `@ViewProps`/`@ExpoView` core contract. Macro declarations or expansion tests alone do not prove the runtime update path exists.
Module lifecycle is core-owned rather than macro-generated. The DSL components map to hook methods with no-op defaults:
| 1.0 | 2.0 |
| --- | --- |
| `OnCreate` | `didCreate()` |
| `OnDestroy` | `willDestroy()` |
| `OnStartObserving` | `didStartListening(event:)` |
| `OnStopObserving` | `didStopListening(event:)` |
Rules:
- Use the `override` keyword when the class inherits `Module`/`BaseModule`; define the hooks directly (no `override`) when the conformance comes only from `@ExpoModule`. Hooks added only in a subclass of a macro module are not called; keep them on the class that declares the conformance.
- The listening hooks receive the event name. A module-wide 1.0 `OnStartObserving` ignores the argument; a per-event `OnStartObserving("name")` becomes a comparison on it.
- `didCreate()` runs after the module is registered, slightly later than 1.0 `OnCreate`, which fires before registration; `willDestroy()` runs at holder teardown. Verify nothing depends on the earlier timing before migrating `OnCreate`.
- DSL lifecycle components can remain during an incremental migration and each fires exactly once, but do not implement a DSL component and its hook for the same behavior, or the work runs twice.
There is no 2.0 replacement for every lifecycle component; for example, retain app-context teardown handling when no matching hook exists.
## Mixed mode
`@ExpoModule` may coexist with a non-empty `definition()` when the paired core supports merging the two surfaces. Keep only unsupported entries in the DSL and avoid duplicate names across macro and DSL registrations.
Before deleting `definition()`, verify that it contains no:
- views or view events
- lifecycle or app-context listeners
- queue-pinned functions
- shared-object static functions or other unsupported definitions
## Contract checklist
For every migrated member compare before and after:
| Concern | Must remain stable |
| --- | --- |
| Module | registration name and `requireNativeModule` key |
| Function | JS name, accepted arity, omitted/default behavior, sync/Promise result |
| Property | JS name, read/write behavior, evaluation/caching |
| Event | listener string, payload shape, timing |
| Record | field names, requiredness, nullability, defaults |
| Shared object | constructor shape, prototype vs constructor placement, identity |
| Execution | JS actor, main actor, background queue, ordering |
SKILL.md
---
name: expo-migrate-module
description: Framework (OSS). 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.
version: 1.0.0
license: MIT
---
# 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
The Expo Modules API 2.0 macros require `expo` `57.0.7` or newer. 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; do not attempt the migration against an unsupported version. 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.
## References
- Read `references/migration-map.md` before changing source. It contains the 1.0-to-2.0 mappings, semantic traps, and mixed-mode rules.
- Read `references/example.md` for 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.md` when the checked-out `expo-modules-core` version 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 an SDK number.
## 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, 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 semantics
- 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
- 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.
- Do not migrate queue-pinned DSL functions as-is; restructure onto Swift Concurrency or dispatch to the original queue via a continuation, per the async-function rules in `references/migration-map.md`.
- Do not migrate views, unions, synchronous events, or shared-object static functions without verified support.
- Do not change Kotlin, JS wrappers, or public `.d.ts` files unless the user requested an API change.
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:
1. **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.
2. **Open a tracking issue on `expo/expo`** noting the functionality that 2.0 does not yet cover, so the gap is recorded rather than silently worked around. Use `gh issue create --repo expo/expo` and 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-core` version/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:
1. Build or type-check the Apple module against the target `expo-modules-core`.
2. Run native unit tests and JS/TS tests.
3. Build and launch the example app when the repository provides one.
4. Compare the final exported surface with the inventory from step 1.
5. Search for stale `Name`, migrated `Function`/`Property`/`Constant`/`Events` entries, old `sendEvent` calls, `@Field`, and duplicate registrations.
Expansion tests alone are insufficient: generated macro code can look correct while failing against mismatched core symbols. 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
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:
```bash
npx --yes submit-expo-feedback@latest --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 AI agent repeatedly failed or the user had to take over an Expo task, load the expo-skill-feedback skill and follow its eval-candidate flow instead of reusing the command above.