# core-data

A skill for Core Data work in apps that have not moved to SwiftData: stack setup, concurrency, batch operations and migrations.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2700 installs · ★ 1237
- Author: dpearson2699
- License: LicenseRef-Unknown · policy=link-only · description only; the file stays with the author
- Source: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/core-data/SKILL.md
- Updated: 2026-07-31
- HTML: https://affpapa.org/en/nevibecode/skills/core-data

## What it does

The skill covers building a stack on `NSPersistentContainer` and keeping contexts off each other's queues. Its rules are blunt: reach a context through `perform`, hand `NSManagedObjectID` across threads and re-fetch, and turn on change merging for `viewContext`.

Other sections deal with `NSFetchedResultsController` driving a `UITableView` or `UICollectionView`, bulk inserts and deletes, persistent history tracking, staged schema migration and testing. There is a common-mistakes list and a review checklist. One hard requirement: a fetched results controller needs at least one sort descriptor, so a request without one will not work.

This is Swift work. Without familiarity with `NSManagedObject` and `NSFetchRequest` the material will not carry you far. If Core Data and SwiftData have to live together, the author points you to the `swiftdata` skill.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill core-data -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/core-data/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/core-data/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill core-data -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/core-data/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill core-data -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/core-data/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install dpearson2699/swift-ios-skills core-data
```

2. **Manually: put the files in place**
- File: `.github/skills/core-data/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill core-data -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/core-data
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/core-data/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill core-data -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/core-data/SKILL.md

## When to use it
- Set up a Core Data stack that survives background writes
- Drive a list view from `NSFetchedResultsController`
- Run a bulk import without loading objects into memory
- Wire persistent history for multi-target sync
- Break a schema migration into stages

## Example prompts
- Set up a Core Data stack with a background context for writes
- Review my `NSFetchedResultsController`, the list does not refresh after a save
- Rewrite this import as a batch insert with `NSBatchInsertRequest`

## Similar
- [vercel-react-native-skills](https://affpapa.org/en/nevibecode/skills/vercel-react-native-skills.md) — skill · 255200 installs
- [animate-expo](https://affpapa.org/en/nevibecode/skills/animate-expo.md) — skill · 137900 installs
- [mobile-native](https://affpapa.org/en/nevibecode/skills/mobile-native.md) — skill · 86600 installs
- [aso](https://affpapa.org/en/nevibecode/skills/aso.md) — skill · 75400 installs
- [swiftui-pro](https://affpapa.org/en/nevibecode/skills/swiftui-pro.md) — skill · 35200 installs
- [orca-emulator](https://affpapa.org/en/nevibecode/skills/orca-emulator.md) — skill · 5800 installs

From the same set: [dpearson2699/swift-ios-skills](https://affpapa.org/en/nevibecode/by/dpearson2699/swift-ios-skills.md) — 86 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
