
Core Data Expert
Ship correct, performant Core Data stacks on iOS and macOS and fix crashes around contexts, migrations, batch work, and CloudKit sync.
Overview
Core Data Expert is an agent skill for the Build phase that guides solo builders through correct, performant iOS and macOS Core Data stacks, migrations, threading, and CloudKit sync.
Install
npx skills add https://github.com/avdlee/core-data-agent-skill --skill core-data-expertWhat is this skill?
- 60-second triage template for setup, bugfix, migration, performance, or CloudKit goals
- Hard rules: NSManagedObjectID across contexts—never pass NSManagedObject instances
- Lightweight vs staged migration (iOS 17+) guidance with persistent history for batch/UI sync
- CloudKit reminders including immutable Production schema constraints
- OS/deployment-target aware advice for iOS 14+/17+ feature availability
- First-60-seconds triage template with seven agent behavior contract rules
- Staged migration guidance tied to iOS 17+ availability
Adoption & trust: 1.7k installs on skills.sh; 272 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are shipping a native Apple app but Core Data crashes, slow fetches, botched migrations, or CloudKit sync surprises keep blocking progress.
Who is it for?
Indie iOS/macOS developers debugging real store setups, background contexts, or CloudKit-enabled persistence.
Skip if: Teams building server-only APIs, Android-only apps, or greenfield projects that plan to skip Core Data entirely.
When should I use this skill?
You need Core Data stack setup, fetch/save fixes, threading under Swift Concurrency, batch operations, migrations, performance tuning, or NSPersistentCloudKitContainer/CloudKit sync on iOS/macOS.
What do I get? / Deliverables
You get stack-specific, context-safe fixes and migration choices you can apply in Xcode before the next test build or TestFlight cut.
- Context-safe save/fetch recommendations
- Migration strategy (lightweight vs staged)
- CloudKit and batch-operation checklist aligned to your store type
Recommended Skills
Journey fit
Core Data is the persistence layer you implement while building a native Apple app, before you can safely ship or iterate in production. Stack setup, fetch/save semantics, threading, migrations, and NSPersistentCloudKitContainer are backend data concerns, not UI polish or distribution.
How it compares
Expert procedural guidance for Apple persistence—not a generic SQL ORM cheat sheet or a one-shot code generator.
Common Questions / FAQ
Who is core-data-expert for?
Solo and indie builders shipping iOS or macOS apps who own the Core Data stack and need production-grade answers on threading, migrations, batch work, and optional CloudKit sync.
When should I use core-data-expert?
Use it in Build (backend) while designing the store, fixing save/merge crashes, planning migrations, improving fetch performance, or validating CloudKit integration—especially before you cut a release candidate.
Is core-data-expert safe to install?
Treat it like any third-party agent skill: review the Security Audits panel on this Prism page and confirm the package source before wiring it into your coding agent.
SKILL.md
READMESKILL.md - Core Data Expert
# Core Data Expert Fast, production-oriented guidance for building **correct**, **performant** Core Data stacks and fixing common crashes. ## Agent behavior contract (follow these rules) 1. Determine OS/deployment target when advice depends on availability (iOS 14+/17+ features, etc.). 2. Identify the context type before proposing fixes: **view context (UI)** vs **background context (heavy work)**. 3. Recommend `NSManagedObjectID` for cross-context/cross-task communication; **never pass `NSManagedObject` instances** across contexts. 4. Prefer lightweight migration when possible; use staged migration (iOS 17+) for complex changes. 5. When recommending batch operations, verify persistent history tracking is enabled (often required for UI updates). 6. For CloudKit integration, remind developers that **Production schema is immutable**. 7. Reference WWDC/external resources sparingly; prefer this skill’s `references/`. ## First 60 seconds (triage template) - **Clarify the goal**: setup, bugfix, migration, performance, CloudKit? - **Collect minimal facts**: - platform + deployment target - store type (SQLite / in-memory) and whether CloudKit is enabled - context involved (view vs background) and whether Swift Concurrency is in use - exact error message + stack trace/logs - **Branch immediately**: - threading/crash → focus on context confinement + `NSManagedObjectID` handoff - migration error → identify model versions + migration strategy - batch ops not updating UI → persistent history tracking + merge pipeline ## Routing map (pick the right reference fast) - **Stack setup / merge policies / contexts** → `references/stack-setup.md` - **Saving patterns** → `references/saving.md` - **Fetch requests / list updates / aggregates** → `references/fetch-requests.md` - **Traditional threading (perform/performAndWait, object IDs)** → `references/threading.md` - **Swift Concurrency (async/await, actors, Sendable, DAOs)** → `references/concurrency.md` - **Batch insert/delete/update** → `references/batch-operations.md` - **Persistent history tracking + “batch ops not updating UI”** → `references/persistent-history.md` - **Model configuration (constraints, validation, derived/composite, transformables)** → `references/model-configuration.md` - **Schema migration (lightweight/staged/deferred)** → `references/migration.md` - **CloudKit integration & debugging** → `references/cloudkit-integration.md` - **Performance profiling & memory** → `references/performance.md` - **Testing patterns** → `references/testing.md` - **Terminology** → `references/glossary.md` ## Common errors → next best move - **“Failed to find a unique match for an NSEntityDescription”** → `references/testing.md` (shared `NSManagedObjectModel`) - **`NSPersistentStoreIncompatibleVersionHashError`** → `references/migration.md` (versioning + migration) - **Cross-context/threading exceptions** (e.g. delete/update from wrong context) → `references/threading.md` and/or `references/concurrency.md` (use `NSManagedObjectID`) - **Sendable / actor-isolation warnings around Core Data** → `references/concurrency.md` (don’t “paper over” with `@unchecked Sendable`) - **`NSMergeConflict` / constraint violations** → `references/model-configuration.md` + `references/stack-setup.md` (constraints + merge policy) - **Batch operations not updating UI** → `references/persistent-history.md` + `references/batch-operations.md` - **CloudKit schema/sync issues** → `references/cloudkit-integration.md` - **Memory grows during fetch** → `references/performance.md` + `references/fetch-requests.md` ## Verification checklist (when changing Core Data code) - Confirm the context matches t