Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
twostraws avatar

Swiftdata Pro

  • 6.5k installs
  • 383 repo stars
  • Updated March 11, 2026
  • twostraws/swiftdata-agent-skill

A skill that writes, reviews, and fixes SwiftData persistence code for Swift 6.2+ projects, enforcing correct API usage, safe predicates, relationship delete rules, CloudKit constraints, and iOS 18/26 features.

About

SwiftData Pro writes, reviews, and improves SwiftData persistence code for iOS/macOS projects targeting Swift 6.2 or later. Developers use it when building or auditing model layers that rely on SwiftData instead of Core Data, including CloudKit-synced apps and projects adopting iOS 18 indexing or iOS 26 class inheritance. The skill loads modular reference files - core rules, predicate safety, CloudKit constraints, indexing, and class inheritance - only as needed for the task at hand. For reviews it organizes findings by file, names the violated rule, and provides before/after code snippets. For write or improve tasks it applies the same rules directly to the code. It enforces explicit delete rules on relationships, safe predicate patterns, correct @Query placement inside SwiftUI views, and modern Swift concurrency throughout.

  • Checks predicates against a reference of runtime-crashing patterns, e.g. replacing isEmpty == false with !isEmpty
  • Enforces explicit @Relationship delete rules to prevent orphaned records on deletion
  • Validates CloudKit-specific constraints such as optionality and eventual consistency when the project uses CloudKit sync
  • Flags @Query usage outside SwiftUI views and provides FetchDescriptor-based alternatives
  • Covers iOS 18 database indexing and iOS 26 model subclassing with @available requirements from dedicated reference files

Swiftdata Pro by the numbers

  • 6,523 all-time installs (skills.sh)
  • +261 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #24 of 1,048 Mobile Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

swiftdata-pro capabilities & compatibility

Capabilities
swiftdata model authoring · predicate safety checking · relationship delete rule enforcement · cloudkit constraint validation · ios 18 index recommendations · ios 26 model subclassing guidance · @query placement validation · fetchdescriptor optimization
Use cases
code review · debugging · documentation
Platforms
macOS
Runs
Runs locally
Pricing
Free
From the docs

What swiftdata-pro says it does

Writes, reviews, and improves SwiftData code using modern APIs and best practices.
SKILL.md
Do not suggest Core Data functionality unless it is a feature that cannot be solved with SwiftData.
SKILL.md
npx skills add https://github.com/twostraws/swiftdata-agent-skill --skill swiftdata-pro

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs6.5k
repo stars383
Security audit3 / 3 scanners passed
Last updatedMarch 11, 2026
Repositorytwostraws/swiftdata-agent-skill

What it does

Write, review, and fix SwiftData model code targeting Swift 6.2+, covering predicates, relationships, CloudKit constraints, and iOS 18/26 indexing and inheritance patterns.

Who is it for?

iOS and macOS developers building or auditing SwiftData model layers, especially apps using CloudKit sync, iOS 18 indexing, or iOS 26 model inheritance.

Skip if: Projects using Core Data exclusively, or those needing third-party ORM frameworks introduced without discussion.

When should I use this skill?

You are writing new SwiftData models, reviewing existing persistence code, debugging a predicate crash, adding CloudKit sync, or adopting iOS 18 indexes or iOS 26 class inheritance.

What you get

Developers get file-by-file findings with named rules and before/after fixes, or directly corrected code, prioritized by impact from crash-level bugs down to minor improvements.

  • File-by-file review report with named rules and before/after fixes
  • Directly corrected SwiftData code when asked to write or improve
  • Prioritized summary of issues by impact level

By the numbers

  • 5 modular reference files covering core rules, predicates, CloudKit, indexing, and class inheritance
  • 2 iOS version thresholds covered: iOS 18 for indexing, iOS 26 for class inheritance
  • 3 output sections per finding: file/line, rule name, before/after fix

Files

SKILL.mdMarkdownGitHub ↗

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.

Review process:

1. Check for core SwiftData issues using references/core-rules.md. 1. Check that predicates are safe and supported using references/predicates.md. 1. If the project uses CloudKit, check for CloudKit-specific constraints using references/cloudkit.md. 1. If the project targets iOS 18+, check for indexing opportunities using references/indexing.md. 1. 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.

Core Instructions

  • Target Swift 6.2 or later, using modern Swift concurrency.
  • The user strongly prefers to use SwiftData across the board. Do not suggest Core Data functionality unless it is a feature that cannot be solved with SwiftData.
  • Do not introduce third-party frameworks without asking first.
  • Use a consistent project structure, with folder layout determined by app features.

Output Format

If the user asks for a review, organize findings by file. For each issue:

1. State the file and relevant line(s). 2. Name the rule being violated. 3. Show a brief before/after code fix.

Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.

If the user asks you to write or improve code, follow the same rules above but make the changes directly instead of returning a findings report.

Example output:

Destination.swift

Line 8: Add an explicit delete rule for relationships.

// Before
var sights: [Sight]

// After
@Relationship(deleteRule: .cascade, inverse: \Sight.destination) var sights: [Sight]

Line 22: Do not use `isEmpty == false` in predicates – it crashes at runtime. Use `!` instead.

// Before
#Predicate<Destination> { $0.sights.isEmpty == false }

// After
#Predicate<Destination> { !$0.sights.isEmpty }

DestinationListView.swift

Line 5: `@Query` must only be used inside SwiftUI views.

// Before
class DestinationStore {
    @Query var destinations: [Destination]
}

// After
class DestinationStore {
    var modelContext: ModelContext

    func fetchDestinations() throws -> [Destination] {
        try modelContext.fetch(FetchDescriptor<Destination>())
    }
}

Summary

1. Data loss (high): Missing delete rule on line 8 of Destination.swift means sights will be orphaned when a destination is deleted. 2. Crash (high): isEmpty == false on line 22 will crash at runtime – use !isEmpty instead. 3. Incorrect behavior (high): @Query on line 5 of DestinationListView.swift only works inside SwiftUI views.

End of example.

References

  • references/core-rules.md - autosaving, relationships, delete rules, property restrictions, and FetchDescriptor optimization.
  • references/predicates.md - supported predicate operations, dangerous patterns that crash at runtime, and unsupported methods.
  • references/cloudkit.md - CloudKit-specific constraints including uniqueness, optionality, and eventual consistency.
  • references/indexing.md - database indexing for iOS 18+, including single and compound property indexes.
  • references/class-inheritance.md - model subclassing for iOS 26+, including @available requirements, schema setup, and predicate filtering.

Related skills

How it compares

Pick swiftdata-pro for SwiftData-specific reviews instead of generic Swift linters that miss persistence and relationship semantics.

FAQ

Why does the skill refuse to suggest Core Data?

The skill follows a user preference to use SwiftData across the board and only mentions Core Data for features that SwiftData genuinely cannot handle.

Which reference files does the skill load for a CloudKit project?

It loads references/core-rules.md and references/cloudkit.md for CloudKit-specific constraints such as optionality and uniqueness requirements.

How are review findings formatted?

Findings are organized by file, each with the line number, the rule violated, and a before/after code snippet, followed by a prioritized summary of the most impactful changes.

Is Swiftdata Pro safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Mobile Developmentbackendtestingdocs

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.