persistence-setup
This skill guides you through establishing a robust data persistence layer for Apple platform apps. Whether you're choosing between SwiftData and CoreData or implementing either framework, it provides structured setup patterns and best practices tailored to iOS, macOS, and other Apple platforms. Get your app's storage foundation right from the start.
persistence-setup guides you through establishing a robust data persistence layer for Apple platform apps. The skill helps you choose between SwiftData and CoreData, then provides structured setup patterns and best practices for implementing either framework. You'll learn to configure your storage foundation correctly from the start, ensuring your app can reliably save and retrieve user data between launches.
AI-generated summary based on this skill's SKILL.md
Install
rshankras/claude-code-apple-skills/persistence-setup · repository language: Swift
git clone https://github.com/rshankras/claude-code-apple-skills
cp -r claude-code-apple-skills/skills/generators/persistence-setup ~/.claude/skills/persistence-setupFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I add local storage to my iOS app with persistence-setup?
persistence-setup guides you through establishing a robust data persistence layer for Apple platform apps. The skill helps you choose between SwiftData and CoreData, then provides structured setup patterns and best practices for implementing either framework. You'll learn to configure your storage foundation correctly from the start, ensuring your app can reliably save and retrieve user data between launches.
What's the difference between SwiftData and CoreData?
persistence-setup covers both frameworks to help you make the right choice. SwiftData is Apple's modern, Swift-native approach with simpler syntax, while CoreData is the established framework with broader compatibility and more mature tooling. The skill provides examples and guidance for both, helping you understand which fits your app's requirements, platform targets, and team expertise.
How can I enable iCloud sync for my app?
persistence-setup includes structured guidance for CloudKit integration and iCloud synchronization. The skill walks you through setting up CloudKit containers, configuring your data models for cloud sync, and implementing the necessary infrastructure to keep user data synchronized across multiple devices. You'll learn production-ready patterns for offline-first storage with cloud fallback.
How do I set up SwiftData with a model container configuration?
persistence-setup provides step-by-step setup patterns for SwiftData, including model container configuration. The skill guides you through defining your data models, configuring the model container with appropriate storage options, and establishing best practices for schema management. You'll get production-ready infrastructure code tailored to iOS 17 and later platforms.
Can persistence-setup help me implement a repository pattern?
Yes. persistence-setup includes guidance on implementing the repository pattern for testable data access. This approach abstracts your persistence layer, making it easier to test your app's business logic independently of CoreData or SwiftData. The skill shows you how to structure your data access layer for maintainability and flexibility.
Does persistence-setup support migrating an existing CoreData stack?
persistence-setup covers migration and extension of existing CoreData stacks. Whether you're modernizing legacy persistence code or extending your current setup, the skill provides patterns and best practices for managing schema changes, data migration, and incremental improvements to your storage layer.
SKILL.md
rendered from the published skill — quoted content, verbatim
Persistence Setup Generator
Generates a production-ready persistence layer using SwiftData (iOS 17+) or CoreData with optional iCloud (CloudKit) sync.
When This Skill Activates
- User asks to "add persistence" or "set up data storage"
- User mentions "SwiftData", "CoreData", or "local storage"
- User wants to "sync data to iCloud" or "enable cloud sync"
- User asks about "offline storage" or "data models"
Pre-Generation Checks (CRITICAL)
1. Project Context Detection
Before generating, ALWAYS check:
```bash
Check deployment target
cat Package.swift | grep -i "platform"
Or check project.pbxproj
Find existing persistence implementations
rg -l "ModelContainer|NSPersistentContainer|@Model|@Entity" --type swift
Check for existing SwiftData models
rg "@Model" --type swift | head -5
Check for CoreData stack
rg
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 8 files
skills/generators/persistence-setup/SKILL.md
skills/generators/persistence-setup/persistence-patterns.md
skills/generators/persistence-setup/templates/CloudKitConfiguration.swift
skills/generators/persistence-setup/templates/ExampleModel.swift
skills/generators/persistence-setup/templates/PersistenceController.swift
skills/generators/persistence-setup/templates/Repository.swift
skills/generators/persistence-setup/templates/SwiftDataRepository.swift
skills/generators/persistence-setup/templates/SyncStatus.swift