# cloudkit

Guides CloudKit and iCloud sync setup in iOS and macOS apps, covering SwiftData, CKSyncEngine, and conflict resolution.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 3300 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/cloudkit/SKILL.md
- Updated: 2026-07-31
- HTML: https://affpapa.org/en/nevibecode/skills/cloudkit

## What it does

This skill supplies patterns for integrating Apple cloud sync in Swift projects. It details container setup across public, private, and shared databases, as well as record operations with `CKRecord`. You also get workflows for custom record zones, which track changes atomically in private storage.

Querying relies on `NSPredicate`, with reminders about field encryption limits: encrypted values cannot be filtered or sorted in `CKQuery`. For modern apps, it covers `CKSyncEngine` on iOS 17+ alongside background change notifications via `CKSubscription`.

Each `CKRecord` caps out at 1 MB excluding `CKAsset` files. When sync operations fail, the skill explicitly warns against restarting full sync runs, guiding you to inspect the specific `CKError` instead.

## Install

### Claude Code (native platform)

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

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

### Codex

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

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

### Cursor

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

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

### GitHub Copilot

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

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

### Gemini CLI

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

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

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill cloudkit -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/cloudkit/SKILL.md

## When to use it
- sync SwiftData models to CloudKit databases
- handle CKError codes and merge conflicting records
- build NSPredicate filters for CKQuery searches
- configure CKSubscription push notifications for silent sync
- implement CKSyncEngine for iOS 17+ state tracking

## Example prompts
- Show how to create and save records in a custom CKRecordZone
- Help me resolve CKError conflict errors during batch sync
- Configure CKSyncEngine to handle remote changes in iOS 17

## Similar
- [core-data-expert](https://affpapa.org/en/nevibecode/skills/core-data-expert.md) — skill · 2500 installs
- [guide-swiftdata](https://affpapa.org/en/nevibecode/skills/guide-swiftdata.md) — skill · 435 installs
- [clerk-swift](https://affpapa.org/en/nevibecode/skills/clerk-swift.md) — skill · 14500 installs
- [cmux-architecture](https://affpapa.org/en/nevibecode/skills/cmux-architecture.md) — skill · 4900 installs
- [swiftui-patterns](https://affpapa.org/en/nevibecode/skills/affaan-m-swiftui-patterns.md) — skill · 4600 installs
- [swift-expert](https://affpapa.org/en/nevibecode/skills/swift-expert.md) — skill · 4100 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
