persistence-setup

persistence-setup is a skill for Claude Code from rshankras/claude-code-apple-skills. It costs 36 tokens per session (1,841 once invoked), scanned A, original, MIT.

A data-storage layer for an Apple app using SwiftData or Core Data, with optional iCloud synchronization. It stores app data locally so it can remain available between launches, and can sync it across devices.

In plain words
What is it for?
Use it to add local persistence, define stored data models, support offline use, or synchronize data through iCloud.
Why use it?
It provides the storage and data-model foundation an app needs instead of keeping all data only in memory.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool; positional $N argument.

Part of the apple-skills plugin — 147 skills shipped together , and of apple-skills

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/rshankras/claude-code-apple-skills/persistence-setup
Any agent
npx skills add rshankras/claude-code-apple-skills --skill persistence-setup
Clone the repo
git clone --depth 1 https://github.com/rshankras/claude-code-apple-skills

Made for: Claude Code.

Or install apple-skills, the plugin that ships this one along with the rest of its 147 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for persistence-setup

README.md
[![agentmods](https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/persistence-setup.svg)](https://agentmods.dev/skills/rshankras/claude-code-apple-skills/persistence-setup)
Your own site
<a href="https://agentmods.dev/skills/rshankras/claude-code-apple-skills/persistence-setup"><img src="https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/persistence-setup.svg" alt="Measured on agentmods" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,841 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00036 $0.01841
Opus 5 $0.00018 $0.00920
Sonnet 5 $0.00007 $0.00368
Haiku 4.5 $0.00004 $0.00184

Measured 2d ago against content hash 071b9656c622, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

persistence-setup scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

func fetch(predicate: Predicate<T>?, sortBy: [SortDescriptor<T>]) async throws -> [T]
skills/generators/persistence-setup/SKILL.md · 305 lines

How it starts

The opening of the file, as written. The whole thing — 305 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

# 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 "NSManagedObjectContext|NSPersistentStore" --type swift | head -5

# Check existing entitlements for iCloud
cat *.entitlements 2>/dev/null | grep -i "icloud"

2. Framework Selection

Use SwiftData if:

  • Deployment target is iOS 17+ / macOS 14+
  • User explicitly requests SwiftData
  • No existing CoreData implementation

Use CoreData if:

  • Deployment target < iOS 17
  • Existing CoreData stack present
  • User explicitly requests CoreData

3. Conflict Detection

If existing persistence found:

  • Ask: Extend existing, migrate to SwiftData, or create separate?

Configuration Questions

Ask user via AskUserQuestion:

  1. Framework choice?

    • SwiftData (iOS 17+, recommended)
    • CoreData (older targets)
  2. Enable iCloud sync?

    • Yes (requires CloudKit entitlement)
    • No (local only)
  3. Generate example model?

    • Yes (with sample Item model)
    • No (just infrastructure)

Generation Process

Step 1: Create Core Files

Always generate:

Sources/Persistence/
├── PersistenceController.swift    # Container setup
├── Repository.swift               # Repository protocol
└── SwiftDataRepository.swift      # Concrete implementation

Read the full file on GitHub · 305 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 305 lines · 36 tokens per session scan A 071b9656c622

Subscribe to this mod's changes

persistence-setup is a skill published in the GitHub repository rshankras/claude-code-apple-skills (700 stars, last pushed 1mo ago), licensed MIT. It adds 36 tokens to every session and 1,841 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

swiftdata-pro

Use when modeling data with SwiftData (@Model), writing @Query, configuring ModelContainer, performing migrations, or enabling CloudKit sync on iOS 17+.

laxrajpurohit/swift-skills-pro · 36 tokens

core-data-pro

Use when working with Core Data — modeling entities, NSPersistentContainer setup, background contexts, fetch requests, batch operations, and migrations.

laxrajpurohit/swift-skills-pro · 31 tokens

cloudkit

Implement, review, or improve CloudKit and iCloud sync in iOS/macOS apps. Use when working with CKContainer, CKRecord, CKQuery, CKSubscription, CKSyncEngine, CKShare, NSUbiquitousKeyValueStore, or iCloud Drive file coordination; when syncing SwiftData models via ModelConfiguration with cloudKitDatabase; when handling…

JordanCoin/ios-skills-collection · 102 tokens

swiftdata

Implement, review, or improve data persistence using SwiftData. Use when defining @Model classes with @Attribute, @Relationship, @Transient, @Unique, or @Index; when querying with @Query, #Predicate, FetchDescriptor, or SortDescriptor; when configuring ModelContainer and ModelContext for SwiftUI or background work…

JordanCoin/ios-skills-collection · 106 tokens

core-data-expert

Expert Core Data guidance (iOS/macOS): stack setup, fetch requests & NSFetchedResultsController, saving/merge conflicts, threading & Swift Concurrency, batch operations & persistent history, migrations, performance, and NSPersistentCloudKitContainer/CloudKit sync.

JordanCoin/ios-skills-collection · 58 tokens

gingiris-aso-growth

🇺🇸 ASO & Mobile App Growth Playbook 2026 — Complete App Store Optimization guide. ASO keyword ranking, App Store & Google Play listing optimization, app cold start, UGC creator operations, TikTok/Instagram/YouTube Shorts marketing, AI-matrix content scaling, mobile user acquisition. 🇨🇳 ASO 增长与 App 冷启动权威指南 …

Gingiris-1031/gingiris-skills · 320 tokens