Skip to main content
skill CX Codex

guide-swiftdata — Claude Code skill: SwiftData patterns

A skill for writing, reviewing and debugging SwiftData code: safe predicates, autosave rules and CloudKit constraints.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swiftdata -a claude-code
Open on GitHub

What guide-swiftdata does

This is a pattern guide, not API reference. The agent reaches for it when you write models, chase a runtime crash in a predicate, or review code before a commit. Five reference files sit inside: references/core-rules.md covers autosave, relationships, delete rules, @Query restrictions, #Unique and @Transient; references/predicates.md lists supported predicates and the dangerous patterns that crash at runtime; references/cloudkit.md handles CloudKit constraints; references/indexing.md covers indexing on iOS 18+; references/class-inheritance.md covers model subclassing on iOS 26+.

The review order is fixed: core rules first, then predicates, then CloudKit if the project uses it, indexing for iOS 18+, inheritance for iOS 26+. On a partial task the agent loads only the file it needs, so context stays small. The skill targets Swift 6.2 and modern concurrency, will not push Core Data, and will not pull in third-party frameworks without asking.

One catch: with no SwiftData project, or a deployment target below iOS 18, some references never come into play because the version gates are baked into the review steps. Worth installing if you already write SwiftData and want the agent to flag real problems instead of nitpicking.

What it helps with

  • check a predicate before it crashes the app at runtime
  • work out autosave and delete rules for your models
  • pick indexes for iOS 18+
  • respect CloudKit constraints during sync
  • spot mistakes in model subclassing for iOS 26+

Example prompts for the agent

  • Review my SwiftData models against core-rules and predicates
  • Check the predicates in this file — will any crash at runtime?
  • We sync through CloudKit, check the constraints

How to install guide-swiftdata

1Skills CLI (Vercel)

npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swiftdata -a claude-code

2Manually: put the files in place

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

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

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

Questions about guide-swiftdata

How do I install guide-swiftdata in Claude?

Run npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swiftdata -a claude-code. The skill lands in ~/.claude/skills/guide-swiftdata/SKILL.md.

What does guide-swiftdata do?

It walks the agent through SwiftData patterns: autosave, relationships, predicates, CloudKit, indexing and class inheritance. It applies while you write, review or debug code.

Which versions does the skill need?

It targets Swift 6.2 and modern concurrency. Indexing references load for iOS 18+, class inheritance references for iOS 26+.

Source text

SKILL.md · MIT
---
name: guide-swiftdata
description: SwiftData patterns — autosave, relationships, dangerous predicates, CloudKit constraints, indexing, class inheritance. Use when writing, reviewing, or debugging SwiftData code.
type: guide
origin: https://github.com/twostraws/SwiftData-Agent-Skill
license: MIT
---

> **Guide Skill** — This is an expert workflow/pattern guide, not API reference documentation.
> Originally from [twostraws/SwiftData-Agent-Skill](https://github.com/twostraws/SwiftData-Agent-Skill) by Paul Hudson. MIT License.

# SwiftData Patterns

Write and review SwiftData code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems — do not nitpick or invent issues.

## Core Instructions

- Target Swift 6.2 or later, using modern Swift concurrency.
- Prefer SwiftData across the board. Do not suggest Core Data unless the feature cannot be solved with SwiftData.
- Do not introduce third-party frameworks without asking first.

## Review Process

1. Check for core SwiftData issues using `references/core-rules.md`.
2. Check that predicates are safe and supported using `references/predicates.md`.
3. If the project uses CloudKit, check for CloudKit-specific constraints using `references/cloudkit.md`.
4. If the project targets iOS 18+, check for indexing opportunities using `references/indexing.md`.
5. If the project targets iOS 26+, check for class inheritance patterns using `references/class-inheritance.md`.

If doing partial work, load only the relevant reference files.

## References

| Topic | Reference |
|-------|-----------|
| Autosave, relationships, delete rules, `@Query` restrictions, `#Unique`, `@Transient` | `references/core-rules.md` |
| Supported predicates, dangerous patterns that crash at runtime, unsupported methods | `references/predicates.md` |
| CloudKit constraints: no `#Unique`, optional requirements, eventual consistency | `references/cloudkit.md` |
| Database indexing (iOS 18+), single and compound property indexes | `references/indexing.md` |
| Model subclassing (iOS 26+), `@available` requirements, predicate filtering | `references/class-inheritance.md` |

© Prisma-Labs-Dev · MIT · Prisma-Labs-Dev/apple-skills

Similar skills

Everything for Mobile →

From the same set22

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