capacitor-best-practices
Skill75 starsChanged 33 days agoMITView on GitHub
Review and set up Capacitor apps against current best practices (Capacitor 8.5 stable, 9 alpha via `@next`). Use for a Capacitor codebase review, `capacitor.config.ts` audit, new project setup, aligning `@capacitor/core`/`cli`/`ios`/`android` and plugin majors, plugin patterns (availability checks, `checkPermissions`/`requestPermissions`, error `code` handling, web fallbacks), or release prep; or on `"<Plugin>" plugin is not implemented on ios`, `Could not find the web assets directory`, `platform has not been added yet`, a dev `server.url` shipped to production, lost edits in `android/app/src/main/assets/public`, SPM vs CocoaPods, or AppDelegate/UIScene drift. Do not use for security audits (capacitor-security), performance (capacitor-performance), tests (capacitor-testing), crashes (debugging-capacitor), major upgrades (capacitor-app-upgrades), SPM migration (cocoapods-to-spm), UIScene adoption (capacitor-uiscene-migration), or live updates (capgo-live-updates).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Aver005/agent-skillstheir own version, first seen Feb 14, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Aver005/agent-skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository56 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- capacitor-accessibilitySkill
- capacitor-app-intentsSkill
- capacitor-apple-review-preflightSkill
- capacitor-app-storeSkill
- capacitor-app-upgradesSkill
- capacitor-app-upgrade-v4-to-v5Skill
- capacitor-app-upgrade-v5-to-v6Skill
- capacitor-app-upgrade-v6-to-v7Skill
- capacitor-app-upgrade-v7-to-v8Skill
- capacitor-app-upgrade-v8-to-v9Skill
- capacitor-ci-cdSkill
- capacitor-deep-linkingSkill
- capacitor-ios-resizabilitySkill
- capacitor-ios-security-hardeningSkill
- capacitor-keyboardSkill
- capacitor-mcpSkill
- capacitor-offline-firstSkill
- capacitor-performanceSkill
- capacitor-plugin-spm-supportSkill
- capacitor-pluginsSkill
- capacitor-plugin-upgradesSkill
- capacitor-plugin-upgrade-v4-to-v5Skill
- capacitor-plugin-upgrade-v5-to-v6Skill
- capacitor-plugin-upgrade-v6-to-v7Skill
- capacitor-plugin-upgrade-v7-to-v8Skill
- capacitor-plugin-upgrade-v8-to-v9Skill
- capacitor-push-notificationsSkill
- capacitor-securitySkill
- capacitor-splash-screenSkill
- capacitor-testingSkill
- capacitor-uiscene-migrationSkill
- capawesome-live-update-migrationSkill
- capgo-cli-usageSkill
- capgo-cloudSkill
- capgo-live-updatesSkill
- capgo-native-buildsSkill
- capgo-organization-managementSkill
- capgo-release-managementSkill
- capgo-release-workflowsSkill
- cocoapods-to-spmSkill
- cordova-to-capacitorSkill
- debugging-capacitorSkill
- framework-to-capacitorSkill
- ionic-appflow-migrationSkill
- ionic-designSkill
- ionic-enterprise-sdk-migrationSkill
- ios-android-logsSkill
- konsta-uiSkill
- safe-area-handlingSkill
- skill-creatorSkill
- sqlite-to-fast-sqlSkill
- subscription-app-revenueSkill
- tailwind-capacitorSkill
- webapp-to-capacitorSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 65
Use the permission API: Call checkPermissions() then requestPermissions() for official plugins that expose them, and handle denied with a …
- Very specific: line 68
iOS lifecycle is scene-based from Capacitor 8.5: After adopting UIScene, AppDelegate application(_:open:options:), continue userActivity, …
- Distinctive: line 74
Only load a reference when its topic is in play.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Capacitor Best Practices
Review a Capacitor app for structural mistakes that cause broken builds, lost edits, production leaks, and plugin crashes. Route deep topics to the sibling skill that owns them.
When to Use
TRIGGER when:
- The user asks for a general code/architecture review of a Capacitor or Ionic + Capacitor app.
- Setting up a new Capacitor project or adding iOS/Android to an existing web app.
capacitor.config.ts|jsonreview:webDir,server.url,cleartext, plugin config, env-specific config.- Version drift between
@capacitor/core,@capacitor/cli,@capacitor/ios,@capacitor/android, or plugin majors that do not match Capacitor's major. - Plugin usage review: missing
npx cap sync, no availability check, no permission flow, matching on error message strings. - Errors such as
"<Plugin>" plugin is not implemented on ios,Could not find the web assets directory,ios platform has not been added yet. - Pre-release sanity checklist across config, native projects, and live updates.
Do not use:
- Security audit, secrets, storage, pinning, CSP ->
capacitor-security; Xcode hardening ->capacitor-ios-security-hardening. - Bundle size, startup time, memory, bridge profiling ->
capacitor-performance. - Unit/E2E test setup and plugin mocking ->
capacitor-testing. - Crashes, white screen, native logs ->
debugging-capacitor,ios-android-logs. - Major upgrades ->
capacitor-app-upgrades(8 -> 9:capacitor-app-upgrade-v8-to-v9). - CocoaPods -> SPM ->
cocoapods-to-spm; UIScene adoption ->capacitor-uiscene-migration. - Finding or installing a specific plugin ->
capacitor-plugins. - Store submission and review ->
capacitor-app-store,capacitor-apple-review-preflight; CI ->capacitor-ci-cd; live updates ->capgo-live-updates.
Current baseline (October 2026)
Capacitor 8 (stable, latest 8.5.x) | Capacitor 9 (next, alpha) | |
| Node | 22+ | 24+ |
| iOS min / Xcode | iOS 15 / Xcode 26 (8.5 adopts UIScene so Xcode 27 builds work) | iOS 16 / Xcode 27+ |
| Android | minSdk 24, compile/target 36, AGP 8.13, Gradle 8.14.3 | minSdk 26, compile/target 37, AGP 9.2.1, Gradle 9.5.1 |
| iOS deps | SPM default for new projects | SPM default |
CocoaPods Trunk is expected to go read-only on December 2, 2026. Recommend SPM for every app still on CocoaPods. Install Capacitor 9 only with @next until it reaches GA, and do not recommend it for production apps.
Review workflow
- Inventory (read-only).
npx cap doctor # installed vs latest Capacitor packages npx cap ls # plugins Capacitor detects per platform cat capacitor.config.ts 2>/dev/null || cat capacitor.config.json ls ios/App/Podfile ios/App/CapApp-SPM 2>/dev/null # CocoaPods or SPM grep -nE "minSdkVersion|compileSdkVersion|targetSdkVersion" android/variables.gradle - For large codebases, write a TODO list of areas (config, versions, plugins, native iOS, native Android, live updates, release) and review one at a time.
- Report findings before editing, grouped by severity, each with file:line and the fix. Ask before invasive changes (upgrading a major, migrating to SPM, enabling R8, changing
appId). - Fix, loading the matching reference.
- Run Verification.
Rules that matter most
- Keep Capacitor packages on one version.
@capacitor/core,cli,ios,androidmust match. Plugin majors must match the Capacitor major (official and@capgo/*plugins follow it: v8 plugins for Capacitor 8). npx cap syncafter every plugin install/removal and every config change. Missing sync produces"<Plugin>" plugin is not implemented on <platform>.- Never edit generated web assets.
android/app/src/main/assets/public/andios/App/App/public/are overwritten bycap copy/sync. Editsrc/and rebuild. - Commit
ios/andandroid/. They are source code with your native customizations, not build output. Do commitcapacitor.config.*; do not commitnode_modules,Pods/, build dirs. - No dev settings in release config.
server.url,server.cleartext,allowNavigationto dev hosts,webContentsDebuggingEnabled: true. Gate them on an env var (see references/config-and-project.md). On Capacitor 9, usenpx cap run <platform> --url <dev-url>for live reload. - Feature-detect before calling plugins.
Capacitor.isNativePlatform(),Capacitor.getPlatform(),Capacitor.isPluginAvailable('Name'). Provide a web fallback or hide the feature. - Use the permission API. Call
checkPermissions()thenrequestPermissions()for official plugins that expose them, and handledeniedwith a path to Settings. Add the matchingNS*UsageDescriptionkeys / Android permissions. - Branch on
error.code, noterror.message. Messages change between versions and platforms. Official plugins expose structured codes (for exampleOS-PLUG-CAMR-0006for a cancelled camera capture in@capacitor/camera8.1+ new APIs); Capacitor core usesUNIMPLEMENTED/UNAVAILABLE. - Move large binary data as files, not base64. Pass file paths/URIs across the bridge and render with
Capacitor.convertFileSrc(). - iOS lifecycle is scene-based from Capacitor 8.5. After adopting UIScene, AppDelegate
application(_:open:options:),continue userActivity, and foreground/background callbacks stop firing. Move custom native code toSceneDelegate(capacitor-uiscene-migration). AvoidUIScreen.mainand idiom-based layout for resizable windows. - Live updates: call
CapacitorUpdater.notifyAppReady()on every launch, and apply manual updates withnext()(on background/relaunch) rather thanset()mid-session. Details incapgo-live-updates. - Secrets never go in the app. Anything in the bundle or
capacitor.configis extractable. Hand off tocapacitor-securityfor anything beyond this rule.
References
Only load a reference when its topic is in play.
| Reference | Load when |
| references/config-and-project.md | Reviewing capacitor.config, env-specific builds, repo layout, .gitignore, version alignment |
| references/plugins.md | Plugin install/sync, availability checks, permissions, error codes, web fallbacks, lazy loading, mocking |
| references/native-projects.md | iOS SPM vs CocoaPods, UIScene, deployment targets; Android variables.gradle, R8, Capacitor 9 Gradle changes |
| references/release-checklist.md | Preparing a release build or reviewing release readiness |
Verification
# Versions aligned (all @capacitor/* core packages show the same version)
npm ls @capacitor/core @capacitor/cli @capacitor/ios @capacitor/android
npx cap doctor
# Web build exists where webDir points, then sync succeeds without errors
npm run build && npx cap sync
# No dev server or debug flags in the synced native config
grep -nE "\"url\"|cleartext|webContentsDebuggingEnabled" \
android/app/src/main/assets/capacitor.config.json ios/App/App/capacitor.config.json
# No hand edits in generated web assets (should show nothing)
git status --porcelain android/app/src/main/assets/public ios/App/App/public
# Error handling does not depend on message text
grep -rnE "error\.message\s*(===|==|\.includes)" src/
# Native builds
cd android && ./gradlew assembleRelease && cd ..
xcodebuild -project ios/App/App.xcodeproj -scheme App -configuration Release -destination 'generic/platform=iOS' build CODE_SIGNING_ALLOWED=NOWith CocoaPods, build ios/App/App.xcworkspace with -workspace instead of -project. Finally run on a real device and exercise each plugin-backed feature, including permission denial.
Error handling
| Error | Cause | Fix |
"<Plugin>" plugin is not implemented on ios (or android) | Plugin installed but not synced, plugin has no implementation for that platform, or plugin major does not match Capacitor | npx cap sync; check npx cap ls; install the plugin version matching your Capacitor major; rebuild the native app |
"<Plugin>.<method>()" is not implemented on web | Calling a native-only method in the browser | Guard with Capacitor.isNativePlatform() or isPluginAvailable, provide a web fallback |
Could not find the web assets directory: ./dist. | webDir wrong or web app not built | Build first; set webDir to the real output folder (dist, www, build, out) |
ios platform has not been added yet. | Native project missing | npx cap add ios (SPM default) or restore the committed ios/ folder |
Invalid App ID "<id>" | appId not reverse-domain or contains invalid characters | Use com.company.app style; changing it on a published app creates a new store listing |
| App loads a LAN IP or blank screen in production | server.url shipped from a dev config | Remove it, rebuild, npx cap sync, rebuild the native app |
net::ERR_CLEARTEXT_NOT_PERMITTED | HTTP request on Android | Use HTTPS; cleartext only in dev config (see capacitor-security) |
pod install fails / CocoaPods spec errors | CocoaPods trunk deprecation, outdated specs | Migrate with cocoapods-to-spm |
Deep links or resume handling stopped on iOS after 8.5 | Custom code still in AppDelegate after UIScene adoption | Move it to SceneDelegate (capacitor-uiscene-migration) |
Resources
- Capacitor docs: https://capacitorjs.com/docs
- Config reference: https://capacitorjs.com/docs/config
- Environment-specific configurations: https://capacitorjs.com/docs/guides/environment-specific-configurations
- Updating to 8.5 (UIScene): https://capacitorjs.com/docs/updating/8-5
- Capgo docs: https://capgo.app/docs/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

