/duology-features:duo-app-intentsfrom duology-features
Guides App Intents on iPhone Duo to the correct pane or window. Covers AppIntent, AppEntity, OpenIntent, onAppIntentExecution, handlesExternalEvents, background intents, onscreen awareness, App Shortcuts, and AppIntentsTesting on the Duo simulator.
Ships in duology-features. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
App Intents describe your app's actions and content to Siri, Shortcuts, Spotlight, widgets and Apple Intelligence (App Intents). On iPhone Duo an intent can arrive while the phone is closed, while two panes are on screen, or while two windows of your app share the inner display. This skill makes each intent land in the right place.
Load neighbours when the task needs them: duo-scenes (windows, Split View, the scene manifest), duo-continuity (window models that survive a fold), duo-intelligence (the summaries an intent can return), duo-system-surfaces (widgets and controls that run intents).
Labels: measured means we ran it on the iPhone Duo simulator (iOS 27.1) on 20 October 2026, with AppIntentsTesting driving the intents; see references/evidence.md. Unverified means we could not confirm it. Everything else comes from Apple's pages, linked inline. Full source list: reference/sources.md.
Apple's iPhone Duo pages and the six Duo Tech Talks don't mention App Intents. The Duo rules below join Apple's App Intents guides (Directing app intents to your app's scenes, Configuring the runtime behavior, Providing contextual cues) with Apple's Duo scene rules and our measurements.
| Situation on iPhone Duo | What happened | Source |
|---|---|---|
OpenIntent with the phone closed | onAppIntentExecution ran 0.9 to 1.7 s before perform(); the collapsed split view showed the note | measured |
| The same with the phone open | The list and the note side by side, the row still visible | measured |
A .background intent with the app behind another app | perform() ran in the background mode; the scene stayed in the background | measured, closed and open |
An OpenIntent with the app behind | The handler ran while the scene was still inactive, then the same window became active with the note; no new window | measured, closed and open |
| Notes on screen for Siri | Closed: 1 (the open note). Open: 4 (three rows and the open note) | measured |
| Two windows on the inner display | The system routes by contentIdentifier to the window that prefers it | Apple's routing guide; unverified on Duo |
duo-continuity).perform().OpenIntent plus TargetContentProvidingIntent, and set the selection in onAppIntentExecution. The split view then does the right thing on each display.handlesExternalEvents(preferring:allowing:). New windows work only on the inner display (duo-scenes).appEntityIdentifier(forSelectionType:identifier:), the open item with appEntityIdentifier(_:) or an NSUserActivity.UIApplicationSupportsMultipleScenes set to YES, even with one scene (routing guide).TargetContentProvidingIntent, onAppIntentExecution and supportedModes are iOS 26; the view annotations are iOS 18.4. iPhone Duo runs iOS 27.1, so this only matters for other iPhones: add the conformance in an @available(iOS 26.0, *) extension, mark supportedModes @available(iOS 26.0, *), and wrap the modifiers in if #available.import AppIntents
import Observation
struct Note: Identifiable, Hashable, Sendable {
let id: UUID
var title: String
var body: String
}
/// One store for the whole app, shared by every window and by the intents.
@MainActor @Observable
final class NoteLibrary {
static let shared = NoteLibrary()
var notes: [Note] = []
func note(_ id: Note.ID?) -> Note? { notes.first { $0.id == id } }
}
struct NoteEntity: AppEntity {
static let typeDisplayRepresentation: TypeDisplayRepresentation = "Note"
static let defaultQuery = NoteQuery()
let id: UUID
@Property(title: "Title") var title: String
init(_ note: Note) {
id = note.id
title = note.title
}
var displayRepresentation: DisplayRepresentation { DisplayRepresentation(title: "\(title)") }
}
struct NoteQuery: EntityStringQuery {
func entities(for identifiers: [UUID]) async throws -> [NoteEntity] {
await MainActor.run {
NoteLibrary.shared.notes.filter { identifiers.contains($0.id) }.map(NoteEntity.init)
}
}
func entities(matching string: String) async throws -> [NoteEntity] {
await MainActor.run {
NoteLibrary.shared.notes.filter { $0.title.localizedCaseInsensitiveContains(string) }.map(NoteEntity.init)
}
}
func suggestedEntities() async throws -> [NoteEntity] {
await MainActor.run { NoteLibrary.shared.notes.prefix(10).map(NoteEntity.init) }
}
}
EntityStringQuery lets Shortcuts, Siri and AppIntentsTesting find a note by name. Mark properties with @Property so the system (and tests) can read them.IndexedEntity when Siri should find them by meaning (WWDC26 session 343). Nothing about that is Duo-specific.import AppIntents
import SwiftUI
// requires: Note, NoteLibrary, NoteEntity (section 1); NoteDetail (your view)
struct OpenNoteIntent: OpenIntent, TargetContentProvidingIntent {
static let title: LocalizedStringResource = "Open Note"
static let description: IntentDescription? = "Shows a note in Notes."
@Parameter(title: "Note") var target: NoteEntity
/// Lets the system pick the window that already shows this note.
static func contentIdentifier(for id: UUID) -> String { "note:\(id.uuidString)" }
var contentIdentifier: String { Self.contentIdentifier(for: target.id) }
func perform() async throws -> some IntentResult { .result() }
}
@MainActor @Observable
final class NotesWindowModel { // one per window
var selection: Note.ID?
}
struct NotesWindow: View {
@Environment(NoteLibrary.self) private var library
@State private var model = NotesWindowModel()
var body: some View {
@Bindable var model = model
NavigationSplitView {
List(library.notes, selection: $model.selection) { note in
Text(note.title)
}
.navigationTitle("Notes")
} detail: {
if let note = library.note(model.selection) {
NoteDetail(note: note)
} else {
ContentUnavailableView("No Note Selected", systemImage: "note.text")
}
}
// Runs in this window before perform(): closed, the split view shows the note;
// open, the list and the note side by side.
.onAppIntentExecution(OpenNoteIntent.self) { intent in
model.selection = intent.target.id
}
// Prefer the window that already shows the note; accept any other.
.handlesExternalEvents(
preferring: Set(model.selection.map { [OpenNoteIntent.contentIdentifier(for: $0)] } ?? []),
allowing: ["*"]
)
}
}
onAppIntentExecution(_:perform:) (iOS 26) hands the intent to a scene before perform() and before the app comes forward, so the window is ready when it appears (doc). Don't ask the person for values in that closure.OpenIntent makes the system run the intent in the foreground (measured: perform() reported the foreground mode).duo-layout) decide what shows closed and open.UISceneAppIntent, AppIntentSceneDelegate and scene activation conditions. Code: references/routing.md.Only the inner display can create a window, and people may have two windows of your app side by side there (duo-scenes). An intent should reach the window that already shows its item, and otherwise the current one.
contentIdentifier, as above. In each window, list the identifiers it prefers in handlesExternalEvents(preferring:allowing:) and allow "*" so some window always accepts.openWindow or activateSceneSession from perform(). On the closed phone the request may fail (talk 111464) or replace the visible window (measured in duo-scenes), and the person ends up somewhere they didn't ask for.OpenIntent from the background changed that window's selection; the window root didn't start again, so no second window appeared.import AppIntents
// requires: NoteLibrary, NoteEntity (section 1)
/// Works with the phone closed: it runs in the background and answers in words.
struct ReadNoteSummaryIntent: AppIntent {
static let title: LocalizedStringResource = "Read Note Summary"
static let description: IntentDescription? = "Reads the start of a note without opening the app."
static let supportedModes: IntentModes = .background
@Parameter(title: "Note") var note: NoteEntity
func perform() async throws -> some IntentResult & ReturnsValue<String> & ProvidesDialog {
let text = await MainActor.run { NoteLibrary.shared.note(note.id)?.body ?? "" }
let summary = text.isEmpty ? "The note is empty." : String(text.prefix(140))
// The full dialog must make sense on its own: Siri may only speak it.
return .result(
value: summary,
dialog: IntentDialog(full: "\(note.title) says: \(summary)", supporting: "\(summary)")
)
}
}
supportedModes (iOS 26) is a hint; OpenIntent and a few other types force the foreground, and an App Intents extension always runs in the background (runtime guide).systemContext.isVoiceOnly (iOS 27) tells you when there is no screen at all, for example with AirPods (doc).[.background, .foreground(.dynamic)], check systemContext.currentMode.canContinueInForeground, then call continueInForeground(_:alwaysConfirm:). The app opens on whichever display is in use, so the result must make sense in the compact layout too.LongRunningIntent (iOS 27) and report progress (doc).duo-intelligence's fallbacks. A .background intent must still answer when the model can't.More, with a snippet view and the foreground hand-off: references/running-modes.md.
Tell Siri which items are on screen (Providing contextual cues). Apple's split: a collection annotation on a list, a view annotation on an item that is one of many, an NSUserActivity on a screen given to one item (WWDC26 session 343).
import AppIntents
import SwiftUI
// requires: Note, NoteLibrary, NoteEntity, NotesWindowModel (sections 1 and 2)
/// Tells Siri which notes are on screen. Open, the list and the note are both visible;
/// closed, only one of them is.
struct AnnotatedNoteList: View {
@Environment(NoteLibrary.self) private var library
@Bindable var model: NotesWindowModel
var body: some View {
List(library.notes, selection: $model.selection) { note in
Text(note.title)
}
.appEntityIdentifier(forSelectionType: Note.ID.self) { id in // rows, fetched lazily
EntityIdentifier(for: NoteEntity.self, identifier: id)
}
}
}
struct AnnotatedNoteDetail: View {
let note: Note
var body: some View {
ScrollView { Text(note.body).padding() }
.navigationTitle(note.title)
.appEntityIdentifier(EntityIdentifier(for: NoteEntity.self, identifier: note.id))
}
}
viewAnnotations() in AppIntentsTesting): closed with the note open, one annotation, the note. Open, four: the three rows and the note, so the open note appears twice. Right after launch, with only the list showing, one run reported the three rows and another reported none; read annotations after the screen settles.isSelected was false for all four annotations, the selected row and the open note included, although Apple's testing guide expects true for the item a detail screen shows. Don't rely on it to tell Siri which pane is "current".NSUserActivity with appEntityIdentifier instead (userActivity(_:element:_:) in SwiftUI). We didn't measure that form.import AppIntents
// requires: OpenNoteIntent, ReadNoteSummaryIntent (sections 2 and 4)
struct NotesShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: ReadNoteSummaryIntent(),
phrases: ["Read a note in \(.applicationName)", "What's in my \(\.$note) note in \(.applicationName)"],
shortTitle: "Read Note",
systemImageName: "text.bubble"
)
AppShortcut(
intent: OpenNoteIntent(),
phrases: ["Open \(\.$target) in \(.applicationName)"],
shortTitle: "Open Note",
systemImageName: "note.text"
)
}
}
NotesShortcuts.updateAppShortcutParameters() when notes change, so phrases with a note name stay current.duo-pose set closed and duo-pose set open from duo-pose-matrix.viewAnnotations(). Code and pitfalls: references/testing.md.EntityStringQuery and @Property titles; the store sits above every window.OpenIntent plus TargetContentProvidingIntent (UISceneAppIntent in UIKit) and set the window model's selection in onAppIntentExecution.contentIdentifier carries the item's ID; each window prefers its own item and allows "*".perform().UIApplicationSupportsMultipleScenes is YES..background and return a full dialog that works spoken alone.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub kimeur/duology --plugin duology-features8 skills in this plugin
/duo-cameraCamera capture on iPhone Duo, Apple's foldable. Use when an app takes photos or video, runs a video call or shows a camera preview, and must work closed (outer display), open (inner display), partly folded (book, tabletop), open and turned around (flipped) and through fold and unfold. Covers the virtual front camera (.builtInWideAngleCamera or .builtInUltraWideCamera at .front; shared features only, up to 1080p at 60 fps, no depth), the physical front cameras (.builtInOuterUltraWideCamera, .builtInInnerUltraWideCamera), choosing a camera by the way it faces with AVCaptureDeviceDirectionCoordinator (AVKit) and AVCaptureDeviceDescriptor, mirroring a rear-camera selfie, AVCaptureDevice.RotationCoordinator across displays, the square front sensor and dynamicAspectRatio, a subject preview on the outer display with CameraCaptureAccessory, tabletop hands-free capture, and Split View interruptions. The simulator has no camera: the code typechecks; capture is unverified on a device./duo-gamesBuilds games for iPhone Duo, Apple's foldable. The game fills the closed outer display, the open inner display, book pose and tabletop by changing its aspect ratio instead of letterboxing, as Apple's HIG asks; touch controls stay off the fold; and in tabletop the world sits above the fold with the controls below it, like a handheld console. Use when you build or port a SpriteKit, Metal or SwiftUI game, when a game letterboxes, restarts or loses input on fold or unfold, or when you add touch controls or game controller support. Covers SKScene .resizeFill with a camera that keeps the play area in view, one scene or renderer that survives every fold (measured), MTKView drawableSizeWillChange, a UIWindowScene display link that follows the scene to the other display, TouchZones split at the .division reserved region, GameLayout for tabletop, GCController and the simulator's own Gamepad, GCVirtualController and Touch Controller placement, orientation locks the inner display ignores, and two-player games./duo-intelligenceAdds Foundation Models to an iPhone Duo app: the on-device model (SystemLanguageModel) and the Private Cloud Compute server model (PrivateCloudComputeLanguageModel) behind one LanguageModelSession API, an AI side pane beside the content when the phone is open or in book pose (split ArrangementView) and a one-line summary when it is closed or in tabletop, streaming (streamResponse with @Generable partial snapshots) into a pane that keeps going through fold and unfold, availability checks and non-AI fallbacks, quota and error handling (LanguageModelError), tool calling, image prompts (Attachment), reasoning levels (ContextOptions) and privacy. Use when someone adds summaries, an assistant, chat, tagging or image understanding to an app that runs on iPhone Duo, or when an AI feature restarts on a fold, sits in the fold or doesn't fit the outer display./duo-mediaVideo and audio playback on iPhone Duo, Apple's foldable. Use when an app plays video or audio and must keep playing through fold, unfold and rotation, when you build a tabletop player (video above the fold, the same controls below) or a book-pose player, an up next queue, Picture in Picture, Now Playing or background audio. Covers one AVPlayer owned above the layout switch (VideoPlayer, AVPlayerViewController, AVPlayerLayer), ArrangementView with .overlay and overlayArrangementZIndex for up next (measured on the simulator in every pose), when to pick .split instead, toolbarVerticalBehavior(.disabled) for a full-screen player, AVPictureInPictureController and canStartPictureInPictureAutomaticallyFromInline, the pinned Picture in Picture video that takes half the screen when folded, MPNowPlayingSession and remote commands, the .playback audio session, and what to test in Device Hub and on a device./duo-readingBuilds reading and document screens for iPhone Duo, Apple's foldable: one page on the closed outer display, two facing pages split at the fold when the phone is open and held wide or folded like a book, and in tabletop the page above the fold with page turns below it. Use when you build an e-reader, a long-form or PDF viewer, notes beside a document, or when a reader loses its place on fold, unfold, rotation or a Dynamic Type change. Covers TextKit 1 pagination (NSLayoutManager, NSTextContainer) that keeps the place as a character offset, PagedReader with FoldGeometry and reservedRegions(kind: .division, options: .includeInactive), notes that move between the trailing region and a sheet, Dynamic Type reflow, text selection that stays inside one page (iOS 27 Text range selection, a UITextView edit menu Add to Notes action, drag), PDFKit two-up centred on the fold, and Apple Pencil, which Apple says comes later in 2026 (what it will support is unverified)./duo-swiftui-27The iOS 27 SwiftUI changes that matter on iPhone Duo, Apple's foldable, where every fold, unfold and rotation resizes the app. Use it when building with Xcode 27.1 breaks a view (@State macro, ContentBuilder, TN3211), when a grid or list that reflows between the outer and inner display needs drag to reorder or swipe actions, or when you adopt the new tab, toolbar, dialog or AsyncImage APIs in a Duo app. Covers the @State macro through a fold and its source breaks, reorderable() and reorderContainer(for:isEnabled:move:) in a 2 or 4 column grid and across the fold, swipeActionsContainer() outside List, Tab(role: .prominent) at the foot of the vertical tab bar, toolbarMinimizationBehavior(_:for:) (the talk's toolbarMinimizeBehavior is not in the SDK), visibilityPriority, ToolbarOverflowMenu, topBarPinnedTrailing, alert and confirmationDialog with item:, AsyncImage HTTP caching and asyncImageURLSession(_:), and resizable iPhone apps. Points to Apple's swiftui-whats-new-27 Xcode skill for the rest.Other plugins' skills for the same job