audit-swiftdata
Scan SwiftData code for @Model correctness, migration safety, and query patterns that cause silent data loss or runtime crashes.
What This Command Does
Launches the swiftdata-auditor agent to catch the most common SwiftData mistakes — model definitions that won't persist correctly, migrations that lose data, and queries that fan out to N+1 fetches.
What It Checks
- @Model on struct —
@Modelrequires aclass; structs compile but never persist - Missing VersionedSchema — production schemas without versioning, blocking safe migrations
- Relationship defaults —
@Relationshipproperties without explicitdeleteRuleorinverse, causing leaks or orphans - Migration timing — schema changes shipped without a
MigrationPlan, risking data loss on upgrade - N+1 query patterns — fetching a parent then iterating to load children one-by-one
Related Agent
- swiftdata-auditor — The agent that powers this command