App intents

From rshankras/claude-code-apple-skills · View interactive version

App intents is an AI agent skill from the GitHub repository rshankras/claude-code-apple-skills. App Intents for Siri, Shortcuts, Spotlight, and Apple Intelligence integration including intent modes, interactive snippets, visual intelligence, and entity indexing. Use when implementing Siri integration, App Shortcuts, or Spotlight indexing.

How to use this skill

Skill file

App Intents

Build intents that expose your app's functionality to Siri, Shortcuts, Spotlight, and Apple Intelligence. Covers the full App Intents framework from basic actions through advanced features like interactive snippets, intent modes, visual intelligence integration, and Spotlight entity indexing.

When This Skill Activates

Decision Tree

What do you need?
|
+-- Expose an action to Siri/Shortcuts
|   +-- Simple action, no UI needed
|   |   --> Basic AppIntent (intents-basics.md)
|   +-- Needs to show UI or ask user questions
|   |   --> Intent Modes + Interactive Snippets (advanced-features.md)
|   +-- Needs a predictable voice phrase
|       --> App Shortcuts (intents-basics.md)
|
+-- Make content searchable
|   +-- In Spotlight
|   |   --> IndexedEntity + @Property (entities-spotlight.md)
|   +-- Runnable from Spotlight on Mac
|   |   --> parameterSummary visibility gates (entities-spotlight.md)
|   +-- In Visual Intelligence
|   |   --> IntentValueQuery + SemanticContentDescriptor (advanced-features.md)
|   +-- As onscreen entities for Siri/ChatGPT
|       --> annotation APIs + EntityIdentifier (advanced-features.md)
|
+-- Let Siri execute intents from natural language
|   --> App Schemas: @AppIntent(schema:) / @AssistantIntent (advanced-features.md)
|
+-- Feed entities to Apple Intelligence (Use Model action)
|   --> AttributedString params + entity JSON + Find actions (entities-spotlight.md)
|
+-- Hand entities to other apps as content/files
|   --> Transferable / FileEntity (entities-spotlight.md)
|
+-- Show rich results in Siri
|   +-- Static display only
|   |   --> .result(view:) snippet (advanced-features.md)
|   +-- Interactive buttons/controls
|   |   --> SnippetIntent protocol (advanced-features.md)
|   +-- Custom spoken dialog
|       --> IntentDialog(full:supporting:) (advanced-features.md)
|
+-- Present choices to the user
|   --> requestChoice(between:) (advanced-features.md)
|
+-- Teach Siri from in-app UI actions
|   --> IntentDonationManager (advanced-features.md)
|
+-- Share intents via Swift Package
    --> AppIntentsPackage protocol (advanced-features.md)

API Availability

| Feature | Minimum OS | Framework |

|---------|-----------|-----------|

| AppIntent protocol | iOS 16 / macOS 13 | AppIntents |

| AppEntity protocol | iOS 16 / macOS 13 | AppIntents |

| AppShortcutsProvider | iOS 16 / macOS 13 | AppIntents |

| @Parameter macro | iOS 16 / macOS 13 | AppIntents |

| IndexedEntity protocol | iOS 18 / macOS 15 | AppIntents |

| @Property with indexingKey | iOS 18 / macOS 15 | AppIntents |

| Intent Modes (supportedModes) | iOS 26 / macOS 26 | AppIntents |

| requestChoice(between:) | iOS 26 / macOS 26 | AppIntents |

| @ComputedProperty | iOS 26 / macOS 26 | AppIntents |

| @DeferredProperty | iOS 26 / macOS 26 | AppIntents |

| SnippetIntent protocol | iOS 26 / macOS 26 | AppIntents |

| AppIntentsPackage protocol | iOS 26 / macOS 26 | AppIntents |

| Onscreen entities (.userActivity()) | iOS 26 / macOS 26 | AppIntents |

| @UnionValue | iOS 18 / macOS 15 | AppIntents |

| Assistant Schemas (@AssistantIntent) | iOS 18 | AppIntents |

| Transferable entities, FileEntity | iOS 18 / macOS 15 | AppIntents |

| UndoableIntent | iOS 26 / macOS 26 | AppIntents |

| App Schemas on @AppIntent(schema:) | iOS 27 / macOS 27 | AppIntents |

| IntentDonationManager, OwnershipProvidingEntity | iOS 27 / macOS 27 | AppIntents |

| AppIntentsTesting framework | Xcode 26 cycle (WWDC26) | AppIntentsTesting |

Quick Reference

| Task | Type/API | Reference File |

|------|----------|----------------|

| Define an action | AppIntent protocol | intents-basics.md |

| Accept parameters | @Parameter macro | intents-basics.md |

| Create voice phrases | AppShortcutsProvider | intents-basics.md |

| Define a data entity | AppEntity protocol | entities-spotlight.md |

| Index in Spotlight | IndexedEntity protocol | entities-spotlight.md |

| Mark indexable fields | @Property(indexingKey:) | entities-spotlight.md |

| Run in background/foreground | supportedModes | advanced-features.md |

| Continue in foreground | continueInForeground() | advanced-features.md |

| Show result UI | .result(view:) | advanced-features.md |

| Interactive result UI | SnippetIntent protocol | advanced-features.md |

| Present choices | requestChoice(between:) | advanced-features.md |

