Agent skill

Swift Data

by pproenca in pproenca/dot-skills

SwiftData persistence and data-layer architecture for iOS 26 / Swift 6.2 clinic modular MVVM-C apps.

MITAuto-check passedMobile

Install Swift Data

skills CLI
$ npx skills add pproenca/dot-skills --skill swift-data -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pproenca/dot-skills swift-data --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pproenca/dot-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.experimental/swift-data .claude/skills/swift-data && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
swift-data
GitHub stars
214
Token cost
~3.4k tokens
SKILL.md length
1,040 words
Files
66 (incl. references, assets)
Skills in repo
182
Repo updated
First seen
Licence
MIT

At a glance

SwiftData persistence and data-layer architecture for iOS 26 / Swift 6.2 clinic modular MVVM-C apps.

  • Works in 9 steps: Data Modeling (CRITICAL) → Persistence Setup (CRITICAL) → Querying & Filtering (HIGH) → …
  • Refactoring @Model entities
  • SKILL.md covers Architecture Alignment, Clinic Architecture Contract…, When to Apply and Workflow, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Swift Data is an agent skill from pproenca/dot-skills. SwiftData persistence and data-layer architecture for iOS 26 / Swift 6.2 clinic modular MVVM-C apps. Use when writing, reviewing, or refactoring @Model entities, repository implementations, stale-while-revalidate reads, optimistic queued writes, sync/retry behavior, and SwiftUI integration that keeps SwiftData types inside Data-only boundaries.

Its SKILL.md is about 3.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 68 other files, including reference files and assets (for example `assets/templates/_template.md`, `metadata.json` and `references/_sections.md`).

It sits in Mobile, covering iOS development and Refactoring. It works with Swift, iOS and SwiftUI. The repository describes itself as: A collection of AI agent skills following the Agent Skills open format. The licence is MIT.

When your agent uses it

  • Refactoring @Model entities
  • Repository implementations
  • Stale-while-revalidate reads
  • Optimistic queued writes

Example prompts

  • “/swift-data”

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Data Modeling (CRITICAL)
  2. Persistence Setup (CRITICAL)
  3. Querying & Filtering (HIGH)
  4. CRUD Operations (HIGH)
  5. Sync & Networking (HIGH)
  6. Relationships (MEDIUM-HIGH)
  7. SwiftUI State Flow (MEDIUM-HIGH)
  8. Schema & Migration (MEDIUM-HIGH)
  9. Sample Data & Previews (MEDIUM)

What it can do on your machine

Read from SKILL.md and the folder at commit cf93c57. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Swift Data loads about 3.4k tokens when it runs, and up to ~44k if it reads all its reference files. Until then it costs about 89 tokens; SKILL.md has 1,040 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~89
When it runs · the whole SKILL.md, loaded when a task matches
~3.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~44k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pproenca/dot-skills at commit cf93c57, republished under its MIT licence (© pproenca). 1,040 words, ~3,376 tokens.

