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

Good fit Use it to add local persistence, define stored data models, support offline use, or synchronize data through iCloud.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rshankras/claude-code-apple-skills/persistence-setup
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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for persistence-setup

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.5 $0.00014 $0.00736
Sonnet 5.5 $0.00007 $0.00368
Haiku 4.5 $0.00004 $0.00184

Measured 1mo ago against content hash 071b9656c622, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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. 1mo 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 (816 stars, last pushed 2mo ago), licensed MIT. It adds 36 tokens to every session and 1,841 once invoked, about $0.0001 per session on Opus 5.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.