megastep/codex-skills/axiom-cloud-sync
Claude Code and agent skill by megastep/codex-skills
- community
Checking that the SKILL.md file is still in the repository.
Use when choosing between CloudKit vs iCloud Drive, implementing reliable sync, handling offline-first patterns, or designing sync architecture - prevents common sync mistakes that cause data loss
Install
npx vskill@latest install megastep/codex-skills/axiom-cloud-syncSKILL.md
The same SKILL.md was published earlier as megastep/codex-skills/axiom-cloud-sync.
Cloud Sync
Overview
Core principle: Choose the right sync technology for the data shape, then implement offline-first patterns that handle network failures gracefully.
Two fundamentally different sync approaches:
- CloudKit — Structured data (records with fields and relationships)
- iCloud Drive — File-based data (documents, images, any file format)
Quick Decision Tree
CloudKit vs iCloud Drive
| Aspect | CloudKit | iCloud Drive | |
|---|---|---|---|
| Data shape | Structured records | Files/documents | |
| Query support | Full query language | Filename only | |
| Relationships | Native support | None (manual) | |
| Conflict resolution | Record-level | File-level | |
| User visibility | Hidden from user | Visible in Files app | |
| Sharing | Record/database sharing | File sharing | |
| Offline | Local cache required | Automatic download |
Red Flags
If ANY of these appear, STOP and reconsider:
- ❌ "Store JSON files in CloudKit" — Wrong tool. Use iCloud Drive for files
- ❌ "Build relationships manually in iCloud Drive" — Wrong tool. Use CloudKit
- ❌ "Assume sync is instant" — Network fails. Design offline-first
- ❌ "Skip conflict handling" — Conflicts WILL happen on multiple devices
- ❌ "Use CloudKit for user documents" — Users can't see them. Use iCloud Drive
- ❌ "Sync on app launch only" — Users expect continuous sync
Offline-First Pattern
MANDATORY: All sync code must work offline first.
Conflict Resolution Strategies
Conflicts occur when two devices edit the same data before syncing.
Strategy 1: Last-Writer-Wins (Simplest)
Use when: Data is non-critical, user won't notice overwrites
Strategy 2: Merge (Most Common)
Use when: Both versions contain valuable changes
Strategy 3: User Choice
Use when: Data is critical, user must decide
Common Patterns
Pattern 1: SwiftData + CloudKit (Recommended for New Apps)
Limitations:
- Private database only (no public/shared)
- Automatic sync (less control over timing)
- No custom conflict resolution
Pattern 2: CKSyncEngine (Custom Persistence)
See axiom-cloudkit-ref for complete CKSyncEngine setup.
Pattern 3: iCloud Drive Documents
See axiom-icloud-drive-ref for NSFileCoordinator and conflict handling.
Anti-Patterns
1. Ignoring Sync State
2. Blocking UI on Sync
3. No Retry Logic
Sync State Indicators
Always show users the sync state:
Entitlement Checklist
Before sync will work:
- Xcode → Signing & Capabilities
- ✓ iCloud capability added
- ✓ CloudKit checked (for CloudKit)
- ✓ iCloud Documents checked (for iCloud Drive)
- ✓ Container selected/created
- Apple Developer Portal
- ✓ App ID has iCloud capability
- ✓ CloudKit container exists (for CloudKit)
- Device
- ✓ Signed into iCloud
- ✓ iCloud Drive enabled (Settings → [Name] → iCloud)
Large Dataset Sync
When syncing 10,000+ records, naive approaches cause timeouts and launch slowdowns.
Initial Sync Strategy
Incremental Sync (After Initial)
CKSyncEngine handles incremental sync automatically — it fetches only changes since the last sync token. Ensure you persist stateSerialization so the engine doesn't re-fetch everything on next launch.
Performance Guidelines
| Dataset Size | Strategy | Notes | |
|---|---|---|---|
| < 1,000 records | Default CKSyncEngine | Works out of the box | |
| 1,000–10,000 | Batch initial sync | 200-record batches, show progress UI | |
| 10,000+ | Pagination + background | Use BGProcessingTask for initial sync | |
| 100,000+ | Server-side filtering | Only sync what user needs, lazy-load rest |
Key insight: Initial sync is the bottleneck. After initial sync, CKSyncEngine's incremental approach handles large datasets efficiently because it only fetches deltas.
Pressure Scenarios
Scenario 1: "Just skip conflict handling for v1"
Situation: Deadline pressure to ship without conflict resolution.
Risk: Users WILL edit on multiple devices. Data WILL be lost silently.
Response: "Minimum viable conflict handling takes 2 hours. Silent data loss costs users and generates 1-star reviews."
Scenario 2: "Sync on app launch is enough"
Situation: Avoiding continuous sync complexity.
Risk: Users expect changes to appear within seconds, not on next launch.
Response: Use CKSyncEngine or SwiftData which handle continuous sync automatically.
Related Skills
axiom-cloudkit-ref— Complete CloudKit API referenceaxiom-icloud-drive-ref— File-based sync with NSFileCoordinatoraxiom-cloud-sync-diag— Debugging sync failuresaxiom-storage— Choosing where to store data locally
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingaxiom-cloud-sync/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/megastep/codex-skills/axiom-cloud-sync)