/capacitor-core:capacitor-expertfrom capacitor-core
Comprehensive reference for building cross-platform apps with Capacitor. Covers architecture, CLI, plugins, framework integration, best practices, and Capawesome Cloud for Capacitor 6-8.
Ships in capacitor-core. 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.
Comprehensive reference for building cross-platform apps with Capacitor. Covers architecture, CLI, plugins, framework integration, best practices, and Capawesome Cloud.
This file is an overview. Each section names the skill that holds the exact procedure. Read that skill before changing a project.
Two hosted MCP servers serve the current documentation, so both are always ahead of the guidance bundled with this skill:
capacitor.config file, the native Android and iOS projects, and the official plugin APIs.Both expose search_docs and get_doc_page, so pick the server by topic before calling either.
search_docs on the server that owns the topic and read the matching page with get_doc_page before applying the guidance below. Where the two disagree, follow the documentation.claude mcp add --transport http capawesome "https://mcp.capawesome.io/mcp"
claude mcp add --transport http capacitor "https://capacitor-mcp.capawesome.io/mcp"
Neither server needs an account or a token for documentation. See the capawesome-mcp and capacitor-mcp skills for full setup, including the Capawesome Cloud tools.
Capacitor is a cross-platform native runtime for building web apps that run natively on iOS, Android, and the web. The web app runs in a native WebView, and Capacitor provides a bridge to native APIs via plugins.
This skill covers Capacitor 6, 7 and 8. Capacitor 9 is not covered by this skill yet. Read the version of the project from @capacitor/core in package.json and use the values of that version.
| Capacitor | Node.js | Xcode | Android Studio | JDK | iOS deployment target | Android minSdkVersion |
|---|---|---|---|---|---|---|
| 6 | 18+ | 15.0+ | Hedgehog 2023.1.1+ | 17 | 13.0 | 22 |
| 7 | 20+ | 16.0+ | Ladybug 2024.2.1+ | 21 | 14.0 | 23 |
| 8 | 22+ | 26.0+ | Otter 2025.2.1+ | 21 | 15.0 | 24 |
Facts about Capacitor 8:
npx cap add ios --packagemanager CocoaPods.compileSdkVersion and targetSdkVersion are 36.SystemBars plugin ships with @capacitor/core and handles edge-to-edge insets on Android.npx cap doctor lists the blocked packages.A Capacitor app has three layers:
Data passed across the bridge must be JSON-serializable. Pass files as paths, not base64.
my-app/
android/ # Native Android project (committed to VCS)
ios/ # Native iOS project (committed to VCS)
App/
App/ # iOS app source files
App.xcodeproj/
CapApp-SPM/ # SPM projects: managed by the Capacitor CLI, do not edit
Podfile # CocoaPods projects only
src/ # Web app source code
dist/ or www/ or build/ # Built web assets
capacitor.config.ts # Capacitor configuration
package.json
The android/ and ios/ directories are full native projects -- they are committed to version control and can be modified directly.
capacitor.config.ts (preferred) or capacitor.config.json controls app behavior:
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.example.app',
appName: 'My App',
webDir: 'dist',
};
export default config;
Run npx cap sync after every change to this file. For details, see App Configuration.
# 1. Create a web app (React example with Vite)
npm create vite@latest my-app -- --template react-ts
cd my-app && npm install
# 2. Install Capacitor 8
npm install @capacitor/core@8
npm install -D @capacitor/cli@8
# 3. Initialize Capacitor
npx cap init "My App" com.example.myapp --web-dir dist
# 4. Build web assets
npm run build
# 5. Add platforms
npm install @capacitor/android@8 @capacitor/ios@8
npx cap add android
npx cap add ios
# 6. Sync and run
npx cap sync
npx cap run android --list
npx cap run android --target <DEVICE_ID>
Pass the name, the app ID and --web-dir to npx cap init, and --target to npx cap run. Without them the commands ask questions in the terminal.
The npm tag latest of the official Capacitor packages no longer fits a Capacitor 8 project, so always pin the version.
Web asset directories by framework:
dist/<project-name>/browser (Angular 17+ with application builder)distdistwwwFor the full guided creation flow, see capacitor-app-creation.
All commands: npx cap <command>. Most important commands:
| Command | Purpose |
|---|---|
npx cap init <name> <id> --web-dir <dir> | Initialize Capacitor in a project |
npx cap add <platform> | Add Android or iOS platform |
npx cap sync | Copy web assets + update native dependencies (run after every plugin install, config change, or web build) |
npx cap copy | Copy web assets only (faster, no native dependency update) |
npx cap run <platform> --target <id> | Sync, build, and deploy to device/emulator |
npx cap run <platform> --live-reload --port <port> | Run with live reload against a running dev server |
npx cap open <platform> | Open native project in IDE |
npx cap build <platform> | Build a signed AAB, APK or IPA |
npx cap doctor | Diagnose configuration issues |
npx cap ls | List installed plugins |
For the full CLI reference, see CLI Reference.
Capacitor works with any web framework. Framework-specific patterns:
NgZone.run(). In a zoneless app (the default since Angular 21), update a signal or call ChangeDetectorRef.markForCheck() instead.ngOnInit, remove in ngOnDestroy.For details, see capacitor-angular.
useCamera, useNetwork) that wrap Capacitor plugins.useEffect for listener registration with cleanup to prevent memory leaks.For details, see capacitor-react.
useCamera, useNetwork) using Vue 3 Composition API.onMounted, remove in onUnmounted.ref changes automatically (no NgZone equivalent needed).For details, see capacitor-vue.
Plugins are Capacitor's extension mechanism. Each plugin exposes a JS API backed by native implementations.
@capacitor/*) -- Camera, Filesystem, Geolocation, Preferences, etc.@capawesome/*, @capawesome-team/*) -- Live Update, File Picker, SQLite, NFC, Biometrics, etc.@capacitor-community/*) -- AdMob, BLE, SQLite, Stripe, etc.@capacitor-firebase/*) -- Analytics, Auth, Messaging, Firestore, etc.@capacitor-mlkit/*) -- Barcode scanning, face detection, translation.@revenuecat/purchases-capacitor) -- In-app purchases.Some Capawesome plugins are Premium SDKs, for example SQLite, Secure Preferences, Biometrics, NFC and Purchases. The offering was called Capawesome Insiders before. Premium SDKs are part of the Capawesome Cloud plans: the Standard plan includes one Premium SDK of the customer's choice, the Advanced plan includes all of them.
To install one, three things must be true:
https://npm.registry.capawesome.io.The step "Set Up Access to a Premium SDK" (Step 4) of the capacitor-plugins skill holds the exact setup. Its file premium-sdk-setup.md describes it. Follow it before any install of a Premium SDK. Never run npm config set for the registry or the key, never print a license key and never write its value into a file.
npm install @capacitor/camera@8
npx cap sync
Pin every official @capacitor/* plugin to the Capacitor version of the project (@capacitor/core in package.json). The example is for Capacitor 8. A few official plugins count their versions in another way. The reference files of the capacitor-plugins skill name the version to install. After installation, apply any required platform configuration (permissions in AndroidManifest.xml, Info.plist entries, etc.) as documented by the plugin.
import { Camera, CameraResultType } from '@capacitor/camera';
const photo = await Camera.getPhoto({
quality: 90,
resultType: CameraResultType.Uri,
});
For the full plugin index and setup guides, see capacitor-plugins.
Create custom Capacitor plugins with native iOS (Swift) and Android (Java/Kotlin) implementations:
npm init @capacitor/[email protected]. Version 0.22.0 of the generator creates a plugin for Capacitor 8. The generator asks questions in the terminal. Pass its command-line options to avoid them.src/definitions.ts.src/web.ts.ios/Sources/.android/src/main/java/.npm run verify.Key rules:
registerPlugin() name in src/index.ts must match jsName on iOS and @CapacitorPlugin(name = "...") on Android.@objc and must be listed in pluginMethods (CAPBridgedPlugin).@PluginMethod() annotation and must be public.For full details, see capacitor-plugin-development.
import { Capacitor } from '@capacitor/core';
const platform = Capacitor.getPlatform(); // 'android' | 'ios' | 'web'
if (Capacitor.isNativePlatform()) { /* native-only code */ }
if (Capacitor.isPluginAvailable('Camera')) { /* plugin available */ }
With the Capawesome desktop platforms, getPlatform() returns 'electron' or 'tauri'. See capacitor-platforms.
Follow the check-then-request pattern:
const status = await Camera.checkPermissions();
if (status.camera !== 'granted') {
const requested = await Camera.requestPermissions();
if (requested.camera === 'denied') {
// Guide user to app settings -- cannot re-request on iOS
return;
}
}
const photo = await Camera.getPhoto({ ... });
Always wrap plugin calls in try-catch. Prefer the code of an error over its message where a plugin documents error codes:
try {
const photo = await Camera.getPhoto({ resultType: CameraResultType.Uri });
} catch (error) {
if (error.message === 'User cancelled photos app') {
// Not an error
} else {
console.error('Camera error:', error);
}
}
For full details, see Cross-Platform Best Practices.
Android enforces edge-to-edge for apps that target SDK 35 or later. On Capacitor 8.6.1 or later no plugin is needed:
viewport-fit=cover to the viewport meta tag in index.html.var(--safe-area-inset-top, env(safe-area-inset-top, 0px)).SystemBars API of @capacitor/core for the style and the visibility of the system bars.For full setup, see Edge-to-Edge and Safe Area.
Deep links open specific content in the app from external URLs.
apple-app-site-association hosted at https://<domain>/.well-known/.assetlinks.json hosted at https://<domain>/.well-known/.import { App } from '@capacitor/app';
App.addListener('appUrlOpen', (event) => {
const path = new URL(event.url).pathname;
// Route to the appropriate page
});
applinks:<domain> to the com.apple.developer.associated-domains array in the entitlements file of the app. The Deep Links guide below holds the steps to find that file, or to create it and add CODE_SIGN_ENTITLEMENTS to project.pbxproj when the app has none.<intent-filter android:autoVerify="true"> to android/app/src/main/AndroidManifest.xml.For full setup, see Deep Links.
| Requirement | Solution |
|---|---|
| App settings, preferences | @capacitor/preferences (native key-value, persists reliably) |
| Sensitive data (tokens, credentials) | @capawesome-team/capacitor-secure-preferences (Keychain/Keystore, Premium SDK) |
| Relational data, offline-first | SQLite (@capawesome-team/capacitor-sqlite, a Premium SDK, or @capacitor-community/sqlite) |
| Files, images, documents | @capacitor/filesystem |
| Downloads and uploads of files | @capacitor/file-transfer (Filesystem.downloadFile() is deprecated) |
Do NOT use localStorage, IndexedDB, or cookies for data that must persist -- the OS can evict them (especially on iOS).
For details, see Storage.
capacitor.config.ts -- move to a server API.@capawesome-team/capacitor-secure-preferences) for tokens and credentials, not localStorage or @capacitor/preferences.<meta> CSP tag in index.html.webContentsDebuggingEnabled is false by default. Never set it to true for a store build.ios/App/App/PrivacyInfo.xcprivacy): App Store Connect requires approved reasons for certain APIs. A new project does not contain the file. It has to be created.For details, see Security.
Mock Capacitor plugins in Jest/Vitest since tests run in Node.js, not a WebView:
vi.mock('@capacitor/camera', () => ({
Camera: {
getPhoto: vi.fn().mockResolvedValue({
webPath: 'https://example.com/photo.jpg',
}),
},
}));
chrome://inspect in Chrome. On iOS, use Safari > Develop menu > select device.For details, see Testing.
npx cap sync fails: Verify @capacitor/core and @capacitor/cli versions match. Run cd android && ./gradlew clean.cd android && ./gradlew clean, then rebuild.npx cap sync after plugin installation. Verify with npx cap ls android.ANDROID_HOME is set.minifyEnabled true: See capacitor-android-dex-optimization.npx cap sync ios. For CocoaPods: cd ios/App && pod install --repo-update.webDir in capacitor.config.ts matches the actual build output directory.0.0.0.0.npx cap sync. Verify plugin is in package.json dependencies.Capacitor is not defined: Install @capacitor/core in the major version of @capacitor/cli in package.json. For Capacitor 8: npm install @capacitor/core@8.For full troubleshooting, see Android Troubleshooting and iOS Troubleshooting.
Apply each major version jump one after the other -- do not skip intermediate versions. The table in "Versions" above lists the tools each version needs. Capacitor 5 needs Node.js 16+, Xcode 14.1+ and Android Studio Flamingo 2022.2.1+.
Do not run npx cap migrate. It is an interactive command that cannot be invoked by an agent. Apply all upgrade steps manually using the per-version reference files.
Inside Capacitor 8, the step from 8.4 to 8.5 changes the iOS project (UIScene lifecycle). Guide: https://capacitorjs.com/docs/updating/8-5
For app upgrades, see capacitor-app-upgrades. For plugin upgrades, see capacitor-plugin-upgrades. To move an iOS project from CocoaPods to SPM, see capacitor-app-spm-migration.
Capawesome Cloud is a mobile DevOps platform for Capacitor apps. Its products are Live Updates, Native Builds, App Store Publishing and Automations. Every plan includes Live Updates, Native Builds and App Store Publishing. The plans also include Premium SDKs. See https://capawesome.io/pricing/ for the plans. It is used through the Console, the Capawesome CLI, the API, or the Capawesome MCP server.
Ionic stopped selling Appflow to new customers in February 2025, and the service ends on December 31, 2027. For an existing Appflow project, see ionic-appflow-migration.
Read references/capawesome-cloud.md for the commands and the Live Update configuration before running any of them. The most used ones, in the form that asks no questions in the terminal:
| Task | Command |
|---|---|
| Create an app | npx @capawesome/cli apps:create --name "My App" --organization-id <ORGANIZATION_ID> --yes --json |
| Publish a Live Update | npx @capawesome/cli apps:liveupdates:upload --app-id <APP_ID> --path <WEB_ASSETS_DIR> --channel <CHANNEL> --yes |
| Connect the Git repository | npx @capawesome/cli apps:link --app-id <APP_ID> |
| Build from a Git ref | npx @capawesome/cli apps:builds:create --app-id <APP_ID> --platform android --type debug --git-ref main --yes --json |
| Build from the local folder | npx @capawesome/cli apps:builds:create --app-id <APP_ID> --platform android --type debug --path . --yes --json |
| Submit a build to a store | npx @capawesome/cli apps:deployments:create --app-id <APP_ID> --build-id <BUILD_ID> --destination <DESTINATION_NAME> |
| Build on every push to a branch | npx @capawesome/cli apps:automations:create --app-id <APP_ID> --name "Android release" --platform android --type release --trigger-type branch --trigger-pattern main --json |
<WEB_ASSETS_DIR> is the webDir of capacitor.config, for example dist, www or dist/<project-name>/browser.npx @capawesome/cli login opens a browser, so the user has to run it. In CI, set the API token as the environment variable CAPAWESOME_TOKEN. The CLI reads it on its own.@capawesome/capacitor-live-update. Its auto-update option is autoUpdateStrategy: 'background'. A Live Update can only change the web layer.For full Capawesome Cloud setup, see capawesome-cloud. For the Capawesome CLI reference, see capawesome-cli.
Set up push notifications using Firebase Cloud Messaging (FCM) via @capacitor-firebase/messaging. The plugin major version must match the Capacitor major version. For Capacitor 8: npm install @capacitor-firebase/messaging@8 firebase@^12.6.0.
Requires Firebase project setup, platform-specific configuration (APNs for iOS, google-services.json for Android), and permission handling. @capacitor/push-notifications must not be installed at the same time.
For the full setup guide, see capacitor-push-notifications.
Set up in-app purchases and subscriptions with either:
@capawesome-team/capacitor-purchases): Uses StoreKit 2 and the Google Play Billing Library directly, with no third-party backend. It is a Premium SDK and requires Capacitor 8.@revenuecat/purchases-capacitor) -- full managed backend with receipt validation, analytics, and integrations.Both require App Store Connect (iOS) and/or Google Play Console (Android) product configuration.
For the full setup guide, see capacitor-in-app-purchases.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
capacitor, cross-platform, mobile-apps, capawesome-cloud, native-plugins
npx claudepluginhub capawesome-team/skills --plugin capacitor-core8 skills in this plugin
/capacitor-app-creationGuides the agent through creating a new Capacitor app from scratch. Covers project scaffolding with the Capacitor CLI, configuring the app (appId, appName, webDir), adding native platforms (iOS, Android), and syncing. Includes decision points for Ionic Framework integration, live updates, and CI/CD setup. Do not use for upgrading existing Capacitor apps, migrating from other frameworks, or plugin installation./capacitor-app-developmentGuides the agent through general Capacitor app development topics. Covers core concepts (native bridge, plugins, web layer), Capacitor CLI usage, app configuration (capacitor.config.ts, splash screens, app icons, deep links), platform management (Android, iOS, Electron, Tauri, PWA), edge-to-edge and safe area handling with the SystemBars API, live reload setup, storage solutions, file handling, security best practices, CI/CD references, iOS package managers (SPM, CocoaPods), the UIScene lifecycle of Capacitor 8.5, and troubleshooting for Android and iOS. Do not use for creating new Capacitor apps, Capacitor plugin APIs, creating Capacitor plugins, in-app purchases, upgrading Capacitor versions, Cordova or PhoneGap migration, or framework-specific patterns (Angular, React, Vue)./capacitor-app-spm-migrationGuides the agent through migrating an existing Capacitor app project from CocoaPods to Swift Package Manager (SPM) for iOS dependency management. Covers prerequisite checks, inventorying installed Capacitor plugins, backing up customized iOS project files (Info.plist, AppDelegate.swift, Assets.xcassets, Base.lproj, App.entitlements, GoogleService-Info.plist, .xcconfig files, signing configuration), deleting the existing `ios/` folder, re-scaffolding with `npx cap add ios --packagemanager SPM`, restoring preserved files, re-syncing plugins, and verifying the build. Performs all migration steps manually — does not use the interactive `npx cap spm-migration-assistant` command. Do not use for Capacitor plugin projects, app projects already on SPM, app projects without an existing `ios/` folder, or non-Capacitor mobile frameworks./capacitor-app-upgradesGuides the agent through upgrading a Capacitor app project to a newer major version. Supports upgrades from Capacitor 4 through 8, including multi-version jumps. Also covers the Capacitor 8.5 update that moves an iOS app to the UIScene lifecycle, which Xcode 27 requires. Performs all upgrade steps by hand and does not use the `npx cap migrate` command. Do not use for plugin library upgrade or non-Capacitor mobile frameworks./capacitor-mcpGuides the agent through connecting an MCP client to the hosted, unofficial Capacitor MCP server by Capawesome, which serves the official Capacitor documentation for v8, v7, v6 and next, the official and community plugin list, and the Capacitor posts from the Ionic blog. Covers client detection, setup for Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Zed and stdio-only clients, documentation version selection, verification, and troubleshooting. Do not use for installing or configuring Capacitor plugins, upgrading or migrating apps and plugins to a newer version, Ionic Framework UI components, Capawesome Cloud, or MCP servers other than the Capacitor one./capacitor-platformsGuides the agent through adding, configuring, and using the Capawesome desktop platforms for Capacitor — @capawesome/capacitor-electron and @capawesome/capacitor-tauri. Covers choosing between Electron and Tauri, installation and scaffolding, sync/run workflows, live reload, deep links, splash screens, tray icons, plugin compatibility (Electron plugin implementations and web fallback; Tauri plugin tiers), packaging, app updates including Capawesome Cloud Live Updates on Electron, monorepo setup, and the migration from @capacitor-community/electron. Do not use for the Android or iOS platforms, installing individual Capacitor plugins, migrating Capacitor apps or plugins to newer versions, or non-Capacitor desktop frameworks.Other plugins' skills for the same job