core-data-expert
252
总安装量
252
周安装量
#1076
全站排名
安装命令
npx skills add https://github.com/avdlee/core-data-agent-skill --skill core-data-expert
Agent 安装分布
codex
186
opencode
171
gemini-cli
148
claude-code
135
amp
120
Skill 文档
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