Skip to main content
skill CX Codex

swiftdata · dpearson2699 — Claude Code skill: SwiftData models, queries

Gives the agent a working reference for SwiftData so persistence code on Swift 6.3 comes out right the first time.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dpearson2699/swift-ios-skills --skill swiftdata -a claude-code
Open on GitHub

What swiftdata does

The skill loads a guide the agent reads before touching your data layer. It covers @Model classes, @Attribute options such as .externalStorage and .unique, delete rules on @Relationship, and compound keys declared with #Unique. Separate sections handle @Query in SwiftUI, #Predicate, FetchDescriptor, plus schema versioning with VersionedSchema and SchemaMigrationPlan.

CloudKit gets its own treatment. Before advising on sync, the agent checks that the target has the iCloud capability with CloudKit and the right container, and that Background Modes includes remote notifications. It also flags schema traits that break sync. Model objects stay tied to their context and actor, so the guide has you pass a PersistentIdentifier across actors instead of the instance.

The requirements are iOS 26+ and Swift 6.3. Model inheritance and the newer syntax will not build on older toolchains. For background work there is a @ModelActor section. Batch deletes deserve care: the skill tells you to run the exact predicate against a throwaway copy of the store first, then refetch and check counts, because a wrong #Predicate removes rows you meant to keep.

What it helps with

  • declare a model with external storage for images and cascade deletes on a relationship
  • filter a SwiftUI list by a search string through #Predicate
  • move a store to a new schema version without dropping user data
  • turn on CloudKit sync and confirm the schema allows it
  • run writes on a background actor without passing model objects between threads

Example prompts for the agent

  • Write a @Model class Trip with a name, destination, start and end dates, and a cascade-deleting relationship to accommodation
  • Build a SwiftUI screen that lists favorite trips via @Query, sorted by startDate descending
  • Plan a store migration using VersionedSchema and SchemaMigrationPlan

How to install swiftdata

1Skills CLI (Vercel)

npx skills add dpearson2699/swift-ios-skills --skill swiftdata -a claude-code

2Manually: put the files in place

~/.claude/skills/swiftdata/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/swiftdata/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about swiftdata

How do I install swiftdata in Claude Code?

Run npx skills add dpearson2699/swift-ios-skills --skill swiftdata -a claude-code. The skill file lands at ~/.claude/skills/swiftdata/SKILL.md.

What does the swiftdata skill do?

It hands the agent code samples and a review checklist for SwiftData: models, relationships, queries, the container, migrations and CloudKit sync. The agent leans on them when writing or auditing your persistence layer.

Which iOS and Swift versions does it target?

iOS 26+ with Swift 6.3. Model inheritance and the related syntax will not compile on earlier toolchains.

Similar skills

Everything for Mobile →

swiftdata by other authors comes first.

From the same set86

push-notifications Review, build, and debug local and APNs remote notifications for iOS and macOS in Swift. Handles permission flows, silent pushes, and service extensions. CX Codex +1 4,200installs swiftui-layout-components Guides SwiftUI screen layouts built from stacks, grids, lists, forms, and controls. Use it for settings, collections, and scrollable views. CX Codex +1 4,200installs debugging-instruments Helps debug crashes, find retain cycles, and diagnose main-thread hangs in iOS apps using LLDB, Memory Graph Debugger, and Instruments. CX Codex +1 4,100installs swiftui-liquid-glass Implement and review Liquid Glass in SwiftUI interfaces for iOS 26+. Useful when adding glass buttons, grouped effects, or animated shape changes. CX Codex +1 4,100installs swift-language Guides AI agents through modern Swift patterns for core, non-concurrency code. Useful when modernizing enums, generics, and protocols under recent compiler releases. CX Codex +1 4,000installs swift-charts A skill that steers your coding agent through Swift Charts work on iOS 26+. Useful for bars, lines, donuts, heat maps and 3D surfaces. CX Codex +1 4,000installs widgetkit Skill for building and reviewing WidgetKit widgets and controls: timelines, configurable widgets, interactive buttons. Use it when your app needs a Home Screen or Lock Screen widget. CX Codex +1 4,000installs swiftui-gestures Guides gesture implementation in SwiftUI, from tap and drag recognition to multi-gesture composition and conflict handling. CX Codex +1 4,000installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor