capacitor-app-intents
Skill75 starsChanged 33 days agoMITView on GitHub
Exposes Capacitor app features to Siri, Shortcuts, Spotlight, the Action button, Apple Intelligence, widgets and controls with native App Intents in ios/App/App, bridged to the web layer. Covers open-app intents routed through Universal Links / `OpenURLIntent` and @capacitor/app `appUrlOpen`, or a local plugin with a pending-route store; headless background intents; App Group / Preferences data sharing; AppShortcutsProvider phrases, AppEntity queries; iOS 26/27 APIs (`supportedModes` replacing `openAppWhenRun`, `continueInForeground`, `LongRunningIntent`, AppIntentsTesting) gated for Capacitor 8 (iOS 15) and 9 (iOS 16). Covers file placement, target membership, and UIScene (Capacitor 8.5+) URL delivery. Use for "add Siri shortcut", "Shortcuts action", "App Shortcuts", "control widget", or an intent that opens the app but the web view never navigates. Do not use for deep link setup (capacitor-deep-linking), push (capacitor-push-notifications), or Android shortcuts.
In this repository56 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- capacitor-accessibilitySkill
- 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-best-practicesSkill
- 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
12 rules. About 0 are common, 6 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
Only load a reference when its topic is in play.
- Very specific: line 52
Read package.json (@capacitor/ios version), ios/App/App/Info.plist (scene manifest present?), ios/App/App/AppDelegate.swift, …
- Very specific: line 53
Check whether the app already handles deep links in JS (App.addListener('appUrlOpen', ...), App.getLaunchUrl()) and which routes exist.
- Very specific: line 54
Search for existing intents: grep -rn "AppIntent\|AppShortcutsProvider\|openAppWhenRun" ios/App.
- Distinctive: line 69
Keep one intent per atomic task.
- Very specific: line 73
Create the Swift files in ios/App/App/Intents/ with the App target membership (references/project-setup.md).
- Distinctive: line 74
Write the intents following references/intent-traps.md.
- Very specific: line 75
Add the web bridge (references/web-bridge.md): either reuse the deep-link router, or add the local plugin and register it in a …
- Very specific: line 76
Add an AppShortcutsProvider with shortTitle, systemImageName and \(.applicationName) in every phrase.
- Distinctive: line 77
Add entitlements only when needed (App Groups for shared data, Associated Domains for Universal Links), and on every target that uses them.
- Distinctive: line 91
Run on a simulator or device: open the Shortcuts app, find the app's actions, run each one.
- Distinctive: line 95
If tests exist, add AppIntentsTesting coverage for iOS 27 test runners (references/ios-26-27-apis.md).
≈ “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
App Intents for Capacitor Apps
Add native App Intents to the iOS project so system surfaces can run app actions, and connect them to the web layer. App Intents are Swift only. There is no JavaScript API for them, so every intent is native code in the App target or an extension, and the web layer is reached through a URL or a small local plugin.
When to Use
TRIGGER when:
- The user wants Siri phrases, Shortcuts actions, App Shortcuts, Spotlight actions, Action button or Apple Intelligence integration for a Capacitor app
- The user wants a widget button or a Control Center control to run an app action
- An intent opens the app, but the web view does not navigate, or it navigates only on warm launch
- A background intent crashes, times out, or tries to call JS
- Migrating
openAppWhenRuntosupportedModes, or adopting iOS 26/27 App Intents APIs - A plugin author wants to ship App Intents with a plugin
Do not use:
- Universal Links / custom scheme /
appUrlOpensetup:capacitor-deep-linking - AppDelegate to SceneDelegate migration:
capacitor-uiscene-migration - Push notification actions:
capacitor-push-notifications - Live Activities or SVG widgets driven from JS:
capacitor-plugins(@capgo/capacitor-widget-kit) - Android app shortcuts and intents: not covered here
Facts that drive the design
- App Intents need iOS 16. Capacitor 8 deploys to iOS 15, so every intent type, entity, query and
AppShortcutsProviderneeds@available(iOS 16.0, *), or the user raises the deployment target. Capacitor 9 deploys to iOS 16, so the base API needs no gating. Newer APIs still do (tables in references/ios-26-27-apis.md). - A background intent has no WebView. iOS can launch the app process headless for
.backgroundintents.AppDelegate.application(_:didFinishLaunchingWithOptions:)runs, but no scene connects andCAPBridgeViewControllernever loads. Background intents must do native work only (network, storage, HealthKit, etc.). They cannot call JS or plugins through the bridge. perform()is not on the main actor, and it can run more than once. Hop explicitly (await MainActor.runor@MainActor func perform()) before you touch UIKit, the bridge or@MainActorstate. Do irreversible work last. Details: references/intent-traps.md.- With UIScene (Capacitor 8.5+) URL delivery moved. Universal Links and custom-scheme opens reach
SceneDelegateand are forwarded bySceneDelegateProxy, which posts the notifications@capacitor/applistens to. If the app still has custom URL code inAppDelegate, it no longer runs. Checkcapacitor-deep-linkingfirst ifappUrlOpendoes not fire for a normal link. An intent cannot fix a broken link pipeline. - On cold launch the JS listener does not exist yet. Any route an intent hands to the web layer must survive until JS asks for it: use
App.getLaunchUrl()for URLs, or a pending-route store plusnotifyListeners(..., retainUntilConsumed: true)for the local-plugin path. - Identifiers are a public contract. Intent type names,
AppEntity.idvalues,AppEnumraw values, URL formats and shipped phrases are stored in users' saved shortcuts. Add new ones; do not rename or remove shipped ones without telling the user.
References
Only load a reference when its topic is in play.
| File | Load when |
| references/project-setup.md | Creating files, target membership, extensions, App Groups, availability gating, build verification |
| references/web-bridge.md | Connecting an intent to the web layer: URL routing, the local AppIntentsBridge plugin, pending routes, shared data |
| references/intent-traps.md | Writing or reviewing any intent, entity, query, phrase, dependency, error or donation |
| references/ios-26-27-apis.md | supportedModes, foreground continuation, long-running/cancellable/undoable intents, execution targets, snippets, Spotlight indexing, schemas, testing |
| references/widgets-and-controls.md | Widget configuration intents, interactive widget buttons, Control Center controls |
Workflow
1. Inspect (read-only)
- Read
package.json(@capacitor/iosversion),ios/App/App/Info.plist(scene manifest present?),ios/App/App/AppDelegate.swift,ios/App/App/SceneDelegate.swift, the App target's deployment target, and any existing*.entitlements(Associated Domains, App Groups). - Check whether the app already handles deep links in JS (
App.addListener('appUrlOpen', ...),App.getLaunchUrl()) and which routes exist. - Search for existing intents:
grep -rn "AppIntent\|AppShortcutsProvider\|openAppWhenRun" ios/App. - List extension targets (widgets) in
ios/App/App.xcodeproj/project.pbxproj(PBXNativeTargetentries other thanApp).
2. Design with the user
For each action the user wants, decide and confirm:
| Question | Options |
| Does it need the UI? | No: background intent, native only. Yes: foreground intent that routes into the web app |
| How does it reach JS? | Universal Link via OpenURLIntent (iOS 18+, needs Associated Domains), or a local plugin with a pending-route store (works with custom schemes and iOS 16+) |
| What data does it need? | Fixed set: AppEnum. Dynamic, queryable: AppEntity + EntityQuery. Free text or number: plain @Parameter |
| Where must it run? | App target only, or also a widget / control (then the intent file needs both target memberships) |
| Which surfaces? | App Shortcut phrase (at most 10 App Shortcuts per app), Spotlight, widget, control |
Keep one intent per atomic task. Report the plan (files to add, targets, entitlements, JS changes) before editing.
3. Implement
- Create the Swift files in
ios/App/App/Intents/with the App target membership (references/project-setup.md). - Write the intents following references/intent-traps.md. Gate APIs by version.
- Add the web bridge (references/web-bridge.md): either reuse the deep-link router, or add the local plugin and register it in a
CAPBridgeViewControllersubclass. - Add an
AppShortcutsProviderwithshortTitle,systemImageNameand\(.applicationName)in every phrase. - Add entitlements only when needed (App Groups for shared data, Associated Domains for Universal Links), and on every target that uses them.
- JS side: handle the route on warm and cold start.
4. Verify
npx cap sync ios
xcodebuild -project ios/App/App.xcodeproj -scheme App \
-destination 'generic/platform=iOS Simulator' build
# CocoaPods projects: -workspace ios/App/App.xcworkspace- The build log shows the App Intents metadata extraction step with no warnings about phrases. A phrase without
\(.applicationName)produces a build warning and is dropped at runtime. - Product > App Shortcuts Preview in Xcode shows the phrases matching.
- Run on a simulator or device: open the Shortcuts app, find the app's actions, run each one.
- Background intent: completes without the app coming to the foreground. Check the native logs (
ios-android-logs). - Foreground intent, app killed first (cold) and app running (warm): the web view lands on the right route both times.
- Background intent: completes without the app coming to the foreground. Check the native logs (
- Spotlight: search the shortcut title.
- If tests exist, add AppIntentsTesting coverage for iOS 27 test runners (references/ios-26-27-apis.md).
Error Handling
| Symptom | Cause | Fix |
'AppIntent' is only available in iOS 16.0 or newer | Capacitor 8 project deploys to iOS 15 | Add @available(iOS 16.0, *) to every App Intents type, or raise the deployment target with the user's approval |
| Intent missing from Shortcuts after install | File not in the App target, or metadata extraction failed | Check target membership. Read the build log for the App Intents metadata step. Reinstall the app |
| Phrase never triggers Siri; build warning about the application name | Phrase lacks \(.applicationName) | Add the token to every phrase |
| Build error about more than 10 App Shortcuts | Per-app cap | Merge actions or drop low-value ones |
Crash "...was not initialized prior to access" from @Dependency | Dependency registered too late (in a view controller) | Register in AppDelegate.application(_:didFinishLaunchingWithOptions:), which runs on headless launches too |
| Foreground intent opens the app but the web view stays on the home route on cold start | The route was posted before JS added its listener | Use the pending-route store + retainUntilConsumed, or App.getLaunchUrl() |
appUrlOpen never fires for OpenURLIntent | Universal Links not configured, or custom AppDelegate URL code under UIScene | Fix with capacitor-deep-linking. OpenURLIntent needs a real https Universal Link |
| Swift 6 error: main actor-isolated property cannot satisfy nonisolated requirement | The intent type is marked @MainActor | Remove @MainActor from the type. Put it on perform() or hop inside |
| Background intent killed after about 30 seconds | iOS limit for background intents | Shorten the work, or use LongRunningIntent on iOS 27 |
'openAppWhenRun' was deprecated in iOS 26.0 | iOS 26 SDK | Add a gated supportedModes (references/ios-26-27-apis.md). Keep openAppWhenRun while the deployment target is below 26 |
Related Skills
capacitor-deep-linking: Universal Links andappUrlOpenrouting the intents rely oncapacitor-uiscene-migration: required before Xcode 27; moves URL handling toSceneDelegatecapacitor-plugins:@capgo/capacitor-widget-kitfor Live Activities and JS-driven widgetscapacitor-testing: native unit tests and the device verification loopios-android-logs: logs from headless intent runs
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.

