/capacitor-core:capacitor-app-spm-migrationfrom capacitor-core
Migrates a Capacitor app project from CocoaPods to Swift Package Manager (SPM) for iOS dependency management. Backs up customized iOS files, deletes and re-scaffolds the ios/ folder, restores preserved files, re-syncs plugins, and verifies the build. Requires Capacitor 6+ and does not use the interactive migration assistant.
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.
None: SKILL.md is the whole skill.
Migrate an existing Capacitor app project's iOS dependency management from CocoaPods to Swift Package Manager (SPM). The migration is destructive — the existing ios/ folder is deleted and re-scaffolded, then user-authored files are restored from a temporary backup.
Capacitor 6 or later is required. Node.js and Xcode must match the installed Capacitor major version:
| Capacitor | Node.js | Xcode |
|---|---|---|
| 6 | 18+ | 15+ |
| 7 | 20+ | 16+ |
| 8 | 22+ | 26+ |
Capacitor 9 is not covered by this skill yet.
CocoaPods does not need to be installed. No step of this skill runs pod.
The project must be a Capacitor app (not a plugin) and must currently use CocoaPods (ios/App/Podfile exists).
Since Capacitor 8, npx cap add ios creates a Swift Package Manager project by default. In Capacitor 6 and 7 the option --packagemanager SPM is required. This skill always passes the option.
package.json lists @capacitor/ios in dependencies and the project root contains a capacitor.config.* file.ios/App/Podfile must exist. If it does not exist and ios/App/CapApp-SPM/Package.swift exists, the project is already on SPM — abort and inform the user.@capacitor/core version from package.json (dependencies or devDependencies). Confirm the major version is 6 or higher. If lower, abort and direct the user to the capacitor-app-upgrades skill first.git status --porcelain — if the output is non-empty, instruct the user to commit or stash changes before proceeding. The migration is destructive and must be reversible via git checkout.npm ls @capacitor/ios. If the version is 8.5.0 or later and ios/App/App/Info.plist has no key UIApplicationSceneManifest, the app is still on the old iOS lifecycle. The migration works, and the app stays on the old lifecycle. Tell the user that Xcode 27 needs the UIScene lifecycle, which the capacitor-app-upgrades skill adds (reference upgrade-v8-to-v8-5.md). It can be applied before or after this migration. The signal is always the key UIApplicationSceneManifest in Info.plist, never the file SceneDelegate.swift. The new scaffold of Step 7 can bring its own SceneDelegate.swift, while the Info.plist and the AppDelegate.swift that Step 8 restores are still the old ones.Read package.json and record every installed Capacitor plugin under dependencies. Match these prefixes:
@capacitor/* (official plugins)@capawesome/* and @capawesome-team/*@capacitor-community/*@capacitor-firebase/*@capacitor-mlkit/*@revenuecat/*"capacitor" in its package.json keywords arrayRecord each plugin's package name and installed version. This list is used in Step 8 to verify all plugins resolve under SPM after re-sync.
Build a checklist of files in ios/ that contain user-authored content and must survive the re-scaffold. For each path below, check whether the file exists. Record only the paths that exist.
| Path (relative to project root) | Purpose |
|---|---|
ios/App/App/Info.plist | App permissions, URL schemes, bundle config, custom keys |
ios/App/App/AppDelegate.swift | Custom app lifecycle code |
ios/App/App/SceneDelegate.swift | Custom scene lifecycle code (if present) |
ios/App/App/Assets.xcassets/ | App icon, splash assets, color sets |
ios/App/App/Base.lproj/ | LaunchScreen and Main storyboards |
ios/App/App/App.entitlements | Push, App Groups, Associated Domains, Keychain Sharing |
ios/App/App/GoogleService-Info.plist | Firebase configuration (if Firebase plugins are installed) |
ios/App/App/*.xcconfig | Build configuration overrides |
ios/App/App.xcodeproj/project.pbxproj | Source for extracting signing values in Step 5 |
Additionally, scan ios/App/App/ for any other .swift files beyond AppDelegate.swift and SceneDelegate.swift. These are user-authored Swift sources (e.g., custom Notification Service Extensions, custom view controllers) and must also be preserved.
If the project contains a Notification Service Extension or other Xcode targets under ios/App/ (e.g., ios/App/NotificationService/), record those directories as well.
Create the backup directory:
mkdir -p .spm-migration-backup
Add .spm-migration-backup/ to .gitignore to prevent accidental commits:
# iOS files
+.spm-migration-backup/
Copy each file recorded in Step 3 into .spm-migration-backup/, preserving the relative path. For example:
mkdir -p .spm-migration-backup/ios/App/App
cp ios/App/App/Info.plist .spm-migration-backup/ios/App/App/Info.plist
cp ios/App/App/AppDelegate.swift .spm-migration-backup/ios/App/App/AppDelegate.swift
cp -R ios/App/App/Assets.xcassets .spm-migration-backup/ios/App/App/Assets.xcassets
cp -R ios/App/App/Base.lproj .spm-migration-backup/ios/App/App/Base.lproj
Repeat for every file/directory identified in Step 3. Use cp -R for directories.
Always copy the full ios/App/App.xcodeproj/project.pbxproj to .spm-migration-backup/ios/App/App.xcodeproj/project.pbxproj, even though the file itself will not be restored. Step 5 reads it to extract signing values, and Step 11 may reference it for capability reconfiguration.
Read .spm-migration-backup/ios/App/App.xcodeproj/project.pbxproj and extract the values of the following build settings from the App target's XCBuildConfiguration blocks (both Debug and Release). Search for each key and record the assigned value:
PRODUCT_BUNDLE_IDENTIFIERDEVELOPMENT_TEAMCODE_SIGN_STYLE (e.g., Automatic or Manual)PROVISIONING_PROFILE_SPECIFIER (only if CODE_SIGN_STYLE = Manual)CODE_SIGN_IDENTITY (only if CODE_SIGN_STYLE = Manual)MARKETING_VERSIONCURRENT_PROJECT_VERSIONIPHONEOS_DEPLOYMENT_TARGETSWIFT_VERSIONAlso record the list of capabilities by reading .spm-migration-backup/ios/App/App/App.entitlements (if present). Note all top-level keys (e.g., aps-environment, com.apple.security.application-groups, com.apple.developer.associated-domains).
Save the extracted values in memory for use in Step 9.
ios/ FolderConfirm with the user that the working tree is committed (re-run git status --porcelain if necessary) and that .spm-migration-backup/ contains every file from Step 3. Then run:
rm -rf ios
Run:
npx cap add ios --packagemanager SPM
This creates a new ios/ directory with the SPM-based scaffold. The new structure includes ios/App/CapApp-SPM/Package.swift instead of ios/App/Podfile.
Copy each backed-up file from .spm-migration-backup/ back to its original path under ios/, overwriting the scaffolded defaults. For example:
cp .spm-migration-backup/ios/App/App/Info.plist ios/App/App/Info.plist
cp .spm-migration-backup/ios/App/App/AppDelegate.swift ios/App/App/AppDelegate.swift
cp -R .spm-migration-backup/ios/App/App/Assets.xcassets ios/App/App/Assets.xcassets
cp -R .spm-migration-backup/ios/App/App/Base.lproj ios/App/App/Base.lproj
Repeat for every file/directory backed up in Step 4, except ios/App/App.xcodeproj/project.pbxproj — that file is not restored. The new project.pbxproj is required for SPM integration; signing values from the old one are reapplied via Step 9.
If any preserved file did not exist in the new scaffold (e.g., App.entitlements, GoogleService-Info.plist, custom Swift files), the file must additionally be added to the Xcode project membership in Step 10.
Do not delete files of the new scaffold that have no backup, for example ios/App/App/SceneDelegate.swift. With Capacitor CLI 8.5 or later the scaffold has this file and registers it in the Xcode project. If the restored Info.plist has no key UIApplicationSceneManifest, the file is not used yet and the app stays on the old lifecycle. The reference upgrade-v8-to-v8-5.md of the capacitor-app-upgrades skill then adds the manifest and the hook in AppDelegate.swift and keeps this file.
The SPM scaffold has a key CAPACITOR_DEBUG in Info.plist that the CocoaPods scaffold does not have. The restored Info.plist has lost it. Capacitor reads this key to make the web view inspectable in debug builds. Add it again to ios/App/App/Info.plist, inside the top-level <dict>:
<dict>
+ <key>CAPACITOR_DEBUG</key>
+ <string>$(CAPACITOR_DEBUG)</string>
<key>CFBundleDevelopmentRegion</key>
Edit the new ios/App/App.xcodeproj/project.pbxproj and reapply the values extracted in Step 5. For each setting, find every occurrence in the App target's XCBuildConfiguration blocks and replace the scaffolded value with the recorded value.
Apply this diff pattern for each setting (example for PRODUCT_BUNDLE_IDENTIFIER):
- PRODUCT_BUNDLE_IDENTIFIER = com.example.app;
+ PRODUCT_BUNDLE_IDENTIFIER = <RECORDED_BUNDLE_ID>;
Settings to reapply (use replace_all semantics — update all occurrences across Debug and Release configurations):
PRODUCT_BUNDLE_IDENTIFIERDEVELOPMENT_TEAMCODE_SIGN_STYLEPROVISIONING_PROFILE_SPECIFIER (only if manual signing)CODE_SIGN_IDENTITY (only if manual signing)MARKETING_VERSIONCURRENT_PROJECT_VERSIONIf IPHONEOS_DEPLOYMENT_TARGET in the recorded values is higher than the scaffolded value, update it. If lower, keep the scaffolded value (the new scaffold targets a supported minimum).
The new project.pbxproj only references files that the scaffold created. Files restored in Step 8 that did not exist in the scaffold (e.g., App.entitlements, GoogleService-Info.plist, custom Swift files, Notification Service Extension targets) are present on disk but invisible to Xcode until they are added to the project's PBXBuildFile, PBXFileReference, and PBXGroup entries.
For each custom file that was not part of the scaffold, instruct the user to perform the following one-time action in Xcode (the SPM scaffold has no App.xcworkspace — open App.xcodeproj directly):
npx cap open ios (or open ios/App/App.xcodeproj).App group and choose Add Files to "App"….App.entitlements, GoogleService-Info.plist, custom .swift files).App target is checked.For the App.entitlements file specifically, also set the CODE_SIGN_ENTITLEMENTS build setting in ios/App/App.xcodeproj/project.pbxproj. Apply this diff pattern in both Debug and Release XCBuildConfiguration blocks for the App target:
CODE_SIGN_STYLE = Automatic;
+ CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CURRENT_PROJECT_VERSION = 1;
If the project had additional Xcode targets (e.g., a Notification Service Extension under ios/App/NotificationService/), the user must recreate those targets in Xcode. SPM scaffolding does not regenerate non-App targets. Inform the user explicitly.
For each capability key recorded from App.entitlements in Step 5, verify the corresponding capability is enabled in Xcode:
ios/App/App.xcodeproj via npx cap open ios.App target → Signing & Capabilities tab.aps-environment → Push Notificationscom.apple.security.application-groups → App Groupscom.apple.developer.associated-domains → Associated Domainskeychain-access-groups → Keychain Sharingcom.apple.developer.in-app-payments → Apple Paycom.apple.developer.icloud-services → iCloudThis is the only step that requires Xcode interaction. Inform the user explicitly that this step must be done manually.
Run:
npm install
npx cap sync ios
npx cap sync ios updates ios/App/CapApp-SPM/Package.swift to include every Capacitor plugin recorded in Step 2. Watch for warnings — any plugin without SPM support will be reported here.
Do not edit ios/App/CapApp-SPM/Package.swift by hand. The CLI rewrites it on every sync.
If a plugin is reported as incompatible with SPM, inform the user. The user must either:
capacitor-plugin-spm-support skill, orResolve the SPM packages from the command line:
xcodebuild -resolvePackageDependencies -project ios/App/App.xcodeproj -scheme App
Build for a simulator from the command line to confirm everything compiles:
xcodebuild -project ios/App/App.xcodeproj -scheme App -destination 'generic/platform=iOS Simulator' build
Run the app on a simulator or a device. List the targets first and pass one ID. Without --target the CLI asks for a device in the terminal when more than one is available.
npx cap run ios --list
npx cap run ios --target <ios-target-id>
Verify the app launches and that previously working features (push notifications, deep links, Firebase, etc.) still function. Ask the user to check the features that need a person.
Once the build is verified and the app runs correctly:
Delete the backup directory:
rm -rf .spm-migration-backup
Remove the .spm-migration-backup/ entry from .gitignore.
Verify no CocoaPods artifacts remain:
find ios -name 'Podfile*' -o -name 'Pods' -o -name 'App.xcworkspace'
If any results appear, delete them. The SPM workflow uses App.xcodeproj directly — there is no App.xcworkspace. Do not delete ios/App/App.xcodeproj/project.xcworkspace. It belongs to the Xcode project and holds the lock file of the Swift packages.
Commit the migration:
git add -A
git commit -m "chore(ios): migrate from CocoaPods to Swift Package Manager"
npx cap add ios --packagemanager SPM fails with "ios platform already exists" — Step 6 was not completed. Re-run rm -rf ios and retry.npx cap sync ios reports a plugin without SPM support — that plugin cannot be used under SPM until it ships a Package.swift. Inform the user and pause the migration; do not silently drop the plugin.npm install and npx cap sync ios, then xcodebuild -resolvePackageDependencies -project ios/App/App.xcodeproj -scheme App. If it still fails, run File → Packages → Reset Package Caches in Xcode, then File → Packages → Resolve Package Versions.CAPACITOR_DEBUG is missing in ios/App/App/Info.plist. Add it as described in Step 8..spm-migration-backup/ios/App/App.xcodeproj/project.pbxproj and confirm DEVELOPMENT_TEAM and PRODUCT_BUNDLE_IDENTIFIER were applied to both Debug and Release configurations.App.entitlements is not linked via CODE_SIGN_ENTITLEMENTS (Step 10).GoogleService-Info.plist was restored to disk but not added to the Xcode project's target membership in Step 10.App targets are not regenerated by npx cap add ios. Recreate the target manually in Xcode and re-add its source files.git checkout -- . followed by git clean -fd ios .spm-migration-backup.capacitor-plugin-spm-support — For adding SPM support to a Capacitor plugin (not an app). Use this if Step 12 reports a plugin without SPM support and the user controls that plugin's source.capacitor-plugins — For installing or reconfiguring Capacitor plugins after the migration.capacitor-app-upgrades — If the project is on Capacitor 5 or earlier, upgrade it to Capacitor 6+ first using this skill, then return here.capacitor-app-development — For general Capacitor app development topics, troubleshooting, and best practices after the migration.What SKILL.md sets; muted values are Claude Code's defaults
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-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-expertA comprehensive starting point for AI agents to work with Capacitor. Covers core concepts, version requirements for Capacitor 6 to 8, CLI, app creation, plugins and Premium SDKs, framework integration, best practices, storage, security, testing, troubleshooting, upgrading, the UIScene lifecycle of Capacitor 8.5, and Capawesome Cloud (live updates, native builds, app store publishing, automations). Pair with the other Capacitor skills in this collection for deeper topic-specific guidance. Do not use for 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