data-persistence

data-persistence is a skill for Claude Code, Codex from troyjthomas/ios-agent-skills. It costs 76 tokens per session (1,018 once invoked), scanned A, original, MIT.

A guide for replacing placeholder data in an iOS app with persistent SwiftData models and queries. SwiftData is Apple’s framework for storing app data so it can remain available after the app closes.

In plain words
What is it for?
Use it after screens are built to define models, save newly created records, query lists, propagate state between screens, and delete records with confirmation.
Why use it?
It connects finished screens to real saved data instead of temporary examples. It ensures creation, listing, updating state, and deletion flows use the same stored data.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions CLAUDE.md; mentions Claude Code.

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/troyjthomas/ios-agent-skills/data-persistence
Any agent
npx skills add troyjthomas/ios-agent-skills --skill data-persistence
Clone the repo
git clone --depth 1 https://github.com/troyjthomas/ios-agent-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 data-persistence

README.md
[![agentmods](https://agentmods.dev/badge/skills/troyjthomas/ios-agent-skills/data-persistence.svg)](https://agentmods.dev/skills/troyjthomas/ios-agent-skills/data-persistence)
Your own site
<a href="https://agentmods.dev/skills/troyjthomas/ios-agent-skills/data-persistence"><img src="https://agentmods.dev/badge/skills/troyjthomas/ios-agent-skills/data-persistence.svg" alt="Measured on agentmods" height="20"></a>
Per session 76 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,018 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00076 $0.01018
Opus 5 $0.00038 $0.00509
Sonnet 5 $0.00015 $0.00204
Haiku 4.5 $0.00008 $0.00102

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

Security

Grade A, and why

data-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 6d 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/data-persistence/SKILL.md · 114 lines

How it starts

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

Data Persistence

Replace placeholder content with real, persistent data. Screens should already be built and looking right before you do this.

When to Use

  • Screens are built with placeholder/mock data
  • You're ready to make data persist across app launches
  • You need to wire up creation flows to actually save data
  • You need list screens to show real, queried data

Prerequisites

  • Screen-by-screen build is mostly complete (at least Wave 1-2)
  • Screens are merged into main branch
  • CLAUDE.md specifies the persistence approach (SwiftData recommended)

The Prompt

Set up SwiftData models for the app based on what the views are
already displaying. Create models for [list your main entities].
Replace all placeholder data with real SwiftData queries. Creation
flows should save to SwiftData. Lists should query from SwiftData.
Deletion should delete from SwiftData with confirmation.

Example for Patchwork

Set up SwiftData models for Project, Pattern, and YarnColor.

A Project has: name (String), pattern (relationship to Pattern),
yarn colors (array of YarnColor), hook size (String), current
stitch count (Int), total stitches (Int), notes (String),
creation date (Date), is archived (Bool).

A Pattern has: name (String), difficulty (enum: beginner,
intermediate, advanced), category (String), instructions (String),
thumbnail image name (String).

A YarnColor has: name (String), hex value (String).

Replace all placeholder data in every view with real SwiftData
queries. The New Project sheet should save a new Project.
The Projects list should show @Query results. Deleting from
the context menu should delete from SwiftData with a
confirmation dialog. The stitch counter should update the
project's current stitch count in SwiftData.

Model Design Rules

Tell Claude Code:

  1. Keep models simple. No computed properties that could be stored values. No unnecessary relationships.

  2. Use optionals sparingly. If a field is always present, don't make it optional. Required fields fail fast on creation.

Read the full file on GitHub · 114 lines

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. 6d ago First seen · 114 lines · 76 tokens per session scan A 060c0b230e7c

Subscribe to this mod's changes

data-persistence is a skill published in the GitHub repository troyjthomas/ios-agent-skills (2 stars, last pushed 3mo ago), licensed MIT. It adds 76 tokens to every session and 1,018 once invoked, about $0.0004 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-08-31.

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

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

persistence-setup

Generates SwiftData or CoreData persistence layer with optional iCloud sync. Use when user wants to add local storage, data persistence, or cloud sync.

rshankras/claude-code-apple-skills · 36 tokens