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 reusable actor-based repository pattern that guarantees thread-safe access to shared mutable state, enforced by the Swift compiler. ## Core Features & Use Cases - Actor-Based Repository: A generic LocalRepository<T: Codable & Identifiable> actor combining an in-memory dictionary cache with atomic JSON file persistence. - Compiler-Enforced Safety: Eliminates data races by design through Swift's actor isolation, removing the need for NSLock or DispatchQueue. - SwiftUI Integration: Includes a pattern for combining the repository with @Observable ViewModels for reactive UI updates. - Use Case: Building an offline-first iOS quiz app where questions are cached in memory for O(1) reads and atomically persisted to disk, with multiple app components accessing the data concurrently. ## Quick Start Ask the AI to create a thread-safe Swift persistence layer using an actor with in-memory caching and file-backed JSON storage for your Codable model type.