An agent skill that helps AI coding assistants like Claude Code, Codex, Cursor, and Gemini write better SwiftData code. Covers @Model, @Query, predicates, indexes, migrations, relationships, iCloud sync, and more, targeting the mistakes LLMs actually make.
Also available:
Find more agent skills for Swift and Apple platform development at Swift Agent Skills.
You can install this skill into Claude Code, Codex, Gemini, Cursor, and more by using npx:
npx skills add https://github.com/twostraws/swiftdata-agent-skill --skill swiftdata-proIf you get the error npx: command not found, it means you don’t currently have Node installed. You need to run this command to install Node through Homebrew:
brew install nodeAnd if that fails it usually means you need to install Homebrew first.
When using npx, you can select exactly which agents you want to use during the installation. You can also select whether the skill should be installed just for one project, or whether it should be made available for all your projects.
Alternatively, you can clone this whole repository and install it however you want.
If you're using Xcode, watch the YouTube video on How to Install and Use Agent Skills in Xcode for a walkthrough.
The skill is called SwiftData Pro, and can be triggered in various ways. For example, in Claude Code you would use this:
/swiftdata-pro
And in Codex you would use this:
$swiftdata-pro
In both cases you can provide specific instructions if you want only a partial review. For example, /swiftdata-pro Check my code for latest API usage on Claude, or $swiftdata-pro Check where indexes should be added to my SwiftData models in Codex.
You can also trigger the skill using natural language:
Use the SwiftData Pro skill to enable iCloud support in this project.
I wrote a book on SwiftData, and update it regularly as new features are added, so I’ve made it my business to understand the ins and outs of SwiftData.
This skill is the result of all that work. The rules contained here directly target common SwiftData mistakes made by LLMs, covering new features they aren’t trained on, older features they frequently make mistakes with, and patterns that help keep your code correct and efficient.
What this is not is just a dumping ground for all SwiftData advice ever. Agents already have a solid grounding of the fundamentals of SwiftData, so skills that do little more than reteach them what they already know are just burning tokens.
This skill focuses on what actually has an impact.
I welcome all contributions, whether that's adding new checks, improving existing checks, or editing this README – everyone is welcome!
- Keep your Markdown concise. There is a token cost to using skills, particularly with SKILL.md, so please respect the token budgets of users.
- Do not repeat things that LLMs already know, because it burns tokens for no benefit. Focus on edge cases, surprises, soft deprecations, and similar.
- All work must be licensed under the MIT license so it can benefit the most people.
Please ensure you abide by the Code of Conduct.
SwiftData Pro was originally created by Paul Hudson, who writes free Swift tutorials over at Hacking with Swift. It’s available under the MIT License, which permits commercial use, modification, distribution, and private use.

