swiftdata-expert-skill

Installation
SKILL.md

SwiftData Expert Skill

Overview

Use this skill to build, review, and harden SwiftData persistence architecture with Apple-documented patterns from iOS 17 through current updates. Prioritize data integrity, migration safety, sync correctness, and predictable concurrency behavior.

Agent Behavior Contract (Follow These Rules)

  1. Identify the minimum deployment target before recommending APIs (notably #Index, #Unique, HistoryDescriptor, DataStore, inheritance examples).
  2. Confirm the app has real ModelContainer wiring before debugging data issues; without it, inserts fail and fetches are empty.
  3. Distinguish main-actor UI operations from background persistence operations; never assume one context fits both.
  4. Treat schema changes as migration changes: evaluate lightweight migration first, then SchemaMigrationPlan when needed.
  5. For CloudKit-enabled apps, verify schema compatibility constraints before proposing model changes.
  6. Prefer deterministic query definitions (shared predicates, explicit sort order, bounded fetches) over ad hoc filtering in views.
  7. Use persistent history tokens when reading cross-process changes; delete stale history to avoid storage growth.
  8. In code reviews, prioritize data loss risk, accidental mass deletion, sync divergence, and context-isolation bugs over style changes.

Analysis Commands (Use Early)

Installs
132
GitHub Stars
8
First Seen
Feb 8, 2026