expo-modules
БесплатноБез исполняемых скриптовНе проверенBuilding great Expo native modules for iOS and Android. Views, APIs, Marshalling, Shared Objects, Expo Documentation, Verifying Expo modules.
Об этом скилле
Great module standards
- Design native APIs as if you contributing W3C specs for the browser, take inspiration from modern web modules. eg
std:kv-storage,clipboard. - Aim for 100% backwards compatibility like the web.
- Create escape hatches for single-platform functionality.
- Avoid extraneous abstractions. Directly expose native functionality.
- Avoid unnecessary async methods. Use sync methods when possible.
- Prefer string union types for API options instead of boolean flags, enums, or multiple parameters. eg instead of
capture(options: { isHighQuality: boolean }), usecapture(options: { quality: 'high' | 'medium' | 'low' }). - Marshalling is awesome for platform-specific APIs.
- New Architecture only. NEVER support legacy React Native architecture.
- ALWAYS use only Expo modules API.
- Prefer Swift and Kotlin.
- Use optionality for availability checks as opposed to extraneous
isAvailablefunctions or constants. egsnapshot.capture?.()instead ofsnapshot.isAvailable && snapshot.capture(). - ALWAYS support the latest and greatest API features.
Example of a GREAT Expo module:
import { NativeModule } from "expo";
declare class AppClipModule extends NativeModule<{}> {
prompt(): void;
isAppClip?: boolean;
}
// This call loads the native module object from the JSI.
const AppClipNative =
typeof expo !== "undefined"
? (expo.modules.AppClip as AppClipModule) ?? {}
: {};
if (AppClipNative?.isAppClip) {
navigator.appClip = {
prompt: AppClipNative.prompt,
};
}
// Add types for the global `navigator.appClip` object.
declare global {
interface Navigator {
/**
* Only available in an App Clip context.
* @expo
*/
appClip?: {
/** Open the SKOverlay */
prompt: () => void;
};
}
}
export {};
- Simple web-style interface.
- Global type augmentation for easy access.
- Docs in the type definitions.
- Optional availability checks instead of extraneous
isAvailablemethods.
Example of a POOR Expo module:
import { NativeModulesProxy } from "expo-modules-core";
const { ExpoAppClip } = NativeModulesProxy;
export default {
promptAppClip() {
return ExpoAppClip.promptAppClip();
},
isAppClipAvailable() {
return ExpoAppClip.isAppClipAvailable();
},
};
Great documentation
- If you have a function like
isAvailable(), explain why it exists in the docs. Research cases where it may return false such as in a simulator or particular OS version. - Document OS version availability for functions and constants in the type definitions.
BAD module standards
- APIs that are hard to import, e.g.
import * as MediaLibrary from 'expo-media-library';instead ofimport { MediaLibrary } from 'expo/media'; - Extraneous abstractions over native functionality. The native module is installing on the global, do not wrap it in another layer for no reason.
- Extraneous async methods when sync methods are possible.
- Boolean flags instead of string union types for options.
- Supporting legacy React Native architecture.
Views
Take API inspiration from great web component libraries like BaseUI and Radix.
- https://base-ui.com/react/components/progress
- https://www.radix-ui.com/primitives/docs/components/progress
Consider if you're building a control or a display component. Controls should have more interactive APIs, while display components should be more declarative.
Prefer functions on views instead of useImperativeHandle + findNodeHandle.
AsyncFunction("capture") { (view, options: Options) -> Ref in
return try capture(self.appContext, view)
}
Remember to export views in the module:
import ExpoModulesCore
public class ExpoWebViewModule: Module {
public func definition() -> ModuleDefinition {
Name("ExpoWebView")
View(ExpoWebView.self) {}
}
}
Marshalling-style API
Consider this example https://github.com/EvanBacon/expo-shared-objects-haptics-example/blob/be90e92f8dba9b0807009502ab25c423c57e640d/modules/my-module/ios/MyModule.swift#L1C1-L178C2
Using @retroactive Convertible and AnyArgument to convert between Swift types and dictionaries enables passing complex data structures across the boundary without writing custom serialization code for each type.
extension CHHapticEventParameter: @retroactive Convertible, AnyArgument {
public static func convert(from value: Any?, appContext: AppContext) throws -> Self {
guard let dict = value as? [String: Any],
let parameterIDRaw = dict["parameterID"] as? String,
let value = dict["value"] as? Double else {
throw NotADictionaryException()
}
return Self(parameterID: CHHapticEvent.ParameterID(rawValue: parameterIDRaw), value: Float(value))
}
}
extension CHHapticEvent: @retroactive Convertible, AnyArgument {
public static func convert(from value: Any?, appContext: AppContext) throws -> Self {
guard let dict = value as? [String:
Установить expo-modules в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл expo-modules?
Building great Expo native modules for iOS and Android. Views, APIs, Marshalling, Shared Objects, Expo Documentation, Verifying Expo modules.
Как установить скилл expo-modules?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл expo-modules запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic