Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

app-intents应用意图

Agent Skill

app-intents 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

25,608

周安装

1,132

GitHub Stars

537

下载量

8,976
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:app-intents(应用意图)
来源仓库:https://github.com/dpearson2699/swift-ios-skills
仓库路径:skills/app-intents
安装命令:
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill app-intents
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill app-intents

简介

实施应用程序意图,将应用程序功能公开给 Siri、快捷方式、Spotlight、小部件和 Apple Intelligence。

  • 涵盖七个集成界面:Siri/快捷方式、可配置小部件、控制中心、Spotlight 搜索、Apple Intelligence 架构、交互式片段和视觉智能查询
  • 需要影子AppEntity
  • 带有 EntityQuery 的模型
  • 变体(基本、字符串搜索、可枚举或单例),加上 AppEnum
  • 用于固定参数选择
  • 包括 AppShortcutsProvider
  • 对于带有短语注册的预构建快捷方式,WidgetConfigurationIntent
  • 对于小部件参数和 IndexedEntity
  • 具有 Spotlight 的结构化元数据键 (iOS 18+)
  • iOS 26 添加:SnippetIntent
  • 用于交互式系统 UI 片段和 IntentValueQuery
  • 用于视觉智能值分辨率

SKILL.md

App Intents (iOS 26+)

Implement, review, and extend App Intents to expose app functionality to Siri, Shortcuts, Spotlight, widgets, Control Center, and Apple Intelligence.

Contents

Triage Workflow

Step 1: Identify the integration surface

Determine which system feature the intent targets:

SurfaceProtocolSince
Siri / ShortcutsAppIntentiOS 16
Configurable widgetWidgetConfigurationIntentiOS 17
Control CenterControlConfigurationIntentiOS 18
Spotlight searchIndexedEntityiOS 18
Apple Intelligence@AppIntent(schema:)iOS 18
Interactive snippetsSnippetIntentiOS 26
Visual IntelligenceIntentValueQueryiOS 26

Step 2: Define the data model

  • Create AppEntity shadow models (do NOT conform core data models directly).
  • Create AppEnum types for fixed parameter choices.
  • Choose the right EntityQuery variant for resolution.
  • Mark searchable entities with IndexedEntity and @Property(indexingKey:).

Step 3: Implement the intent

  • Conform to AppIntent (or a specialized sub-protocol).
  • Declare @Parameter properties for all user-facing inputs.
  • Implement perform() async throws -> some IntentResult.
  • Add parameterSummary for Shortcuts UI.
  • Register phrases via AppShortcutsProvider.

Step 4: Verify

  • Build and run in Shortcuts app to confirm parameter resolution.
  • Test Siri phrases with the intent preview in Xcode.
  • Confirm Spotlight results for IndexedEntity types.
  • Check widget configuration for WidgetConfigurationIntent intents.

AppIntent Protocol

The system instantiates the struct via init(), sets parameters, then calls perform(). Declare a title and parameterSummary for Shortcuts UI.

struct OrderSoupIntent: AppIntent {
    static var title: LocalizedStringResource = "Order Soup"
    static var description = IntentDescription("Place a soup order.")

    @Parameter(title: "Soup") var soup: SoupEntity
    @Parameter(title: "Quantity", default: 1) var quantity: Int

    static var parameterSummary: some ParameterSummary {
        Summary("Order \(\.$soup)") { \.$quantity }
    }

    func perform() async throws -> some IntentResult {
        try await OrderService.shared.place(soup: soup.id, quantity: quantity)
        return .result(dialog: "Ordered \(quantity) \(soup.name).")
    }
}

Optional members: description (IntentDescription), openAppWhenRun (Bool), isDiscoverable (Bool), authenticationPolicy (IntentAuthenticationPolicy).

@Parameter

Declare each user-facing input with @Parameter. Optional parameters are not required; non-optional parameters with a default are pre-filled.

// WRONG: Non-optional parameter without default -- system cannot preview
@Parameter(title: "Count")
var count: Int

// CORRECT: Provide a default or make optional
@Parameter(title: "Count", default: 1)
var count: Int

@Parameter(title: "Count")
var count: Int?

Supported value types

Primitives: Int, Double, Bool, String, URL, Date, DateComponents. Framework: Currency, Person, IntentFile. Measurements: Measurement<UnitLength>, Measurement<UnitTemperature>, and others. Custom: any AppEntity or AppEnum.

Common initializer patterns

// Basic
@Parameter(title: "Name")
var name: String

// With default
@Parameter(title: "Count", default: 5)
var count: Int

// Numeric slider
@Parameter(title: "Volume", controlStyle: .slider, inclusiveRange: (0, 100))
var volume: Int

// Options provider (dynamic list)
@Parameter(title: "Category", optionsProvider: CategoryOptionsProvider())
var category: Category

// File with content types
@Parameter(title: "Document", supportedContentTypes: [.pdf, .plainText])
var document: IntentFile

// Measurement with unit
@Parameter(title: "Distance", defaultUnit: .miles, supportsNegativeNumbers: false)
var distance: Measurement<UnitLength>

See references/appintents-advanced.md for all initializer variants.

AppEntity

Create shadow models that mirror app data -- never conform core data model types directly.

struct SoupEntity: AppEntity {
    static let defaultQuery = SoupEntityQuery()
    static var typeDisplayRepresentation: TypeDisplayRepresentation = "Soup"
    var id: String

    @Property(title: "Name") var name: String
    @Property(title: "Price") var price: Double

    var displayRepresentation: DisplayRepresentation {
        DisplayRepresentation(title: "\(name)", subtitle: "$\(String(format: "%.2f", price))")
    }

    init(from soup: Soup) {
        self.id = soup.id; self.name = soup.name; self.price = soup.price
    }
}

Required: id, defaultQuery (static), displayRepresentation, typeDisplayRepresentation (static). Mark properties with @Property(title:) to expose for filtering/sorting. Properties without @Property remain internal.

EntityQuery (4 Variants)

1. EntityQuery (base -- resolve by ID)

struct SoupEntityQuery: EntityQuery {
    func entities(for identifiers: [String]) async throws -> [SoupEntity] {
        SoupStore.shared.soups.filter { identifiers.contains($0.id) }.map { SoupEntity(from: $0) }
    }
    func suggestedEntities() async throws -> [SoupEntity] {
        SoupStore.shared.featured.map { SoupEntity(from: $0) }
    }
}

2. EntityStringQuery (free-text search)

struct SoupStringQuery: EntityStringQuery {
    func entities(matching string: String) async throws -> [SoupEntity] {
        SoupStore.shared.search(string).map { SoupEntity(from: $0) }
    }
    func entities(for identifiers: [String]) async throws -> [SoupEntity] {
        SoupStore.shared.soups.filter { identifiers.contains($0.id) }.map { SoupEntity(from: $0) }
    }
}

3. EnumerableEntityQuery (finite set)

struct AllSoupsQuery: EnumerableEntityQuery {
    func allEntities() async throws -> [SoupEntity] {
        SoupStore.shared.allSoups.map { SoupEntity(from: $0) }
    }
    func entities(for identifiers: [String]) async throws -> [SoupEntity] {
        SoupStore.shared.soups.filter { identifiers.contains($0.id) }.map { SoupEntity(from: $0) }
    }
}

4. UniqueAppEntityQuery (singleton, iOS 18+)

Use for single-instance entities like app settings.

struct AppSettingsEntity: UniqueAppEntity {
    static let defaultQuery = AppSettingsQuery()
    static var typeDisplayRepresentation: TypeDisplayRepresentation = "Settings"
    var displayRepresentation: DisplayRepresentation { "App Settings" }

    var id: String { "app-settings" }
}

struct AppSettingsQuery: UniqueAppEntityQuery {
    func entity() async throws -> AppSettingsEntity {
        AppSettingsEntity()
    }
}

See references/appintents-advanced.md for EntityPropertyQuery with filter/sort support.

AppEnum

