$npx skillfedfor your agent

core-data-expert

core-data-expert equips AI coding assistants with battle-tested Core Data patterns drawn from production WeTransfer apps and WWDC best practices. Navigate threading pitfalls, optimize query performance, and handle schema migrations with confidence—all through concise, agent-ready references designed for immediate triage and safe defaults.

core-data-expert recommends using NSManagedObjectContext with the correct concurrency type (privateQueue or mainQueue) and never accessing managed objects across threads without proper context confinement. For Swift Concurrency, wrap Core Data operations in context.perform or use @MainActor for main-thread contexts. Always fetch objects on the same context where you'll use them, and use objectID for cross-context references instead of passing NSManagedObject instances directly.

AI-generated summary based on this skill's SKILL.md

288 15 MITupdated by AvdLee

Decision gist · record as of 2026-03-02

core-data-expert recommends using NSManagedObjectContext with the correct concurrency type (privateQueue or mainQueue) and never accessing managed objects across threads without proper context confinement. For Swift Concurrency, wrap Core Data operations in context.perform or use @MainActor for main-thread contexts. Always fetch objects on the same context where you'll use them, and use objectID for cross-context references instead of passing NSManagedObject instances directly.

manual: git clone https://github.com/AvdLee/Core-Data-Agent-Skill → cp -r Core-Data-Agent-Skill/core-data-expert ~/.claude/skills/core-data-expert
core-data-expert/SKILL.md · version 4a93c980

Use it when

  • core-data-expert's recommended setup uses NSPersistentContainer, which handles the coordinator and store automatically.
  • core-data-expert advises wrapping all Core Data work in context.perform(schedule:_:) or context.performAndWait(_:) blocks.

Verify before relying

Read SKILL.md below before installing (16 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

AvdLee/Core-Data-Agent-Skill/core-data-expert

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I fix Core Data threading crash issues?

core-data-expert recommends using NSManagedObjectContext with the correct concurrency type (privateQueue or mainQueue) and never accessing managed objects across threads without proper context confinement. For Swift Concurrency, wrap Core Data operations in context.perform or use @MainActor for main-thread contexts. Always fetch objects on the same context where you'll use them, and use objectID for cross-context references instead of passing NSManagedObject instances directly.

What is the correct Core Data stack setup for iOS?

core-data-expert's recommended setup uses NSPersistentContainer, which handles the coordinator and store automatically. Create it once at app launch, typically in your app delegate or a singleton. For CloudKit sync, use NSPersistentCloudKitContainer instead. Always initialize on the main thread, then perform background operations via newBackgroundContext(). This pattern ensures thread safety and proper resource management from the start.

How do I use Core Data with Swift Concurrency?

core-data-expert advises wrapping all Core Data work in context.perform(schedule:_:) or context.performAndWait(_:) blocks, marking main-thread contexts with @MainActor. For async/await, use context.perform { @MainActor in ... } or create a background context and call its perform method. Ensure NSManagedObject subclasses conform to Sendable where needed, and never pass managed objects between isolation domains—use objectID instead.

What causes Core Data batch operations to not update the UI?

core-data-expert identifies the root cause: batch operations (NSBatchUpdateRequest, NSBatchDeleteRequest) bypass in-memory contexts, so NSFetchedResultsController and observers don't see changes. After a batch operation, either refresh the context with refreshAllObjects() or use persistent history tracking to merge changes back. For production apps, enable NSPersistentHistoryTrackingRequest and process history tokens to keep UI in sync.

How do I set up Core Data migration and resolve versioning errors?

core-data-expert recommends starting with lightweight migration (automatic schema mapping) by creating a new model version in Xcode and letting Core Data infer changes. For complex migrations, use staged migration or custom mapping models. Always increment the model version number and set the current version in the data model inspector. Test migrations on real device data; use persistent store coordinator options to enable automatic migration during container initialization.

How do I integrate CloudKit sync with NSPersistentCloudKitContainer?

core-data-expert advises replacing NSPersistentContainer with NSPersistentCloudKitContainer and enabling CloudKit capability in Xcode. Set a container identifier matching your iCloud container. Core Data handles sync automatically, but monitor CKQueryOperationMaximumResults and use persistent history tracking for conflict resolution. Test with CloudKit dashboard, handle network errors gracefully, and remember that CloudKit sync requires a valid iCloud account on device.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

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

(truncated - see the full file via the links below)

File tree — 15 files
core-data-expert/SKILL.md
core-data-expert/references/_index.md
core-data-expert/references/batch-operations.md
core-data-expert/references/cloudkit-integration.md
core-data-expert/references/concurrency.md
core-data-expert/references/fetch-requests.md
core-data-expert/references/glossary.md
core-data-expert/references/migration.md
core-data-expert/references/model-configuration.md
core-data-expert/references/performance.md
core-data-expert/references/persistent-history.md
core-data-expert/references/project-audit.md
core-data-expert/references/saving.md
core-data-expert/references/stack-setup.md
core-data-expert/references/testing.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Fix Core Data threading crashes and context confinement issues”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

Core Data
by dpearson2699 · dpearson2699/swift-ios-skills

Core Data is Apple's object-oriented database framework for managing persistent storage in iOS applications. This skill covers the essential concepts, architecture, and implementation patterns you need to build robust data layers. Explore how to model entities, perform queries, and optimize performance in your apps.

no license declared → metadata onlyupdated Jul 2026
★ 932repo stars
swift-concurrency
by AvdLee · AvdLee/Swift-Concurrency-Agent-Skill

This skill helps developers resolve Swift concurrency compiler diagnostics, data-race warnings, and isolation boundary issues. It provides structured guidance for refactoring callback-based code to async/await patterns and supports Swift 6 migration across tasks, actors, @MainActor, Sendable conformance, and thread-safety concerns. The skill emphasizes smallest-safe-change fixes grounded in project settings and isolation context.

MITupdated May 2026
★ 1,604repo stars
swiftdata-expert-skill
by vanab · vanab/SwiftData-agent-skill

Get specialized guidance on building robust SwiftData architectures for Swift projects. This skill covers schema design, safe concurrency patterns, migration strategies, and CloudKit synchronization—all tailored for AI coding assistants working with SwiftData-first applications.

MITupdated Feb 2026
★ 12repo stars
swift-code-review
by existential-birds · existential-birds/beagle

This skill systematically audits Swift source files for concurrency hazards, including unsafe async/await patterns, actor reentrancy, Sendable conformance gaps, and memory leaks from retain cycles. It establishes Swift language version context upfront, reads full enclosing symbols rather than diffs alone, and applies targeted checklists for error handling, force unwraps, and closure capture semantics before reporting findings.

Apache-2.0updated Jul 2026
★ 74repo stars
persistence-setup
by rshankras · rshankras/claude-code-apple-skills

This skill guides you through establishing a robust data persistence layer for Apple platform apps. Whether you're choosing between SwiftData and CoreData or implementing either framework, it provides structured setup patterns and best practices tailored to iOS, macOS, and other Apple platforms. Get your app's storage foundation right from the start.

MITupdated Jul 2026
★ 565repo stars
Swiftdata
by dpearson2699 · dpearson2699/swift-ios-skills

Swiftdata is a skill that enables agent integration with Swiftdata services. Use this skill to connect your agent to Swiftdata and unlock data handling capabilities within your workflows.

no license declared → metadata onlyupdated Jul 2026
★ 932repo stars

More skills axiom-concurrency (MIT)

Tags
ios-databaseconcurrency-patternsdata-persistencecloudkit-syncmigration-strategythread-safetyperformance-tuningconflict-resolutionbatch-processingschema-management