Agent skill
core-data-expert
Expert Core Data guidance (iOS/macOS): stack setup, fetch requests & NSFetchedResultsController, saving/merge conflicts, threading & Swift Concurrency, batch operations & persistent history, migrations, performance, and NSPersistentCloudKitContainer/CloudKit sync.
Install this agent skill to your Project
npx add-skill https://github.com/AvdLee/Core-Data-Agent-Skill/tree/main/core-data-expert
SKILL.md
Core Data Expert
Fast, production-oriented guidance for building correct, performant Core Data stacks and fixing common crashes.
Agent behavior contract (follow these rules)
- Determine OS/deployment target when advice depends on availability (iOS 14+/17+ features, etc.).
- Identify the context type before proposing fixes: view context (UI) vs background context (heavy work).
- Recommend
NSManagedObjectIDfor cross-context/cross-task communication; never passNSManagedObjectinstances across contexts. - Prefer lightweight migration when possible; use staged migration (iOS 17+) for complex changes.
- When recommending batch operations, verify persistent history tracking is enabled (often required for UI updates).
- For CloudKit integration, remind developers that Production schema is immutable.
- 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 +
NSManagedObjectIDhandoff - migration error → identify model versions + migration strategy
- batch ops not updating UI → persistent history tracking + merge pipeline
- threading/crash → focus on context confinement +
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(sharedNSManagedObjectModel) NSPersistentStoreIncompatibleVersionHashError→references/migration.md(versioning + migration)- Cross-context/threading exceptions (e.g. delete/update from wrong context) →
references/threading.mdand/orreferences/concurrency.md(useNSManagedObjectID) - 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 the work (UI vs background).
- Ensure
NSManagedObjectinstances never cross contexts; passNSManagedObjectIDinstead. - If using batch ops, confirm persistent history tracking + merge pipeline.
- If using constraints, confirm merge policy and conflict resolution strategy.
- If performance-related, profile with Instruments and validate fetch batching/limits.
Reference files
references/_index.md(navigation)references/stack-setup.mdreferences/saving.mdreferences/fetch-requests.mdreferences/threading.mdreferences/concurrency.mdreferences/batch-operations.mdreferences/persistent-history.mdreferences/model-configuration.mdreferences/migration.mdreferences/cloudkit-integration.mdreferences/performance.mdreferences/testing.mdreferences/glossary.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
swift-concurrency
Diagnose data races, convert callback-based code to async/await, implement actor isolation patterns, resolve Sendable conformance issues, and guide Swift 6 migration. Use when developers mention: (1) Swift Concurrency, async/await, actors, or tasks, (2) "use Swift Concurrency" or "modern concurrency patterns", (3) migrating to Swift 6, (4) data races or thread safety issues, (5) refactoring closures to async/await, (6) @MainActor, Sendable, or actor isolation, (7) concurrent code architecture or performance optimization, (8) concurrency-related linter warnings (SwiftLint or similar; e.g. async_without_await, Sendable/actor isolation/MainActor lint).
update-swiftui-apis
Scan Apple's SwiftUI documentation for deprecated APIs and update the SwiftUI Expert Skill with modern replacements. Use when asked to "update latest APIs", "refresh deprecated SwiftUI APIs", "check for new SwiftUI deprecations", "scan for API changes", or after a new iOS/Xcode release. Requires the Sosumi MCP to be available.
swiftui-expert-skill
Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, macOS-specific APIs, and iOS 26+ Liquid Glass adoption. Use when building new SwiftUI features, refactoring existing views, reviewing code quality, or adopting modern SwiftUI patterns.
matlab-uihtml-app-builder
Build interactive web applications using HTML/JavaScript interfaces with MATLAB computational backends via the uihtml component. Use when creating HTML-based MATLAB apps, JavaScript MATLAB interfaces, web UIs with MATLAB, interactive MATLAB GUIs, or when user mentions uihtml, HTML, JavaScript, web apps, or web interfaces.
matlab-test-creator
Create comprehensive MATLAB unit tests using the MATLAB Testing Framework. Use when generating test files, test cases, unit tests, or when the user requests testing for MATLAB code, functions, or classes.
matlab-test-execution
Run MATLAB tests, analyze results, collect code coverage, and set up CI/CD pipelines. Use when executing tests, filtering test suites, debugging test failures, generating coverage reports, or configuring buildtool and CI systems for MATLAB projects.
Didn't find tool you were looking for?