Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

expo-module展览模块

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

115,056

周安装

4,660

GitHub Stars

1,812

下载量

37,224
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:expo-module(展览模块)
来源仓库:https://github.com/expo/skills
仓库路径:skills/expo-module
安装命令:
npx skills add https://github.com/expo/skills --skill expo-module
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/expo/skills --skill expo-module

简介

编写原生模块与视图的完整参考手册,覆盖 Swift/Kotlin/TypeScript 三端开发。

  • 定义模块 DSL 结构,规范函数、属性、常量与事件的生命周期管理。
  • 指导如何暴露平台 SDK 能力供 React Native 消费,保持 API 简洁性原则。
  • 建议直接映射 W3C 标准接口风格,避免过度抽象造成使用复杂度上升。
  • expo-module 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Writing Expo Modules

Complete reference for building native modules and views using the Expo Modules API. Covers Swift (iOS), Kotlin (Android), and TypeScript.

When to Use

  • Creating a new Expo native module or native view
  • Adding native functionality (camera, sensors, system APIs) to an Expo app
  • Wrapping platform SDKs for React Native consumption
  • Building config plugins that modify native project files

References

Consult these resources as needed:

references/
  native-module.md           Module definition DSL: Name, Function, AsyncFunction, Property, Constant, Events, type system, shared objects
  native-view.md             Native view components: View, Prop, EventDispatcher, view lifecycle, ref-based functions
  lifecycle.md               Lifecycle hooks: module, iOS app/AppDelegate, Android activity/application listeners
  config-plugin.md           Config plugins: modifying Info.plist, AndroidManifest.xml, reading values in native code
  module-config.md           expo-module.config.json fields and autolinking configuration

Quick Start

Create a Local Module (in existing app)

Always scaffold with create-expo-module first, then modify the generated code. This ensures correct podspec, build.gradle, and module config — avoiding common build errors.

CI=1 npx create-expo-module@latest --local \
  --name MyModule \
  --description "My Expo module" \
  --package expo.modules.mymodule

CI=1 skips interactive prompts and uses the provided flags.

Important: In CI=1 (non-interactive) mode, the scaffold always creates the directory as modules/my-module/ because the slug is derived from customTargetPath which is undefined for --local modules — the --name flag only sets the native class name, not the directory. After scaffolding, rename it to a kebab-case name matching your module (e.g., KeyValueStoremodules/key-value-store/), then run cd ios && pod install so CocoaPods picks up the correct path. Skipping the rename is fine functionally, but skipping pod install after any rename causes iOS build failures ("Build input file cannot be found").

Available flags:

FlagDescriptionExample
--nameNative module name (PascalCase)--name KeyValueStore
--descriptionModule description--description "Native key-value storage"
--packageAndroid package name--package expo.modules.keyvaluestore
--author-nameAuthor name--author-name "dev"
--author-emailAuthor email--author-email "dev@example.com"
--author-urlAuthor profile URL--author-url "https://github.com/dev"
--repoRepository URL--repo "https://github.com/dev/repo"

The scaffold generates both a native module (functions, events, constants) and a native view component (WebView example with props and events). After scaffolding:

  1. Decide what you need: If you only need a native module (no UI), remove the view files. If you only need a native view, remove the module function boilerplate. If you need both, keep both and replace the implementations.
  2. Remove unnecessary boilerplate: The scaffold includes example code (hello() function, PI constant, onChange event, WebView-based view with url prop). Strip all of this and replace with your actual implementation.
  3. Remove web files if not needed: The scaffold generates *.web.ts/*.web.tsx files for web platform support. Remove these if the module is native-only. Also remove "web" from the platforms array in expo-module.config.json.

What to remove for a module-only (no native view):

  • Delete ios/MyModuleView.swift, android/.../MyModuleView.kt
  • Delete src/MyModuleView.tsx, src/MyModuleView.web.tsx
  • Remove the View(...) block from the module definition in both Swift and Kotlin
  • Remove view-related types from MyModule.types.ts and view export from index.ts

What to remove for a view-only (no module functions):

  • Remove Function, AsyncFunction, Constant, Events blocks from the module definition (keep Name and View)
  • Simplify the TypeScript module file to only export the view

Generated structure (after renaming from my-module to your module's kebab-case name):

modules/
  my-module/                     # Rename to kebab-case, e.g. key-value-store/
    android/
      build.gradle
      src/main/java/expo/modules/mymodule/
        MyModule.kt              # Module definition (functions, events, view registration)
        MyModuleView.kt          # Native view (ExpoView subclass)
    ios/
      MyModule.podspec
      MyModule.swift             # Module definition
      MyModuleView.swift         # Native view (ExpoView subclass)
    src/
      MyModule.ts                # Native module binding
      MyModule.web.ts            # Web implementation
      MyModule.types.ts          # Shared types
      MyModuleView.tsx           # Native view component
      MyModuleView.web.tsx       # Web view component
    expo-module.config.json
    index.ts                     # Re-exports module + view

Create a Standalone Module (for publishing)

npx create-expo-module@latest my-module

Module Structure Reference

The Swift and Kotlin DSL share the same structure. Both platforms are shown here for reference — in other reference files, Swift is shown as the primary language unless the Kotlin pattern meaningfully differs.

Swift (iOS):

import ExpoModulesCore

public class MyModule: Module {
  public func definition() -> ModuleDefinition {
    Name("MyModule")

    Function("hello") { (name: String) -> String in
      return "Hello \(name)!"
    }
  }
}

Kotlin (Android):

package expo.modules.mymodule

import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition

class MyModule : Module() {
  override fun definition() = ModuleDefinition {
    Name("MyModule")

    Function("hello") { name: String ->
      "Hello $name!"
    }
  }
}

TypeScript:

import { requireNativeModule } from "expo";

const MyModule = requireNativeModule("MyModule");

export function hello(name: string): string {
  return MyModule.hello(name);
}

expo-module.config.json

{
  "platforms": ["android", "apple"],
  "apple": {
    "modules": ["MyModule"]
  },
  "android": {
    "modules": ["expo.modules.mymodule.MyModule"]
  }
}

Note: iOS uses just the class name; Android uses the fully-qualified class name (package + class). See references/module-config.md for all fields.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.26%
按下载量换算13,497

Claude

29.14%
按下载量换算10,847

Cursor

18.06%
按下载量换算6,723

Gemini CLI

9.97%
按下载量换算3,711

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills