core-data-pro

core-data-pro is a skill for Claude Code from laxrajpurohit/swift-skills-pro. It costs 31 tokens per session (821 once invoked), scanned A, original, MIT.

A guide to using Core Data, Apple’s framework for storing and querying app data. It covers data models, persistent storage setup, background work, searches, bulk operations, and migrations between model versions.

In plain words
What is it for?
Use it when building or repairing a Core Data stack, importing data in the background, optimizing fetches, performing batch operations, or changing the stored data model.
Why use it?
It helps avoid crashes and corrupted data caused by using Core Data on the wrong thread, as well as slow searches and failed data migrations.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the core-data-pro plugin — 1 skill shipped together

Good fit Use it when building or repairing a Core Data stack, importing data in the background, optimizing fetches, performing batch operations, or changing the stored data model.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/laxrajpurohit/swift-skills-pro/core-data-pro
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add laxrajpurohit/swift-skills-pro --skill core-data-pro
Clone the repo
git clone --depth 1 https://github.com/laxrajpurohit/swift-skills-pro

Made for: Claude Code.

Or install core-data-pro, the plugin that ships this one along with the rest of its 1 skill.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for core-data-pro

README.md
[![agentmods](https://agentmods.dev/badge/skills/laxrajpurohit/swift-skills-pro/core-data-pro/github.svg)](https://agentmods.dev/skills/laxrajpurohit/swift-skills-pro/core-data-pro)
Your own site
<a href="https://agentmods.dev/skills/laxrajpurohit/swift-skills-pro/core-data-pro"><img src="https://agentmods.dev/badge/skills/laxrajpurohit/swift-skills-pro/core-data-pro/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for core-data-pro

Your own site · 80×15
<a href="https://agentmods.dev/skills/laxrajpurohit/swift-skills-pro/core-data-pro"><img src="https://agentmods.dev/badge/skills/laxrajpurohit/swift-skills-pro/core-data-pro.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 821 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.00821
Opus 5 $0.00015 $0.00411
Sonnet 5 $0.00006 $0.00164
Haiku 4.5 $0.00003 $0.00082

Measured 12d ago against content hash 1d600be01a46, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

core-data-pro scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

let all = try context.fetch(Item.fetchRequest())
core-data-pro/skills/core-data-pro/SKILL.md · 112 lines

How it starts

The opening of the file, as written. The whole thing — 112 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Core Data Pro

Use Core Data correctly: safe contexts, efficient fetches, clean migrations. (For new apps, also consider SwiftData — see swiftdata-pro.)

When to use

  • Existing Core Data stacks, or apps needing fine-grained control.
  • Fixing threading crashes, slow fetches, or migration failures.

Trigger: /core-data-pro.

Core principles

  • The view context is main-queue only; never touch it off the main thread.
  • Do writes/imports on a background context, then merge.
  • NSManagedObjects belong to their context — don't pass them across threads, pass IDs.
  • Fetch only what you need (predicates, limits, batching).

Stack setup

let container = NSPersistentContainer(name: "Model")
container.loadPersistentStores { _, error in
    if let error { fatalError("Store load failed: \(error)") }
}
container.viewContext.automaticallyMergesChangesFromParent = true

Threading

❌ 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)
}

Fetching efficiently

❌ 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.

Read the full file on GitHub · 112 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 112 lines · 31 tokens per session scan A 1d600be01a46

Subscribe to this mod's changes

core-data-pro is a skill published in the GitHub repository laxrajpurohit/swift-skills-pro (5 stars, last pushed 3mo ago), licensed MIT. It adds 31 tokens to every session and 821 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.