iOS Data & Persistence Router
You MUST use this skill for ANY data persistence, database, axiom-storage, CloudKit, or serialization work.
When to Use
Use this router when working with:
- Databases (SwiftData, Core Data, GRDB, SQLiteData)
- Schema migrations
- CloudKit sync
- File storage (iCloud Drive, local storage)
- Data serialization (Codable, JSON)
- Storage strategy decisions
- Keychain / secure credential storage
- Encryption, signing, key management (CryptoKit)
Routing Logic
SwiftData
Working with SwiftData β /skill axiom-swiftdata
Schema migration β /skill axiom-swiftdata-migration
Migration issues β /skill axiom-swiftdata-migration-diag
Migrating from Realm β /skill axiom-realm-migration-ref
SwiftData vs SQLiteData β /skill axiom-sqlitedata-migration
Other Databases
GRDB queries β /skill axiom-grdb
SQLiteData β /skill axiom-sqlitedata
Advanced SQLiteData β /skill axiom-sqlitedata-ref
Core Data patterns β /skill axiom-core-data
Core Data issues β /skill axiom-core-data-diag
Migrations
Database migration safety β /skill axiom-database-migration (critical - prevents data loss)
Serialization
Codable issues β /skill axiom-codable
Cloud Storage
Cloud sync patterns β /skill axiom-cloud-sync
CloudKit β /skill axiom-cloudkit-ref
iCloud Drive β /skill axiom-icloud-drive-ref
Cloud sync errors β /skill axiom-cloud-sync-diag
Keychain & Encryption
Keychain / secure credential storage β /skill axiom-keychain
Keychain errors β /skill axiom-keychain-diag
Keychain API reference β /skill axiom-keychain-ref
Encryption / signing / key management β /skill axiom-cryptokit
CryptoKit API reference β /skill axiom-cryptokit-ref
File Storage
Storage strategy β /skill axiom-storage
Storage issues β /skill axiom-storage-diag
Storage management β /skill axiom-storage-management-ref
File protection β /skill axiom-file-protection-ref
tvOS Storage
tvOS data persistence β /skill axiom-tvos (CRITICAL: no persistent local storage on tvOS)
tvOS + CloudKit β /skill axiom-sqlitedata (recommended: SyncEngine as persistent store)
Automated Scanning
Core Data audit β Launch core-data-auditor agent or /axiom:audit core-data (migration risks, thread-confinement, N+1 queries, production data loss)
Codable audit β Launch codable-auditor agent or /axiom:audit codable (try? swallowing errors, JSONSerialization, date handling)
iCloud audit β Launch icloud-auditor agent or /axiom:audit icloud (entitlement checks, file coordination, CloudKit anti-patterns)
Storage audit β Launch storage-auditor agent or /axiom:audit storage (wrong file locations, missing backup exclusions, data loss risks)
Decision Tree
- SwiftData? β swiftdata, swiftdata-migration
- Core Data? β core-data, core-data-diag
- GRDB? β grdb
- SQLiteData? β sqlitedata, sqlitedata-ref
- ANY schema migration? β database-migration (ALWAYS β prevents data loss)
- Realm migration? β realm-migration-ref
- SwiftData vs SQLiteData? β sqlitedata-migration
- Cloud sync architecture? β cloud-sync
- CloudKit? β cloudkit-ref
- iCloud Drive? β icloud-drive-ref
- Cloud sync errors? β cloud-sync-diag
- Codable/JSON serialization? β codable
- File storage strategy? β storage, storage-diag, storage-management-ref
- File protection? β file-protection-ref
- Keychain / storing tokens, passwords, secrets securely? β keychain, keychain-diag, keychain-ref
- SecItem errors (errSecDuplicateItem, errSecItemNotFound, errSecInteractionNotAllowed)? β keychain-diag
- Encryption, signing, Secure Enclave, CryptoKit? β cryptokit, cryptokit-ref
- Quantum-secure cryptography, HPKE, ML-KEM? β cryptokit
- Want Core Data safety scan? β core-data-auditor (Agent)
- Want Codable anti-pattern scan? β codable-auditor (Agent)
- Want iCloud sync audit? β icloud-auditor (Agent)
- Want storage location audit? β storage-auditor (Agent)
- tvOS data persistence? β axiom-tvos (CRITICAL: no persistent local storage) + axiom-sqlitedata (CloudKit SyncEngine)
Anti-Rationalization
| Thought |
Reality |
| "Just adding a column, no migration needed" |
Schema changes without migration crash users. database-migration prevents data loss. |
| "I'll handle the migration manually" |
Manual migrations miss edge cases. database-migration covers rollback and testing. |
| "Simple query, I don't need the skill" |
Query patterns prevent N+1 and thread-safety issues. The skill has copy-paste solutions. |
| "CloudKit sync is straightforward" |
CloudKit has 15+ failure modes. cloud-sync-diag diagnoses them systematically. |
| "I know Codable well enough" |
Codable has silent data loss traps (try? swallows errors). codable skill prevents production bugs. |
| "I'll use local storage on tvOS" |
tvOS has NO persistent local storage. System deletes Caches at any time. axiom-tvos explains the iCloud-first pattern. |
| "UserDefaults is fine for this token" |
UserDefaults is unencrypted, backed up to iCloud, and visible to MDM profiles. One audit catches it. keychain stores tokens securely. |
| "I'll encrypt it myself with CommonCrypto" |
CryptoKit replaced CommonCrypto's buffer-management nightmares with one-line APIs. cryptokit prevents misuse. |
Critical Pattern: Migrations
ALWAYS invoke /skill axiom-database-migration when adding/modifying database columns.
This prevents:
- "FOREIGN KEY constraint failed" errors
- "no such column" crashes
- Data loss from unsafe migrations
Example Invocations
User: "I need to add a column to my SwiftData model"
β Invoke: /skill axiom-database-migration (critical - prevents data loss)
User: "How do I query SwiftData with complex filters?"
β Invoke: /skill axiom-swiftdata
User: "CloudKit sync isn't working"
β Invoke: /skill axiom-cloud-sync-diag
User: "Should I use SwiftData or SQLiteData?"
β Invoke: /skill axiom-sqlitedata-migration
User: "Check my Core Data code for safety issues"
β Invoke: core-data-auditor agent
User: "Scan for Codable anti-patterns before release"
β Invoke: codable-auditor agent
User: "Audit my iCloud sync implementation"
β Invoke: icloud-auditor agent
User: "Check if my files are stored in the right locations"
β Invoke: storage-auditor agent
User: "How do I persist data on tvOS?"
β Invoke: /skill axiom-tvos + /skill axiom-sqlitedata
User: "My tvOS app loses data between launches"
β Invoke: /skill axiom-tvos
User: "How do I store an auth token securely?"
β Invoke: /skill axiom-keychain
User: "errSecDuplicateItem but I checked and the item doesn't exist"
β Invoke: /skill axiom-keychain-diag
User: "How do I encrypt data with AES in Swift?"
β Invoke: /skill axiom-cryptokit
User: "I need to sign data with the Secure Enclave"
β Invoke: /skill axiom-cryptokit
User: "What's ML-KEM and should I use it?"
β Invoke: /skill axiom-cryptokit