Analyzes SwiftData code for correctness and modern API usage, focusing on Swift 6.2+ concurrency patterns.

Install

mkdir -p .claude/skills/swiftdata-pro && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17962" && unzip -o skill.zip -d .claude/skills/swiftdata-pro && rm skill.zip

Installs to .claude/skills/swiftdata-pro

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Writes, reviews, and improves SwiftData code using modern APIs and best practices. Use when reading, writing, or reviewing projects that use SwiftData.
151 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Review SwiftData code for correctness and modern API usage.
  • Check predicates for safety and support.
  • Verify CloudKit-specific constraints if CloudKit is used.
  • Identify indexing opportunities for iOS 18+.
  • Check for class inheritance patterns for iOS 26+.

How it works

The skill reviews SwiftData code against a set of rules covering core issues, predicate safety, CloudKit constraints, and indexing opportunities.

Inputs & outputs

You give it
SwiftData code files.
You get back
A review report with identified issues, rule violations, and suggested code fixes, or improved SwiftData code.

When to use swiftdata-pro

  • Review SwiftData model code
  • Optimize predicate performance
  • Add CloudKit support
  • Check for indexing opportunities in iOS 18+

About this skill

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.
  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.

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.

When not to use it

  • When working with Core Data instead of SwiftData.
  • When the project does not involve SwiftData code.
  • When the user wants to introduce third-party frameworks without asking.

Limitations

  • The skill focuses on SwiftData code.
  • The skill targets Swift 6.2 or later.
  • The skill does not introduce third-party frameworks without explicit permission.

How it compares

This skill systematically reviews SwiftData code against specific best practices and version-dependent features, unlike a general code review.

Compared to similar skills

swiftdata-pro side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
swiftdata-pro (this skill)03moReviewIntermediate
feature-toggle-developer16moReviewIntermediate
swiftui-view-refactor06moNo flagsIntermediate
swift-coding018dReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

feature-toggle-developer

anyproto

Guides systematic removal of feature toggles from the codebase with automated cleanup detection. Use when removing feature flags, enabling toggles permanently, or cleaning up unused code after toggle removal.

14

swiftui-view-refactor

hot666666

Refactor and review SwiftUI view files for consistent structure, dependency injection, and Observation usage. Use when asked to clean up a SwiftUI view’s layout/ordering, handle view models safely (non-optional when possible), or standardize how dependencies and @Observable state are initialized and

00

swift-coding

Dynokostya

Apply when writing or editing Swift (.swift) files. Behavioral corrections for error handling, concurrency, memory management, type safety, protocol-oriented design, security defaults, and common antipatterns. Project conventions always override these defaults.

00

swift-concurrency

AvdLee

Expert guidance on Swift Concurrency best practices, patterns, and implementation. Use when developers mention: (1) Swift Concurrency, async/await, actors, or tasks, (2) "use Swift Concurrency" or "modern concurrency patterns", (3) migrating to Swift 6, (4) data races or thread safety issues, (5) refactoring closures to async/await, (6) @MainActor, Sendable, or actor isolation, (7) concurrent code architecture or performance optimization, (8) concurrency-related linter warnings (SwiftLint or similar; e.g. async_without_await, Sendable/actor isolation/MainActor lint).

433

swift-concurrency-expert

Dimillian

Swift Concurrency review and remediation for Swift 6.2+. Use when asked to review Swift Concurrency usage, improve concurrency compliance, or fix Swift concurrency compiler errors in a feature or file.

420

ios-dev-guidelines

anyproto

Context-aware routing to Swift/iOS development patterns, architecture, and best practices. Use when working with .swift files, ViewModels, Coordinators, refactoring, or discussing Swift/SwiftUI patterns.

37

Search skills

Search the agent skills registry