/capacitor-plugin-dev:capacitor-plugin-developmentfrom capacitor-plugin-dev
Guides creating and maintaining Capacitor plugins from scratch: scaffolding, TypeScript API design, native iOS (Swift) and Android (Java/Kotlin) bridges, web layer, type definitions, configuration, hooks, local testing, documentation, and npm publishing.
Ships in capacitor-plugin-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Create and maintain Capacitor plugins — scaffolding, native API bridging (iOS/Android), type definitions, testing, and publishing.
This skill creates a Capacitor 8 plugin. It runs the plugin generator in the pinned version 0.22.0, which creates a plugin for Capacitor 8. Capacitor 9 is not covered by this skill yet.
| Requirement | Version |
|---|---|
| Node.js | 22+ |
| npm | 6+ |
| Xcode | 26+ (for iOS) |
| Android Studio | Otter 2025.2.1+ (for Android) |
| Capacitor | 8 |
To maintain an existing plugin on an older Capacitor major version, use the tool versions of that version. To move a plugin to a newer Capacitor major version, use the capacitor-plugin-upgrades skill.
package.json, inspect the directory structure, and infer the plugin's current state before prompting the user.Ask the user what they want to do. Common tasks:
references/plugin-configuration.md and apply.references/testing-and-workflow.md (Plugin Hooks section) and apply.If the user's intent is clear from context, skip this question and proceed directly.
Read references/scaffolding.md and guide the user through generating a new plugin project using the Capacitor plugin generator.
Gather the following from the user (or infer from context):
java or kotlin)Run the generator with all options and with the pinned version, as shown in references/scaffolding.md. In a shell without a terminal, the generator exits with an error when a value is missing or invalid. Do not use the latest tag of the generator. It can create a plugin for a newer Capacitor major version than this skill covers. After the run, confirm that @capacitor/core in devDependencies of the generated package.json is ^8.0.0. Check the generated example app as described in the section "Check the Example App" of references/scaffolding.md. Then verify the scaffold with npm run verify.
Read references/designing-api.md and guide the user through defining the plugin interface.
src/definitions.ts.src/index.ts using registerPlugin().Ensure:
@since tags.Read references/web-guide.md and implement the web layer in src/web.ts.
WebPlugin and implement the plugin interface.this.unimplemented().this.unavailable() if missing.After implementation, build and verify:
npm run build
npm run verify:web
Before implementing native code, determine the method types for each plugin method:
| Type | TypeScript | iOS | Android |
|---|---|---|---|
| Promise (resolves once, with a value or with nothing) | Promise<T> or Promise<void> | CAPPluginReturnPromise | @PluginMethod() |
| None (JavaScript gets no response) | never | CAPPluginReturnNone | @PluginMethod(returnType = PluginMethod.RETURN_NONE) |
| Callback (repeated) | (callback) => Promise<string> | CAPPluginReturnCallback | @PluginMethod(returnType = PluginMethod.RETURN_CALLBACK) |
Most methods use the promise type. This includes methods that return Promise<void>: JavaScript awaits them, so the native side must resolve or reject the call. Use "none" only for a method whose result JavaScript never awaits. Use "callback" only for continuous data streams (e.g., geolocation watching).
Read references/ios-guide.md and implement the iOS layer.
ios/Sources/<ClassName>Plugin/Example.swift) with the platform logic. Extend NSObject and mark methods with @objc.ios/Sources/<ClassName>Plugin/ExamplePlugin.swift):
CAPPlugin and conform to CAPBridgedPlugin.identifier, jsName, and pluginMethods properties.@objc func method, reading data from CAPPluginCall and calling resolve(), reject(), unavailable(), or unimplemented().Package.swift (Swift Package Manager) and the .podspec file (CocoaPods). A generated plugin supports both package managers.checkPermissions() and requestPermissions(), list both in pluginMethods, and document the required Info.plist keys.After implementation, verify:
npm run verify:ios
Read references/android-guide.md and implement the Android layer.
A plugin that was generated with --android-lang kotlin has its sources in android/src/main/kotlin/<package-path>/ with the file extension .kt.
android/src/main/java/<package-path>/Example.java) with the platform logic.android/src/main/java/<package-path>/ExamplePlugin.java):
Plugin and add @CapacitorPlugin(name = "<JSName>").@PluginMethod method, reading data from PluginCall and calling resolve(), reject(), unavailable(), or unimplemented().android/build.gradle.@CapacitorPlugin annotation.checkPermissions() and requestPermissions().AndroidManifest.xml.After implementation, verify:
npm run verify:android
If the plugin emits events to JavaScript:
addListener() and removeAllListeners() methods to the plugin interface in src/definitions.ts. Define an event interface for each event type.this.notifyListeners('eventName', data) when the event occurs.self.notifyListeners("eventName", data: [...]) when the event occurs. Register observers in load() if listening to system notifications.notifyListeners("eventName", jsObject) when the event occurs. Override handleOnConfigurationChanged() or register broadcast receivers as needed.Ensure the event name string is identical across all platforms and matches the eventName parameter in addListener().
src/definitions.ts if not already present.npm run docgen
npm run verify
npm run lint
npm run fmt
Read references/publishing.md and guide the user through the publishing process.
package.json fields are correct (name, version, description, files, capacitor).npm publish --access public
node -v and npm -v to check.package.json has @capacitor/core in a major version other than 8: The generator ran in another version than 0.22.0. Delete the generated folder and run the pinned command from references/scaffolding.md again.references/scaffolding.md.npm run verify:ios fails with "module not found": In a generated plugin, verify:ios builds the Swift package from Package.swift. Check that the missing module is listed in Package.swift, both as a .package(...) entry in dependencies and as a .product(...) entry in the dependencies of the target. In a plugin with the old structure (the file ios/Podfile exists), run cd ios && pod install --repo-update && cd .. to install CocoaPods dependencies.npm run verify:android fails with build errors: Open android/ in Android Studio, sync Gradle, and check for missing dependencies or SDK version mismatches.npm run build fails with TypeScript errors: Check src/definitions.ts for type mismatches. Ensure the web implementation in src/web.ts correctly implements the plugin interface.registerPlugin() name mismatch: The first argument to registerPlugin() in src/index.ts must exactly match the jsName property on iOS and the @CapacitorPlugin(name = "...") value on Android. A mismatch causes the plugin to not load.@objc and listed in the pluginMethods array of CAPBridgedPlugin.@PluginMethod() annotation and are public.notifyListeners() call and the TypeScript addListener() definition. Verify addListener() is called before the event fires.getConfig().getString("key") match the keys in the Capacitor config file under plugins.<PluginJSName>.npm run docgen produces empty output: Ensure JSDoc comments are present on the plugin interface methods in src/definitions.ts, not on the implementation classes.capacitor-plugin-spm-support — Add Swift Package Manager support to a Capacitor plugin.capacitor-plugin-upgrades — Upgrade a Capacitor plugin to a newer Capacitor major version.capacitor-plugins — Install and configure existing Capacitor plugins in an app project.references/android-guide.md (opens in a new tab)references/designing-api.md (opens in a new tab)references/ios-guide.md (opens in a new tab)references/plugin-configuration.md (opens in a new tab)references/publishing.md (opens in a new tab)references/scaffolding.md (opens in a new tab)references/testing-and-workflow.md (opens in a new tab)references/web-guide.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub capawesome-team/skills --plugin capacitor-plugin-dev3 skills in this plugin
/capacitor-plugin-spm-supportGuides the agent through adding Swift Package Manager (SPM) support to an existing Capacitor plugin. Covers creating a Package.swift manifest for Capacitor 6 through 8, replacing Objective-C bridge files with the CAPBridgedPlugin Swift protocol, updating .gitignore for SPM artifacts, cleaning up the Xcode project file, and updating package.json. Do not use for Capacitor app projects, creating new plugins from scratch, or non-Capacitor plugin frameworks./capacitor-plugin-upgradesGuides the agent through upgrading a Capacitor plugin to a newer major version. Supports upgrades from Capacitor 4 through 8, including multi-version jumps. Covers automated upgrade via official migration tools, Android SDK targets, Gradle configuration, Java/Kotlin versions, iOS deployment targets, the iOS UIScene lifecycle audit for Capacitor 8.5, and manual step-by-step fallback for each version. Do not use for app project upgrade or non-Capacitor plugin frameworks.Other plugins' skills for the same job