Define fixed sets of selectable values. Must be backed by a LosslessStringConvertible raw value (use String).

enum SoupSize: String, AppEnum {
    case small, medium, large

    static var typeDisplayRepresentation: TypeDisplayRepresentation = "Size"

    static var caseDisplayRepresentations: [SoupSize: DisplayRepresentation] = [
        .small: "Small",
        .medium: "Medium",
        .large: "Large"
    ]
}
// WRONG: Using Int raw value
enum Priority: Int, AppEnum { // Compiler error -- Int is not LosslessStringConvertible
    case low = 1, medium = 2, high = 3
}

// CORRECT: Use String raw value
enum Priority: String, AppEnum {
    case low, medium, high
    // ...
}

AppShortcutsProvider

Register pre-built shortcuts that appear in Siri and the Shortcuts app without user configuration.

struct MyAppShortcuts: AppShortcutsProvider {
    static var appShortcuts: [AppShortcut] {
        AppShortcut(
            intent: OrderSoupIntent(),
            phrases: [
                "Order \(\.$soup) in \(.applicationName)",
                "Get soup from \(.applicationName)"
            ],
            shortTitle: "Order Soup",
            systemImageName: "cup.and.saucer"
        )
    }

    static var shortcutTileColor: ShortcutTileColor = .navy
}

Phrase rules

  • Every phrase MUST include \(.applicationName).
  • Phrases can reference parameters: \(\.$soup).
  • Call updateAppShortcutParameters() when dynamic option values change.
  • Use negativePhrases to prevent false Siri activations.

Siri Integration

Donating intents

Donate intents so the system learns user patterns and suggests them in Spotlight:

let intent = OrderSoupIntent()
intent.soup = favoriteSoupEntity
try await intent.donate()

Predictable intents

Conform to PredictableIntent for Siri prediction of upcoming actions.

Interactive Widget Intents

Use AppIntent with Button/Toggle in widgets. Use WidgetConfigurationIntent for configurable widget parameters.

struct ToggleFavoriteIntent: AppIntent {
    static var title: LocalizedStringResource = "Toggle Favorite"
    @Parameter(title: "Item ID") var itemID: String

    func perform() async throws -> some IntentResult {
        FavoriteStore.shared.toggle(itemID)
        return .result()
    }
}

// In widget view:
Button(intent: ToggleFavoriteIntent(itemID: entry.id)) {
    Image(systemName: entry.isFavorite ? "heart.fill" : "heart")
}

WidgetConfigurationIntent

struct BookWidgetConfig: WidgetConfigurationIntent {
    static var title: LocalizedStringResource = "Favorite Book"
    @Parameter(title: "Book", default: "The Swift Programming Language") var bookTitle: String
}

// Connect to WidgetKit:
struct MyWidget: Widget {
    var body: some WidgetConfiguration {
        AppIntentConfiguration(kind: "FavoriteBook", intent: BookWidgetConfig.self, provider: MyTimelineProvider()) { entry in
            BookWidgetView(entry: entry)
        }
    }
}

Control Center Widgets (iOS 18+)

Expose controls in Control Center and Lock Screen with ControlConfigurationIntent and ControlWidget.

struct LightControlConfig: ControlConfigurationIntent {
    static var title: LocalizedStringResource = "Light Control"
    @Parameter(title: "Light", default: .livingRoom) var light: LightEntity
}

struct ToggleLightIntent: AppIntent {
    static var title: LocalizedStringResource = "Toggle Light"
    @Parameter(title: "Light") var light: LightEntity
    func perform() async throws -> some IntentResult {
        try await LightService.shared.toggle(light.id)
        return .result()
    }
}

struct LightControl: ControlWidget {
    var body: some ControlWidgetConfiguration {
        AppIntentControlConfiguration(kind: "LightControl", intent: LightControlConfig.self) { config in
            ControlWidgetToggle(config.light.name, isOn: config.light.isOn, action: ToggleLightIntent(light: config.light))
        }
    }
}

Spotlight and IndexedEntity (iOS 18+)

Conform to IndexedEntity for Spotlight search. On iOS 26+, use indexingKey for structured metadata:

