swiftdata

Installation
SKILL.md

SwiftData

Apple's modern persistence layer (the Core Data successor) — @Model classes, a ModelContainer, ModelContext for CRUD, and @Query for reactive SwiftUI fetches. The deep API reference — model attributes, relationships, fetching, migrations, concurrency, CloudKit, iOS 26 additions — lives in references/guide.md. This file is the decision and discipline layer: read it first, open the guide for specifics.

Dials

Set these explicitly at the start; they change what "correct" means.

  1. CONCURRENCY — main-context (default; all reads/writes on mainContext from @MainActor code) · model-actor (heavy imports, batch writes, or background work go through a @ModelActor-isolated context — ModelContext is not Sendable and may not cross actors).
  2. MIGRATION — lightweight (additive changes pre-ship, or trivial property adds with defaults) · versioned-schema (anything shipped to users: VersionedSchema + SchemaMigrationPlan, lightweight or custom stages).
  3. CLOUDKIT_SYNC — off (default; local store only) · on (.modelContainer(... ,cloudKitDatabase:) or ModelConfiguration(cloudKitDatabase: .automatic) — forces extra schema constraints, see anti-rationalization).

When to use

Designing or reviewing any local data model, query, write path, relationship graph, schema migration, or CloudKit-synced store that goes through SwiftData. iOS 17+ for the framework, iOS 18+ for #Index/#Unique, iOS 26 the default target. If the app is on Core Data and not migrating, this skill does not apply; if it's migrating off Core Data, it does.

Core rules

Installs
1
GitHub Stars
1
First Seen
Jun 18, 2026
swiftdata — moritztucher/swift-agent-skills