home / skills / willsigmon / sigstack / cloudkit-expert
This skill analyzes CloudKit sync design, conflict resolution, and offline strategies to optimize multi-device data consistency and resilience.
npx playbooks add skill willsigmon/sigstack --skill cloudkit-expertReview the files below or copy the command above to add this skill to your agents.
---
name: CloudKit Expert
description: CloudKit sync - schema design, conflict resolution, offline support, multi-device sync validation
allowed-tools: Read, Edit, Grep
---
# CloudKit Expert
CloudKit architecture for Leavn's multi-device sync.
## Core Concepts
- **Containers**: App's CloudKit namespace
- **Databases**: Private (user), Public (shared), Shared (collaboration)
- **Record Types**: Schema definitions
- **Zones**: Custom zones for atomic operations
## Sync Architecture
1. Local SwiftData/CoreData as source of truth
2. CloudKit as sync transport
3. CKSyncEngine for automatic sync (iOS 17+)
## Conflict Resolution
- **Last-write-wins**: Simple, may lose data
- **Field-level merge**: Merge non-conflicting fields
- **Custom resolver**: App-specific logic
## Offline Support
- Queue changes locally when offline
- Sync when connectivity restored
- Handle partial sync failures
## Validation Checklist
- [ ] Schema matches local model
- [ ] Indexes on query fields
- [ ] Conflict handling tested
- [ ] Offline → online sync works
- [ ] Delete propagation correct
Use when: CloudKit bugs, sync issues, schema design, conflict resolution
This skill helps design, validate, and troubleshoot CloudKit sync for multi-device apps. I focus on schema alignment, conflict resolution strategies, offline handling, and practical validation steps to ensure reliable sync across private, public, and shared databases. The guidance targets TypeScript-backed tooling and iOS architectures using SwiftData/CoreData with CloudKit as transport.
I inspect your CloudKit schema and compare it with the local model to find mismatches and missing indexes. I evaluate your conflict resolution approach (last-write-wins, field-level merge, or custom resolvers) and recommend changes. I review offline queuing and retry logic, and validate end-to-end sync using a checklist that covers zones, record types, and delete propagation. I also provide test plans for multi-device sync validation and partial failure scenarios.
How do I choose between last-write-wins and custom merging?
Use last-write-wins for simple, infrequently edited records. Choose field-level or custom merging when different fields are updated independently or domain rules require preserving specific values.
What should I test for offline support?
Persist pending changes, simulate network loss and restoration, verify retry/backoff, and confirm partial syncs don’t corrupt state.
How do I verify schema compatibility?
Compare local model types, required fields, and indexes with CloudKit schema. Run migration tests and ensure record type versions are backward compatible.