struct RecipeEntity: IndexedEntity {
    static let defaultQuery = RecipeQuery()
    static var typeDisplayRepresentation: TypeDisplayRepresentation = "Recipe"
    var id: String

    @Property(title: "Name", indexingKey: .title) var name: String   // iOS 26+
    @ComputedProperty(indexingKey: .description)                      // iOS 26+
    var summary: String { "\(name) -- a delicious recipe" }

    var displayRepresentation: DisplayRepresentation {
        DisplayRepresentation(title: "\(name)")
    }
}

iOS 26 Additions

SnippetIntent

Display interactive snippets in system UI:

struct OrderStatusSnippet: SnippetIntent {
    static var title: LocalizedStringResource = "Order Status"
    func perform() async throws -> some IntentResult & ShowsSnippetView {
        let status = await OrderTracker.currentStatus()
        return .result(view: OrderStatusSnippetView(status: status))
    }
    static func reload() { /* notify system to refresh */ }
}

// A calling intent can display this snippet via:
// return .result(snippetIntent: OrderStatusSnippet())

IntentValueQuery (Visual Intelligence)

struct ProductValueQuery: IntentValueQuery {
    typealias Input = String
    typealias Result = ProductEntity
    func values(for input: String) async throws -> [ProductEntity] {
        ProductStore.shared.search(input).map { ProductEntity(from: $0) }
    }
}

Common Mistakes

  1. Conforming core data models to AppEntity. Create dedicated shadow models instead. Core models carry persistence logic that conflicts with intent lifecycle.
  2. Missing \(.applicationName) in phrases. Every AppShortcut phrase MUST include the application name token. Siri uses it for disambiguation.
  3. Non-optional @Parameter without default. The system cannot preview or pre-fill such parameters. Make non-optional parameters have a default, or mark them optional. // WRONG @Parameter(title: "Count") var count: Int // CORRECT @Parameter(title: "Count", default: 1) var count: Int
  4. Using Int raw value for AppEnum. AppEnum requires RawRepresentable where RawValue: LosslessStringConvertible. Use String.
  5. Forgetting suggestedEntities(). Without it, the Shortcuts picker shows no defaults.
  6. Throwing for missing entities in entities(for:). Omit missing entities instead.
  7. Stale Spotlight index. Call updateAppShortcutParameters() when entity data changes.
  8. Missing typeDisplayRepresentation. Both AppEntity and AppEnum require it.
  9. Using deprecated @AssistantEntity(schema:) / @AssistantEnum(schema:). Use @AppEntity(schema:) and @AppEnum(schema:) instead. Note: @AssistantIntent(schema:) is still active.
  10. Blocking perform(). perform() is async -- use await for I/O.

Review Checklist

  • Every AppIntent has a descriptive title (verb + noun, title case)
  • @Parameter types are optional or have defaults for system preview
  • AppEntity types are shadow models, not core data model conformances
  • AppEntity has displayRepresentation and typeDisplayRepresentation
  • EntityQuery.entities(for:) omits missing IDs; suggestedEntities() implemented
  • AppEnum uses String raw value with caseDisplayRepresentations
  • AppShortcutsProvider phrases include \(.applicationName); parameterSummary defined
  • IndexedEntity properties use @Property(indexingKey:) on iOS 26+
  • Control Center intents conform to ControlConfigurationIntent; widget intents to WidgetConfigurationIntent
  • No deprecated @AssistantEntity / @AssistantEnum macros (note: @AssistantIntent(schema:) is still active)
  • perform() uses async/await (no blocking); runs in expected isolation context; intent types are Sendable

References

  • See references/appintents-advanced.md for @Parameter variants, EntityPropertyQuery, assistant schemas, focus filters, SiriKit migration, error handling, confirmation flows, authentication, URL-representable types, and Spotlight indexing details.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.94%
按下载量换算3,226

Claude

28.73%
按下载量换算2,579

Cursor

19.84%
按下载量换算1,781

Gemini CLI

8.69%
按下载量换算780

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills