swiftdata-persistence

swiftdata-persistence is a skill for Claude Code, Codex from memi-design/design-skills. It costs 30 tokens per session (213 once invoked), scanned A, original, MIT.

A guide to storing app data with SwiftData, Apple's persistence framework. It covers data models, queries, relationships, migrations, offline behavior, and CloudKit assumptions.

In plain words
What is it for?
Use it to design or review SwiftData schemas, plan migrations, test temporary stores, and check local persistence separately from CloudKit synchronization.
Why use it?
It helps protect existing user data when the data structure changes and avoids problems with duplicates, deleted relationships, unsafe sharing, or unreliable synchronization.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to design or review SwiftData schemas, plan migrations, test temporary stores, and check local persistence separately from CloudKit synchronization.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/memi-design/design-skills/swiftdata-persistence
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 memi-design/design-skills --skill swiftdata-persistence
Clone the repo
git clone --depth 1 https://github.com/memi-design/design-skills

Made for: Claude Code, Codex.

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 swiftdata-persistence

README.md
[![agentmods](https://agentmods.dev/badge/skills/memi-design/design-skills/swiftdata-persistence/github.svg)](https://agentmods.dev/skills/memi-design/design-skills/swiftdata-persistence)
Your own site
<a href="https://agentmods.dev/skills/memi-design/design-skills/swiftdata-persistence"><img src="https://agentmods.dev/badge/skills/memi-design/design-skills/swiftdata-persistence/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 swiftdata-persistence

Your own site · 80×15
<a href="https://agentmods.dev/skills/memi-design/design-skills/swiftdata-persistence"><img src="https://agentmods.dev/badge/skills/memi-design/design-skills/swiftdata-persistence.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 213 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00030 $0.00213
Opus 5 $0.00015 $0.00106
Sonnet 5 $0.00006 $0.00043
Haiku 4.5 $0.00003 $0.00021

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

Security

Grade A, and why

swiftdata-persistence scanned grade A with 0 findings 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 5d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/swiftdata-persistence/SKILL.md · 20 lines

What it actually says

SwiftData Persistence

Workflow

  1. Define ownership, retention, uniqueness, relationships, deletion behavior, and sync expectations before writing models.
  2. Confirm minimum OS and current SwiftData API availability.
  3. Keep persistence models separate from view-specific formatting and transient UI state.
  4. Design schema changes with an explicit migration and rollback story. Never infer that production data can be discarded.
  5. Place model-context work behind a clear actor boundary and avoid passing live mutable models across isolation domains.
  6. Use indexed or constrained fields for actual query and uniqueness needs, not speculative optimization.
  7. Test with isolated temporary or in-memory containers. Cover migration, relationship deletion, duplicate prevention, ordering, and failure recovery.
  8. Treat CloudKit compatibility and conflict behavior as separate proof from local persistence.

Read references/schema-review.md before changing an existing store.

Files

What ships with it

2 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. 5d ago First seen · 20 lines · 30 tokens per session scan A 5f0964a6aae2

Subscribe to this mod's changes

swiftdata-persistence is a skill published in the GitHub repository memi-design/design-skills (7 stars, last pushed 1mo ago), licensed MIT. It adds 30 tokens to every session and 213 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. 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

core-data

Build, review, or improve Core Data persistence in apps that have not adopted SwiftData. Use when working with NSManagedObject subclasses, NSFetchedResultsController for list-driven UI, NSBatchInsertRequest / NSBatchDeleteRequest / NSBatchUpdateRequest for bulk operations, NSPersistentHistoryChangeRequest for…

dpearson2699/swift-ios-skills · 130 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…

dpearson2699/swift-ios-skills · 106 tokens

bmob-database-android

Use when implementing Bmob NoSQL database CRUD in an Android Native project (Java or Kotlin). Triggers: io.github.bmob:android-sdk, Bmob.initialize(this, ...), BmobObject, BmobQuery, BmobUser, BmobInstallation, BmobFile, BmobRelation, BmobGeoPoint, BmobDate, SaveListener, UpdateListener, FindListener, QueryListener…

bmob/agent-skills · 190 tokens

bmob-database-flutter

Use when implementing Bmob NoSQL database CRUD in a Flutter / Dart project with the official bmobplugin package. Triggers: flutter pub add bmobplugin, package:bmobplugin/bmobplugin.dart, Bmob.initialize, BmobQuery, BmobObject, BmobUser, BmobFile, BmobGeoPoint, BmobRelation, BmobAcl, BmobError.convert, blog.save()…

bmob/agent-skills · 185 tokens

bmob-database-ios

Use when implementing Bmob NoSQL database CRUD in an iOS native project — both Objective-C and Swift / SwiftUI / UIKit. Triggers: BmobSDK, BmobSDK.xcframework, pod 'BmobSDK', #import , Bmob registerWithAppKey, [Bmob register(withAppKey:)], BmobObject objectWithClassName, BmobQuery queryWithClassName, BmobUser…

bmob/agent-skills · 218 tokens

activitykit

Implement, review, or improve Live Activities and Dynamic Island experiences in iOS apps using ActivityKit. Use when building real-time updating widgets for the Lock Screen and Dynamic Island — delivery tracking, sports scores, ride-sharing status, workout timers, media playback, or any time-sensitive information that…

dpearson2699/swift-ios-skills · 105 tokens