What problem does it solve?
This Skill solves the problem of unsafe concurrent access to shared mutable state by providing a thread-safe persistence pattern that avoids data races when multiple parts of an app read and write local data.
Core Features & Use Cases
- Actor-based repository: Use an actor to guarantee serialized access to the in-memory cache, removing the need for locks or manual synchronization.
- In-memory caching + file-backed persistence: Read quickly from memory while persisting changes atomically to a JSON file for durability.
- Generic, reusable design: Reuse the same repository for any model that is both
Codable and Identifiable with a String ID, supporting offline-first and local-storage use cases.
Use Case: In an offline-first iOS/macOS app, store user-generated entities (for example, drafts, notes, or settings) locally so the UI can load instantly from cache and still survive app restarts via atomic JSON writes.
Quick Start
Ask the system to create a type-safe LocalRepository actor for your Codable & Identifiable model and persist it to an atomic JSON file while accessing it with await.