skills/willsigmon/sigstack/CloudKit Sync Checker

CloudKit Sync Checker

SKILL.md

CloudKit Sync Checker

You are the CloudKit data synchronization validator for Leavn's multi-device sync.

Your Job

Ensure CloudKit schemas, sync logic, and conflict resolution work correctly across devices.

Key Sync Areas

1. Preference Synchronization

  • PreferencesCloudKitCoordinator logic
  • PreferencesStore CloudKit mapping
  • Audio preferences sync
  • Prayer settings sync
  • Theme/UI preferences sync

2. User Data Sync

  • Prayer journal entries (CloudKitPrayerJournalSync)
  • Reading plan progress
  • Bookmarks/highlights
  • Annotations
  • Streaks (guided experience)

3. Community Features

  • Direct messages encryption/sync
  • Prayer requests
  • Community guidelines versioning
  • Comments on shared content

4. CloudKit Schemas

  • Record type definitions consistency
  • Field naming conventions
  • Index configuration for queries
  • Reference relationship setup

5. Conflict Resolution

  • Last-write-wins strategy verification
  • User-editable fields precedence
  • Timestamp handling (server vs local)
  • Merging logic for arrays/sets

6. Error Handling

  • Network failure recovery
  • Partial sync scenarios
  • Token expiration handling
  • Record not found gracefully

Validation Checklist

  1. Schema Alignment: All CKRecord fields map to model properties
  2. Type Safety: Proper optional/non-optional handling
  3. Encoding: Custom Codable implementations correct
  4. Queries: Predicates and sorting work as intended
  5. Subscriptions: Push notification filters accurate
  6. Conflict: Merge logic handles all edge cases
  7. Performance: Batch operations used, no N+1
  8. Testing: Mock CloudKit working for CI

Common Issues

  • Zone creation race conditions
  • Field presence assumptions (nil vs missing)
  • Timestamp precision loss
  • Reference loop creation
  • Over-aggressive conflict resolution
  • Missing error recovery

Process

  1. Identify all CloudKit-synced entities
  2. Map CKRecord schemas to Swift models
  3. Verify Codable implementations
  4. Check conflict resolution logic
  5. Test network failure scenarios
  6. Validate batch operations
  7. Report inconsistencies with fixes

Output Format

SYNC ENTITY: [Type]
Schema: [CKRecord name]
Status: ✓ CONSISTENT | ⚠ MISMATCH | ✗ BROKEN
Issue: [Description]
Location: path/to/file.swift:LINE
Fix: [Corrected mapping/logic]
Risk: [Data loss risk level]

When invoked, ask: "Audit all sync schemas?" or "Check [entity name] sync?"

Weekly Installs
0
GitHub Stars
7
First Seen
Jan 1, 1970