Download SKILL.mdSave it as .claude/skills/swift-data/SKILL.md (or your agent's skills folder). This skill also uses 65 other files; get the full folder from GitHub.
name
swift-data
description
SwiftData persistence and data-layer architecture for iOS 26 / Swift 6.2 clinic modular MVVM-C apps. Use when writing, reviewing, or refactoring @Model entities, repository implementations, stale-while-revalidate reads, optimistic queued writes, sync/retry behavior, and SwiftUI integration that keeps SwiftData types inside Data-only boundaries.

SwiftData Best Practices — Modular MVVM-C Data Layer

Comprehensive data modeling, persistence, sync architecture, and error handling guide for SwiftData aligned with the clinic modular MVVM-C stack.

Architecture Alignment

This skill enforces the same modular architecture mandated by swift-ui-architect:

┌───────────────────────────────────────────────────────────────┐
│ Feature modules: View + ViewModel, no SwiftData imports       │
├───────────────────────────────────────────────────────────────┤
│ Domain: models + repository/coordinator/error protocols        │
├───────────────────────────────────────────────────────────────┤
│ Data: @Model entities, SwiftData stores, repository impls,     │
│ remote clients, retry executor, sync queue, conflict handling  │
└───────────────────────────────────────────────────────────────┘

Key principle: SwiftData types (@Model, ModelContext, @Query, FetchDescriptor) live in Data-only implementation code. Feature Views/ViewModels work with Domain types and protocol dependencies.

Clinic Architecture Contract (iOS 26 / Swift 6.2)

All guidance in this skill assumes the clinic modular MVVM-C architecture:

  • Feature modules import Domain + DesignSystem only (never Data, never sibling features)
  • App target is the convergence point and owns DependencyContainer, concrete coordinators, and Route Shell wiring
  • Domain stays pure Swift and defines models plus repository, *Coordinating, ErrorRouting, and AppError contracts
  • Data owns SwiftData/network/sync/retry/background I/O and implements Domain protocols
  • Read/write flow defaults to stale-while-revalidate reads and optimistic queued writes
  • ViewModels call repository protocols directly (no default use-case/interactor layer)

When to Apply

Reference these guidelines when:

  • Defining @Model entity classes and mapping them to domain structs
  • Setting up ModelContainer and ModelContext in the Data layer
  • Implementing repository protocols backed by SwiftData
  • Writing stale-while-revalidate repository reads (AsyncStream)
  • Implementing optimistic writes plus queued sync operations
  • Configuring entity relationships (one-to-many, inverse)
  • Fetching from APIs and persisting to SwiftData via sync coordinators
  • Handling save failures, corrupt stores, and migration errors
  • Routing AppError traits to centralized error UI infrastructure
  • Building preview infrastructure with sample data
  • Planning schema migrations for app updates

Workflow

Use this workflow when designing or refactoring a SwiftData-backed feature:

  1. Domain design: define domain structs (Trip, Friend) with validation/computed rules (see model-domain-mapping, state-business-logic-placement)
  2. Entity design: define @Model entity classes with mapping methods (see model-*, model-domain-mapping)
  3. Repository protocol: define in Domain layer, implement with SwiftData in Data layer (see persist-repository-wrapper)
  4. Container wiring: configure ModelContainer once at the app boundary with error recovery (see persist-container-setup, persist-container-error-recovery)
  5. Dependency injection: inject repository protocols via @Environment (see state-dependency-injection)
  6. ViewModel: create @Observable ViewModel that delegates directly to repository protocols (see state-query-vs-viewmodel)
  7. CRUD flows: route all insert/delete/update through ViewModel -> Repository (see crud-*)
  8. Sync architecture: queue writes, execute via sync coordinator with retry policy (see sync-*)
  9. Relationships: model to-many relationships as arrays; define delete rules (see rel-*)
  10. Previews: create in-memory containers and sample data for fast iteration (see preview-*)
  11. Schema evolution: plan migrations with versioned schemas (see schema-*)

Troubleshooting

  • Data not persisting -> persist-model-macro, persist-container-setup, persist-autosave, schema-configuration
  • List not updating after background import -> query-background-refresh, persist-model-actor
  • List not updating (same-context) -> query-property-wrapper, state-wrapper-views
  • Duplicates from API sync -> schema-unique-attributes, sync-conflict-resolution
  • App crashes on launch after model change -> schema-migration-recovery, persist-container-error-recovery
  • Save failures silently losing data -> crud-save-error-handling
  • Stale data from network -> sync-offline-first, sync-fetch-persist
  • Widget/extension can't see data -> persist-app-group, schema-configuration
  • Choosing architecture pattern for data views -> state-query-vs-viewmodel, persist-repository-wrapper

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Data ModelingCRITICALmodel-
2Persistence SetupCRITICALpersist-
3Querying & FilteringHIGHquery-
4CRUD OperationsHIGHcrud-
5Sync & NetworkingHIGHsync-
6RelationshipsMEDIUM-HIGHrel-
7SwiftUI State FlowMEDIUM-HIGHstate-
8Schema & MigrationMEDIUM-HIGHschema-
9Sample Data & PreviewsMEDIUMpreview-

Quick Reference

1. Data Modeling (CRITICAL)
2. Persistence Setup (CRITICAL)
Show full SKILL.md (384 more words)Show less
3. Querying & Filtering (HIGH)
4. CRUD Operations (HIGH)
5. Sync & Networking (HIGH)
6. Relationships (MEDIUM-HIGH)
7. SwiftUI State Flow (MEDIUM-HIGH)
8. Schema & Migration (MEDIUM-HIGH)
9. Sample Data & Previews (MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information

© pproenca, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 65 other files (references, assets) in skills/.experimental/swift-data of pproenca/dot-skills.

  • SKILL.md
  • assets/templates/_template.md
  • metadata.json
  • references/_sections.md
  • references/crud-cancel-delete.md
  • references/crud-delete-indexset.md
  • references/crud-dismiss-save.md
  • references/crud-edit-button.md
  • references/crud-insert-context.md
  • references/crud-save-error-handling.md
  • references/crud-sheet-creation.md
  • references/crud-undo-cancel.md
  • references/model-class-for-persistence.md
  • references/model-computed-properties.md
  • references/model-custom-types.md
  • references/model-defaults.md
  • references/model-domain-mapping.md
  • references/model-external-storage.md
  • … and 48 more

Open the folder on GitHubat commit cf93c57

Compare with similar skills

Swift Data next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Swift Data compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Swift Data this skillpproenca/dot-skills214—~3.4kAutomated safety check: PassMIT
Swiftui Expert SkillAFK-surf/OpenBridge4302 repos~3.9kAutomated safety check: PassMIT
Swiftui AnimationAstraFoundry/KumoApp290—~4.1kAutomated safety check: PassAGPL-3.0
Snapshot Testsmicrosoft/SwiftStreamingMarkdown377—~2.2kAutomated safety check: PassMIT
Bootstrap iOSRayFernando1337/rayfernando-skills130—~1.1kAutomated safety check: PassApache-2.0
View Refactorrobinebers/openusage4.3k—~1.4kAutomated safety check: PassMIT

Similar skills

  • Swiftui Expert Skill

    AFK-surf/OpenBridge

    Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, modern APIs, Swift concurrency, and iOS 26+ Liquid Glass adoption.

    430 GitHub starsUsed in 2 repos~3.9k tokens
    MobileAuto-check passed
  • Swiftui Animation

    AstraFoundry/KumoApp

    Implement, review, or improve SwiftUI animations and transitions.

    290 GitHub stars~4.1k tokensUpdated 4 mo ago
    MobileAuto-check passed
  • Snapshot Tests

    microsoft/SwiftStreamingMarkdown

    Official

    Record and validate swift-snapshot-testing snapshots in the SwiftStreamingMarkdown package: regenerate reference PNGs, run snapshot tests, and diff failed snapshots.

    377 GitHub stars~2.2k tokensUpdated 12 days ago
    MobileAuto-check passed
  • Bootstrap iOS

    RayFernando1337/rayfernando-skills

    Bootstrap agents for iOS, iPadOS, macOS, Swift, SwiftUI, SwiftData/Core Data, Swift Testing, Xcode build/test/debug, Simulator, App Intents, or XcodeBuildMCP work.

    130 GitHub stars~1.1k tokensUpdated 2 mo ago
    MobileAuto-check passed
  • View Refactor

    robinebers/openusage

    Refactor macOS SwiftUI views and scenes with strong defaults for small dedicated subviews, stable sidebar and selection structure, explicit command and toolbar ownership, scene-aware state, and…

    4.3k GitHub stars~1.4k tokensUpdated yesterday
    MobileAuto-check passed
  • Swiftui Animation

    dpearson2699/swift-ios-skills

    Implement, diagnose, or review SwiftUI motion using explicit and scoped implicit animations, springs, transitions, PhaseAnimator, KeyframeAnimator, matched geometry or navigation zoom, SF Symbol…

    1.2k GitHub stars~3.9k tokensUpdated 2 mo ago
    MobileAuto-check passed

More from pproenca/dot-skills

All 182 skills in this repo
  • Audio Voice Recovery

    pproenca/dot-skills

    Audio forensics and voice recovery guidelines for CSI-level audio analysis.

    214 GitHub stars~3.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Codemod React Pipeline

    pproenca/dot-skills

    Guided, scripted pipeline for running JSX/TSX/React codemods safely across large legacy codebases.

    214 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Dev Rfc

    pproenca/dot-skills

    Create well-structured RFCs and technical proposals for software projects.

    214 GitHub stars~3.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Dx Harness

    pproenca/dot-skills

    Developer-experience friction auditing and fixing — slow onboarding, repeated manual setup steps, missing bootstrap/reset/seed scripts, undiscoverable conventions.

    214 GitHub stars~1.5k tokensUpdated 1 mo ago
    Auto-check passed
  • Language Spec Author

    pproenca/dot-skills

    Turn a rough idea for a language into a complete, implementable specification — a DSL, query, config/data, template, or protocol language — by interviewing the author dimension by dimension until…

    214 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Python Pep Author

    pproenca/dot-skills

    Drafting Python Enhancement Proposals (PEPs) — proposing a Python language feature, a standard library change, an interoperability standard, or an informational/process document for the Python…

    214 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Categories

Questions about Swift Data

What does Swift Data do?

SwiftData persistence and data-layer architecture for iOS 26 / Swift 6.2 clinic modular MVVM-C apps. Swift Data is an agent skill from pproenca/dot-skills.2 clinic modular MVVM-C apps.

When should I use Swift Data?

Swift Data fits situations like: refactoring @Model entities; repository implementations; stale-while-revalidate reads; optimistic queued writes.

How do I install Swift Data in Claude Code?

Run `npx skills add pproenca/dot-skills --skill swift-data -a claude-code`. Or copy the skill folder (skills/.experimental/swift-data in pproenca/dot-skills) into .claude/skills/swift-data in your project. Claude Code loads it when a task matches its description.

How do I install Swift Data in Codex?

Run `npx skills add pproenca/dot-skills --skill swift-data -a codex`. Or copy the skill folder (skills/.experimental/swift-data in pproenca/dot-skills) into .agents/skills/swift-data in your project. Codex loads it when a task matches its description.

Can I use Swift Data in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pproenca/dot-skills --skill swift-data -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/swift-data, .gemini/skills/swift-data, .github/skills/swift-data and .opencode/skills/swift-data in your project.

What does Swift Data need to run?

SKILL.md names no scripts, command-line tools or credentials: Swift Data is instructions for the agent only.

Does Swift Data access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Swift Data safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Swift Data use?

Swift Data is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Swift Data use?

About 3.4k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 41k tokens, read only when the agent opens those files.

What are the alternatives to Swift Data?

Skills that share tags, products or a category with Swift Data: Swiftui Expert Skill (AFK-surf/OpenBridge, 430 stars), Swiftui Animation (AstraFoundry/KumoApp, 290 stars), Snapshot Tests (microsoft/SwiftStreamingMarkdown, 377 stars) and Bootstrap iOS (RayFernando1337/rayfernando-skills, 130 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Swift Data?

pproenca (a GitHub user) maintains it in pproenca/dot-skills, which has 214 GitHub stars. The repository holds 182 skills in this directory. The repository was last updated on August 15, 2026.

Source: pproenca/dot-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.