app-intents

Writes and reviews Swift App Intents code that exposes app actions and data to Siri, Shortcuts, Spotlight, widgets, Control Center, and Apple Intelligence. Use when adding AppIntent, AppEntity, OpenIntent, AppShortcutsProvider, EntityQuery, Focus Filters, AssistantEntity/AssistantIntent schemas, on-

By n0an · 386 installs

npx skills add n0an/app-intents-agent-skill --skill app-intents

Source repository · Upstream listing

Write and review Swift code that exposes app functionality through the App Intents framework, ensuring correct protocol conformance, safe data flow, and idiomatic discoverability wiring. Review process: 1. Check intent fundamentals (protocol, perform() , return types, dialog) using references/fundamentals.md . 1. Validate parameters and parameter options using references/parameters.md . 1. Validate entity types, display representations, and queries using references/entities.md . 1. Check the AppShortcutsProvider registration and discoverability UI using references/shortcuts and siri.md . 1. Validate OpenIntent navigation and snippet view return types using references/open and snippet intents.md . 1. Check dependency injection and the data controller pattern using references/dependencies.md . 1. Validate Spotlight indexing via IndexedEntity , IndexedEntityQuery , and attribute sets using references/spotlight.md . 1. Check @AssistantEntity / @AssistantIntent schema adoption using references/assistant schemas.md . 1. Validate the Siri / Apple Intelligence integration (finding content, custom responses, donations, confirmation, ownership) using references/siri intelligence.md . 1. Check on screen awareness and content transfer (view annotations, IntentValueRepresentation , system integration annotations) using references/onscreen awareness.md . 1. For intents that run past 30 seconds, handle cancellation, or target a specific process, use references/long running and execution.md . 1. If writing or reviewing tests for intents, use references/testing intents.md (covers the new AppIntentsTesting framework). 1. Catch common mistakes using references/anti patterns.md . If doing partial work, load only the relevant reference files. Task based routing Match the user's goal to the read order. Load only what you need. "Create my first App Intent" 1. references/fundamentals.md protocol, perform() , return types 2. references/shortcuts and siri.md register it so it shows up "Add a parameter the user picks in Shortcuts" 1. references/parameters.md @Parameter , prompts, disambiguation 2. references/entities.md if the parameter is a domain entity "Make my app's data searchable from Siri / Spotlight" 1. references/entities.md AppEntity , IndexedEntity , @Property 2. references/spotlight.md indexing strategies, attribute sets 3. references/shortcuts and siri.md flexible matching, phrase rules "Show a summary / interactive view when Siri runs my intent" 1. references/open and snippet intents.md inline vs indirect snippets, SnippetIntent , Button(intent:) 2. references/fundamentals.md return types and snippet design rules "Open a specific thing in my app from Siri / Shortcuts" 1. references/open and snippet intents.md OpenIntent , URLRepresentableIntent , TargetContentProvidingIntent 2. references/dependencies.md navigator / scene routing "Bring my app's content and actions to Siri / Apple Intelligence" 1. references/siri intelligence.md the integration model, finding content (semantic index / structured search / in app search), custom responses, donations, confirmation/ownership 2. references/assistant schemas.md schema macros, domains, multi schema requirements, Xcode snippets 3. references/onscreen awareness.md view annotations, content transfer, system integration annotations "Integrate with Apple Intelligence" 1. references/assistant schemas.md schema macros, domains, Use Model action, onscreen content 2. references/entities.md @Property , Transferable (required for several schemas) "Let Siri understand what's on screen" 1. references/onscreen awareness.md the 4 annotation APIs, content transfer, displayRepresentations fast path, annotations on notifications/Now Playing/AlarmKit 2. references/siri intelligence.md how onscreen context fits the larger Siri story "Make my intent run longer than 30 seconds or target a process" 1. references/long running and execution.md LongRunningIntent , CancellableIntent , allowedExecutionTargets , background GPU 2. references/fundamentals.md ProgressReportingIntent , supportedModes "Handle large numbers of entities efficiently / sync across devices" 1. references/parameters.md EntityCollection (identifiers only parameters) 2. references/entities.md SyncableEntity for cross device identity, RelevantEntities for proactive suggestions "Support Visual Intelligence / image search" 1. references/assistant schemas.md IntentValueQuery , SemanticContentDescriptor , @UnionValue 2. references/entities.md Transferable + OpenIntent pairing "Build an interactive widget or Control Center control" 1. references/open and snippet intents.md Button(intent:) , WidgetConfigurationIntent , ControlConfigurationIntent , ControlWidgetButton 2. references/dependencies.md App Group shared storage, process boundaries "Structure my app around App Intents" 1. references/fundamentals.md intents as canonical action layer 2. references/dependencies.md @Dependency , cross module AppIntentsPackage 3. references/entities.md entity as bridge pattern "Test my App Intents" 1. references/testing intents.md the AppIntentsTesting framework (out of process integration), direct struct unit tests, mocking @Dependency , test only intents, what you can't test "I'm hitting build errors or runtime bugs" 1. references/anti patterns.md 35+ catches with before/after fixes Decision trees Quick orientation when you know the task but not the right API. Which intent protocol should I conform to? Which entity type should I use? Which query should my entity use? How should Siri find my content? Which property wrapper should I use on entity fields? Core Instructions Target iOS 16+ / macOS 13+ minimum for App Intents. IndexedEntity , OpenIntent , focus filters, and control widgets require iOS 16+; @AssistantEntity / @AssistantIntent schemas require iOS 18.2+; anchored relative date styles and many assistant schemas require iOS 18.4+. The 27 releases (WWDC 2026, iOS 27 / macOS 27) add LongRunningIntent , EntityCollection , SyncableEntity , RelevantEntities , IndexedEntityQuery , OwnershipProvidingEntity , allowedExecutionTargets , the AppIntentsTesting framework, and native Duration / PersonNameComponents parameters; CancellableIntent and IntentValueRepresentation are iOS 26.4+; supportedModes is iOS 26+. Apple's own naming for the WWDC 2026 cohort is "the 27 releases" use that, not "iOS 19". Never make a SwiftData @Model class or other reference type data model conform to AppEntity . AppEntity requires Sendable ; @Model classes are not sendable. Create a separate struct entity that shadows the fields you want to expose. Never pass ModelContext across actor boundaries. ModelContext is not sendable. Pass ModelContainer (which is sendable) and create a local context inside the actor that needs one. Never expose an intent to Siri/Spotlight only by writing its type, always register it through an AppShortcutsProvider . Types not registered there will not appear in Shortcuts, Siri suggestions, or the action button picker. Never write a Siri activation phrase without interpolating \(.applicationName) . The App Intents macro rejects phrases without it at compile time, because phrases without the app name would collide with other apps' commands. Never reach back into a SwiftUI @Query from inside an intent. @Query only works inside a View . Run a one shot FetchDescriptor through a ModelContext instead, or route through a centralized data controller. Never instantiate services, data stores, or authentication managers inside perform() . Inject them through @Dependency and register them once in App.init() with AppDependencyManager.shared.add(dependency:) . Never use String(format:) or manual concatenation for localized intent dialog. Use LocalizedStringResource , and use Foundation's grammar agreement markdown ( ^[\(count) item](inflect: true) ) inside an AttributedString for pluralization. Prefer OpenIntent for "take me to this thing" actions, AppIntent & ShowsSnippetView for self contained one shot summaries, and AppIntent & ShowsSnippetIntent + a paired SnippetIntent when the snippet contains Button(intent:) and needs to re render after buttons fire. Always set static let isDiscoverable: Bool = false on helper intents that only back a widget button, snippet button, or other intent otherwise they pollute the user's Shortcuts library. When an intent mutates data that widgets or control widgets display, call WidgetCenter.shared.reloadAllTimelines() inside perform() before returning. When Button(intent:) lives inside a widget view, share state between the intent (runs in the app process) and the widget's timeline provider (runs in the extension process) via App Group UserDefaults(suiteName:) or a shared ModelContainer URL never UserDefaults.standard or in memory @Dependency state. When entity data that appears in a shortcut phrase's key path changes (creation, rename, deletion), call YourShortcutsProvider.updateAppShortcutParameters() to invalidate the cached candidate list. Prefer EnumerableEntityQuery when the whole set is small and cheap to load; implement EntityQuery + EntityStringQuery when the dataset is large or searchable; add EntityPropertyQuery to get a system generated Find intent for free. entities(for identifiers:) is mandatory on every query; without it, parameter resolution breaks. Mark entity fields that users might filter, sort, or reference in parameter summaries with @Property (stored) or @ComputedProperty (derived). Plain stored properties are invisible to the App Intents framework. Use TransientAppEntity for return data that's computed on the fly (summaries, aggregates). Don't try to shoehorn it into AppEntity with a fake id. When the entity already has a universal link URL, conform it to URLRepresentableEntity and conform the open intent to URLRepresentableIntent the system routes opens through your existing link handler without a perform() . For entities visible onscreen that Siri should be able to understand, combine .userActivity( :element:) on the view with Transferable conformance on the entity. Identification alone is not enough; Siri needs exportable content. SnippetIntent.perform() is called multiple times per user interaction (initial show, after each button tap, on appearance changes, on reload() ). Keep it pure: read state, assemble the view, return. Never mutate app state or kick off slow work inside a snippet intent's perform() . Respect hard limits: 10 AppShortcut s per app, 1000 total trigger phrases (including parameter expansions). The first phrase in each shortcut's array is the primary one it's shown on the Shortcuts home tile and as Siri's "what can I do with X?" answer. Include at least one non parameterized phrase per App Shortcut so it's discoverable before first launch; parameterized phrases don't appear in Spotlight until the app has run once and populated the parameter cache. Prefer supportedModes + continueInForeground (iOS 26+) over ForegroundContinuableIntent / needsToContinueInForegroundError for new code that conditionally foregrounds. The newer form lets one intent declare it may run background or foreground based on runtime state. Snippet views have a 340 point height ceiling; beyond this, scrolling breaks the glance overlay model. Link to the full app for deep content, and keep snippet text larger than system defaults for legibility at reading distance. For text parameters that may receive input from Apple Intelligence's Use Model action, declare the type as AttributedString rather