Swiftdata Code Review
/install swiftdata-code-review
SwiftData Code Review
Quick Reference
| Issue Type | Reference |
|---|---|
| @Model, @Attribute, @Relationship, delete rules | references/model-design.md |
| @Query, #Predicate, FetchDescriptor, #Index | references/queries.md |
| @ModelActor, ModelContext, background operations | references/concurrency.md |
| VersionedSchema, MigrationStage, lightweight/custom | references/migrations.md |
Hard gates (before reporting findings)
Run in order; do not assert an issue until the gate for that issue passes.
- Scope — pass when: You have the target
.swiftpath(s) and confirmed SwiftData surface in scope (e.g.import SwiftData,@Model,@Query,@ModelActor,VersionedSchema, or migration types). If none apply, stop or narrow scope with one sentence. - Reference — pass when: For each checklist area you evaluate (models, queries, concurrency, migrations), you opened the matching
references/*.mdfrom the Quick Reference table or wroteN/A: no \x3Carea> in this reviewwith a one-line reason. - Evidence — pass when: Every finding uses the
[FILE:LINE] ISSUE_TITLEheader (line range allowed) from the file you read; no finding without a cite. - Report — pass when: Findings list cites first (or inline) using
[FILE:LINE] ISSUE_TITLE, then severity or checklist grouping—no uncited assertions.
Review Checklist
- Models marked
final(subclassing crashes) - @Relationship decorator on ONE side only (not both)
- Delete rules explicitly set (not relying on default .nullify)
- Relationships initialized to empty arrays, not default objects
- Batch operations used for bulk inserts (
append(contentsOf:)) - @Query not loading thousands of items on main thread
- External values in predicates captured in local variables
- Scalar comparisons in predicates (not object references)
- @ModelActor used for background operations
- PersistentIdentifier/DTOs used to pass data between actors
- VersionedSchema defined for each shipped version
- MigrationPlan passed to ModelContainer
When to Load References
- Reviewing @Model or relationships -> model-design.md
- Reviewing @Query or #Predicate -> queries.md
- Reviewing @ModelActor or background work -> concurrency.md
- Reviewing schema changes or migrations -> migrations.md
Review Questions
- Could this relationship assignment cause NULL foreign keys?
- Is @Relationship on both sides creating circular references?
- Could this @Query block the main thread with large datasets?
- Are model objects being passed between actors unsafely?
- Would schema changes require a migration plan?
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install swiftdata-code-review - After installation, invoke the skill by name or use
/swiftdata-code-review - Provide required inputs per the skill's parameter spec and get structured output
What is Swiftdata Code Review?
Reviews SwiftData code for model design, queries, concurrency, and migrations. Use when reviewing .swift files with import SwiftData, @Model, @Query, @ModelA... It is an AI Agent Skill for Claude Code / OpenClaw, with 161 downloads so far.
How do I install Swiftdata Code Review?
Run "/install swiftdata-code-review" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Swiftdata Code Review free?
Yes, Swiftdata Code Review is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Swiftdata Code Review support?
Swiftdata Code Review is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Swiftdata Code Review?
It is built and maintained by Kevin Anderson (@anderskev); the current version is v1.2.1.