关于
This skill helps developers migrate existing Apple/Swift Expo native modules from the Expo Modules API 1.0 DSL to the 2.0 macro API while maintaining JavaScript/TypeScript compatibility. It specifically handles conversion to new decorators like @ExpoModule, @JS, @Event, @SharedObject, and @Record. Use this for incremental Swift migrations only, not for creating new modules or Android/Kotlin upgrades.
快速安装
Claude Code
推荐npx skills add expo/skills -a claude-code/plugin add https://github.com/expo/skillsgit clone https://github.com/expo/skills.git ~/.claude/skills/expo-migrate-module在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
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.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 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.tsfiles 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:
-
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.
- Compare the final exported surface with the inventory from step 1.
- Search for stale
Name, migratedFunction/Property/Constant/Eventsentries, oldsendEventcalls,@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
GitHub 仓库
常见问题
什么是 expo-migrate-module Skill?
expo-migrate-module 是一个 Claude Skill,作者为 expo。Skill 将 Claude 按需加载的说明和资源打包,让 Claude 无需额外提示即可执行与 expo-migrate-module 相关的任务。
如何安装 expo-migrate-module?
使用本页的安装命令:将 expo-migrate-module 作为插件添加到 Claude Code,或将其仓库克隆到 skills 目录,然后重启 Claude 以加载该 Skill。
expo-migrate-module 属于哪个分类?
expo-migrate-module 属于元分类。
expo-migrate-module 可以免费使用吗?
可以。expo-migrate-module 已收录在 AIMCP,可免费安装。
相关推荐技能
Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。
这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。
该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。
SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。
