/core-data-pro:core-data-profrom core-data-pro
Provides guidance on Core Data best practices including entity modeling, NSPersistentContainer setup, background context threading, efficient fetch requests with predicates, batch operations, and lightweight migrations.
Ships in core-data-pro. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use Core Data correctly: safe contexts, efficient fetches, clean migrations. (For new
apps, also consider SwiftData — see swiftdata-pro.)
Trigger: /core-data-pro.
NSManagedObjects belong to their context — don't pass them across threads, pass IDs.let container = NSPersistentContainer(name: "Model")
container.loadPersistentStores { _, error in
if let error { fatalError("Store load failed: \(error)") }
}
container.viewContext.automaticallyMergesChangesFromParent = true
❌ Background work on the view context (crashes / corruption)
DispatchQueue.global().async {
let obj = Item(context: container.viewContext) // wrong queue
}
✅ Background context with perform
container.performBackgroundTask { context in
let obj = Item(context: context)
obj.title = "New"
try? context.save() // merges into viewContext automatically
}
Pass object IDs across contexts, not objects:
let id = obj.objectID
container.performBackgroundTask { ctx in
let bgObj = ctx.object(with: id)
}
❌ Fetch everything, filter in Swift
let all = try context.fetch(Item.fetchRequest())
let recent = all.filter { $0.date > cutoff } // loads the whole table
✅ Predicate + sort + limit in the request
let req = Item.fetchRequest()
req.predicate = NSPredicate(format: "date > %@", cutoff as NSDate)
req.sortDescriptors = [NSSortDescriptor(key: "date", ascending: false)]
req.fetchLimit = 50
let recent = try context.fetch(req)
Use fetchBatchSize for large lists; NSFetchedResultsController (UIKit) or
@FetchRequest (SwiftUI) for table/list binding.
For bulk delete/update, skip loading objects into memory:
let delete = NSBatchDeleteRequest(fetchRequest: Item.fetchRequest())
try context.execute(delete)
// then merge changes into viewContext
shouldInferMappingModelAutomatically = true.NSEntityMigrationPolicy. Never edit a
shipped model version in place; add a new version.perform).NSManagedObjects across threads instead of objectID.NSPredicate.fetchLimit/fetchBatchSize on large fetches.NSBatchDeleteRequest.Per issue: file:line, rule, before/after. Lead with threading violations (crash risk) and migration hazards.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub laxrajpurohit/swift-skills-pro --plugin core-data-pro