Use when debugging schema migration crashes, concurrency thread-confinement errors, N+1 query performance, SwiftData to Core Data bridging, or testing migrations without data loss - systematic Core Data diagnostics with safety-first migration patterns
View on GitHubSelect agents to install to:
npx add-skill https://github.com/CharlesWiltgen/Axiom/blob/main/.claude-plugin/plugins/axiom/skills/axiom-core-data-diag/SKILL.md -a claude-code --skill axiom-core-data-diagInstallation paths:
.claude/skills/axiom-core-data-diag/# Core Data Diagnostics & Migration ## Overview Core Data issues manifest as production crashes from schema mismatches, mysterious concurrency errors, performance degradation under load, and data corruption from unsafe migrations. **Core principle** 85% of Core Data problems stem from misunderstanding thread-confinement, schema migration requirements, and relationship query patterns—not Core Data defects. ## Red Flags — Suspect Core Data Issue If you see ANY of these, suspect a Core Data misunderstanding, not framework breakage: - Crash on production launch: "Unresolvable fault" after schema change - Thread-confinement error: "Accessing NSManagedObject on a different thread" - App suddenly slow after adding a User→Posts relationship - SwiftData app needs complex features; considering mixing Core Data alongside - Schema migration works in simulator but crashes on production - ❌ **FORBIDDEN** "Core Data is broken, we need a different database" - Core Data handles trillions of records in production apps - Schema mismatches and thread errors are always developer code, not framework - Do not rationalize away the issue—diagnose it **Critical distinction** Simulator deletes the database on each rebuild, hiding schema mismatch issues. Real devices keep persistent databases and crash immediately on schema mismatch. **MANDATORY: Test migrations on real device with real data before shipping.** ## Mandatory First Steps **ALWAYS run these FIRST** (before changing code): ```swift // 1. Identify the crash/issue type // Screenshot the crash message and note: // - "Unresolvable fault" = schema mismatch // - "different thread" = thread-confinement // - Slow performance = N+1 queries or fetch size issues // - Data corruption = unsafe migration // Record: "Crash type: [exact message]" // 2. Check if it's schema mismatch // Compare these: let coordinator = persistentStoreCoordinator let model = coordinator.managedObjectModel let store = coordinator.persistentStore