| Visual intelligence search | IntentValueQuery | advanced-features.md |

| Onscreen entity association | .userActivity() modifier | advanced-features.md |

| Computed/deferred properties | @ComputedProperty, @DeferredProperty | advanced-features.md |

| Share via packages | AppIntentsPackage | advanced-features.md |

| Make intents Siri-executable | @AppIntent(schema:), @AssistantIntent | advanced-features.md |

| Update-intent "clear vs leave unchanged" | valueState (.set/.set(nil)/.unset) | advanced-features.md |

| Custom Siri dialog | IntentDialog(full:supporting:) | advanced-features.md |

| Donate in-app UI actions | IntentDonationManager | advanced-features.md |

| Shared-content confirmations | OwnershipProvidingEntity | advanced-features.md |

| Undo intent actions | UndoableIntent | advanced-features.md |

| Export entities as content/files | Transferable, FileEntity | entities-spotlight.md |

| Run from Spotlight on Mac | parameterSummary gates | entities-spotlight.md |

| Accept model-generated rich text | AttributedString parameters | entities-spotlight.md |

Process

1. Identify Integration Needs

Read the user's code or requirements to determine:

2. Load Relevant Reference Files

Based on the need, read from this directory:

3. Review or Implement

Apply patterns from the reference files. Check for common mistakes (see Top Mistakes below).

4. Cross-Reference

Top Mistakes

These are the most frequent errors when implementing App Intents.

1. Missing static metadata

// ❌ Wrong -- no title or description
struct MyIntent: AppIntent {
    func perform() async throws -> some IntentResult {
        return .result()
    }
}

// ✅ Correct -- static title is required
struct MyIntent: AppIntent {
    static var title: LocalizedStringResource = "Do Something"
    static var description: IntentDescription = "Performs the action"

    func perform() async throws -> some IntentResult {
        return .result()
    }
}

2. Forgetting to index entities after changes

// ❌ Wrong -- entities updated but Spotlight not notified
func saveRecipe(_ recipe: Recipe) {
    database.save(recipe)
}

// ✅ Correct -- reindex after mutations
func saveRecipe(_ recipe: Recipe) async throws {
    database.save(recipe)
    try await CSSearchableIndex.default().indexAppEntities()
}

3. Using foreground intent for background-safe work

// ❌ Wrong -- forces app to foreground for a simple toggle
struct ToggleFavoriteIntent: AppIntent {
    static var title: LocalizedStringResource = "Toggle Favorite"
    static var openAppWhenRun = true  // Unnecessary

    func perform() async throws -> some IntentResult {
        toggleFavorite()
        return .result()
    }
}

// ✅ Correct -- runs silently in background
struct ToggleFavoriteIntent: AppIntent {
    static var title: LocalizedStringResource = "Toggle Favorite"

    static let supportedModes: IntentModes = .background

    func perform() async throws -> some IntentResult {
        toggleFavorite()
        return .result()
    }
}

4. Not providing EntityStringQuery for entities

// ❌ Wrong -- entity has no way to be queried
struct NoteEntity: AppEntity {
    var id: String
    var title: String
    // Missing: static var defaultQuery
}

// ✅ Correct -- provides a query so Siri can resolve entities
struct NoteEntity: AppEntity {
    var id: String
    var title: String

    static var defaultQuery = NoteEntityQuery()
    // ... typeDisplayRepresentation, displayRepresentation
}

5. Returning too many Spotlight results

// ❌ Wrong -- indexing thousands of items at once blocks the main thread
func indexAll() async throws {
    let allItems = database.fetchAll()  // 50,000 items
    try await CSSearchableIndex.default().indexAppEntities()
}

// ✅ Correct -- batch index and run off main thread
func indexAll() async throws {
    try await CSSearchableIndex.default().indexAppEntities(
        of: RecipeEntity.self
    )
}

Design Guidelines

How to decide what to expose and how it should behave — from Apple's design sessions.

App Shortcuts (WWDC22)

What deserves to be an intent (WWDC24)

Interactive snippet design (WWDC25)

Review Checklist

Before shipping App Intents integration:

WWDC Session References

Rules throughout the reference files carry inline attributions to these sessions:

| Session | Covers |

|---------|--------|

| WWDC24 10133 — Bring your app to Siri | Assistant Schemas, 12 iOS 18 domains, semantic search |

| WWDC24 10210 — Bring your app's core features to users | Core doctrine: intents, entities, queries, reuse across surfaces |

| WWDC24 10134 — App Intents framework additions | IndexedEntity, Transferable, FileEntity, @UnionValue |

| WWDC24 10176 — Design App Intents for system experiences | Scope + parameter design rules, Open When Run |

| WWDC25 244 — Get to know App Intents | Protocol shapes, metadata extraction, ID contract, packaging |

| WWDC25 275 — Advances in App Intents | SnippetIntent, intent modes, undo, onscreen entities |

| WWDC25 260 — Develop for Shortcuts and Spotlight | Use Model action, Find actions, Mac Spotlight gates |

| WWDC26 240 — Build intelligent Siri experiences with App Schemas | Unified schema macros, testing ladder |

| WWDC26 343 — Advanced App Intents features for Siri | Dialogs, donations, ownership, annotation APIs |

| WWDC26 344 — Code-along: Make your app available to Siri | Canonical integration sequence, valueState |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.