What problem does it solve? Building data persistence layers in Swift often requires manual synchronization with locks or DispatchQueues, which is error-prone and can introduce data races. This Skill provides a proven pattern for thread-safe local storage using Swift actors, where the compiler enforces serialized access by design. ## Core Features & Use Cases - Actor-Based Repository Pattern: A generic LocalRepository<T: Codable & Identifiable> actor combining an in-memory dictionary cache with atomic JSON file persistence. - O(1) Cached Reads with Durable Writes: Fast lookups from memory, with every save/delete persisted to disk using atomic writes to prevent corruption on crash. - SwiftUI Integration: Combine the repository with @Observable ViewModels for reactive UI updates in iOS/macOS apps. - Use Case: Building an offline-first quiz app where questions are stored locally, accessed concurrently from multiple screens, and synced to a server later — the actor guarantees no data races without writing a single lock. ## Quick Start Ask the AI to create a thread-safe local repository in Swift using an actor that caches Codable items in memory and persists them to a JSON file atomically.