swiftdata-pro
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.zipInstalls 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.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
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:
- Check for core SwiftData issues using
references/core-rules.md. - Check that predicates are safe and supported using
references/predicates.md. - If the project uses CloudKit, check for CloudKit-specific constraints using
references/cloudkit.md. - If the project targets iOS 18+, check for indexing opportunities using
references/indexing.md. - 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:
- State the file and relevant line(s).
- Name the rule being violated.
- 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
- Data loss (high): Missing delete rule on line 8 of Destination.swift means sights will be orphaned when a destination is deleted.
- Crash (high):
isEmpty == falseon line 22 will crash at runtime – use!isEmptyinstead. - Incorrect behavior (high):
@Queryon 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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| swiftdata-pro (this skill) | 0 | 3mo | Review | Intermediate |
| feature-toggle-developer | 1 | 6mo | Review | Intermediate |
| swiftui-view-refactor | 0 | 6mo | No flags | Intermediate |
| swift-coding | 0 | 18d | Review | Intermediate |
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.
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
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.
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).
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.
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.