Skip to main content
skill CX Codex

swiftdata · rshankras — Claude Code skill: hierarchical SwiftData models

A skill for designing hierarchical SwiftData models with class inheritance, polymorphic queries, and type safety. Guides you through inheritance patterns, type-based filtering, and inheritance-versus-enum decisions.

MIT 204 installs ★ 905 updated 2026-07-24

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

What swiftdata does

SwiftData demands careful architecture when dealing with inheritance and related models. This skill covers patterns for class hierarchies, type-safe queries, and polymorphic relationships—the patterns beyond the basics.

It includes one module, inheritance/SKILL.md, which walks through hierarchy design, type-based querying, and when inheritance makes more sense than an enum. The skill uses file reading tools to examine your project structure and code patterns.

Installation varies by editor: use npx or gh to place the skill file in .claude/skills, .cursor/skills, .github/skills, or the equivalent directory for your platform.

What it helps with

  • design a SwiftData model hierarchy with class inheritance
  • write type-safe queries against related SwiftData models
  • choose between class inheritance and enum for model variants
  • work around SwiftData polymorphism constraints

Example prompts for the agent

  • How do I structure a SwiftData hierarchy with inheritance for different entity types?
  • Write a SwiftData query that filters by model subtype
  • Should I use class inheritance or an enum for Document variants?

How to install swiftdata

1Skills CLI (Vercel)

npx skills add rshankras/claude-code-apple-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 rshankras/claude-code-apple-skills --skill swiftdata -a claude-code, then open ~/.claude/skills/swiftdata/SKILL.md in your project.

What does swiftdata do?

The skill provides solutions for hierarchical SwiftData modeling: how to structure inheritance, write type-safe queries, and decide between inheritance and enum for model variants.

Which platforms support this skill?

Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode each have their own install command.

Source text

SKILL.md · MIT
---
name: swiftdata
description: SwiftData skills — class inheritance patterns for hierarchical models, type-based querying, polymorphic relationships, and inheritance-vs-enum decisions. Use when designing SwiftData model hierarchies.
allowed-tools: [Read, Glob, Grep]
last_verified: 2026-07-16
review_by: 2027-06-22
---

# SwiftData Skills

SwiftData modeling patterns beyond the basics.

## When This Skill Activates

Use this skill when the user:
- Designs **hierarchical SwiftData models** (class inheritance)
- Needs **type-based or polymorphic queries**
- Weighs **inheritance vs enum** for model variants

## Available Skills

Paths are relative to THIS file's directory — skills run with cwd set to the
user's project, so resolve each path from this SKILL.md's own location.

| Skill | Read | Covers |
|-------|------|--------|
| inheritance | `inheritance/SKILL.md` | Class inheritance, polymorphic relationships, type-based querying, inheritance-vs-enum |

## How to Route

1. Read `inheritance/SKILL.md` (relative to this file) plus any reference files it lists.
2. Apply the guidance to the user's code. For broader macOS SwiftData architecture, see also `../macos/swiftdata-architecture/SKILL.md`.

© rshankras · MIT · rshankras/claude-code-apple-skills

Similar skills

All skills for Programming languages →

swiftdata by other authors comes first.

swiftdata dpearson2699 Gives the agent a working reference for SwiftData so persistence code on Swift 6.3 comes out right the first time. CX Codex +1 4,400installs swiftdata Prisma-Labs-Dev A reference skill for SwiftData. The agent searches four markdown files for answers on @Model, ModelContext, @Query and schema migrations. CX Codex +1 572installs swiftdata-pro Paul Hudson swiftdata-pro — a skill for writing, reviewing, and improving SwiftData code with modern APIs and best practices. Essential when working with SwiftData-based projects in Swift. CX Codex +1 10,000installs guide-swiftdata Prisma-Labs-Dev guide-swiftdata — a skill for writing, reviewing and debugging SwiftData code: safe predicates, autosave rules and CloudKit constraints. CX Codex +1 538installs swiftdata-code-review existential-birds swiftdata-code-review reviews SwiftData code for model relationships, query predicates, actor concurrency, and schema migrations. Works on .swift files. CX Codex +1 136installs core-data dpearson2699 A skill for Core Data work in apps that have not moved to SwiftData: stack setup, concurrency, batch operations and migrations. CX Codex +1 2,900installs ios-xcode pproenca ios-xcode is a Claude Code skill for Xcode setup and iOS project tooling. It applies to App-target configuration, SwiftData, testing, debugging, profiling, and app distribution. CX Codex +1 307installs ios-developer rmyndharis ios-developer — a skill for Claude Code guides the assistant through native iOS app development. Activates when designing architectures, building UI screens, or configuring deployment workflows. CX Codex +1 114installs

From the same set23

The whole set →

Project sponsors

Companies that keep this analytics open