axiom audit swiftdata

Engineering Community

Skill notes

Tool Use Is Mandatory

Run every Glob, Grep, and Read this prompt lists. Do not reason from training data instead of scanning. Run each Grep pattern as written; do not collapse them into one mega-regex. Run the Read verifications each section calls for. "Build a mental model" / "map the architecture" means with tool output in hand, not from memory.

Files to Exclude

Skip: *Tests.swift, *Previews.swift, */Pods/*, */Carthage/*, */.build/*, */DerivedData/*, */scratch/*, */docs/*, */.claude/*, */.claude-plugin/*

Output

Write a brief SwiftData Map (5-10 lines) summarizing: @Model count and which classes are present Number of ModelContainers and their purpose (main app / extension / preview / test) Schema versions registered and the migration plan's stage list Whether the container syncs via CloudKit

Phase 2: Detect Known Anti-Patterns

Run all 10 detection patterns. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.

Pattern 1: @Model on struct Instead of final class (CRITICAL/HIGH)

Issue: SwiftData requires reference semantics. @Model struct compiles but crashes at runtime or silently corrupts data. Search: @Model\s+struct Fix: @Model final class

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Engineering
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
94 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@CharlesWiltgen · MIT
Token usage
Heavy
Setup complexity
Guided setup
External API key
Not required
Operating systems
Unspecified (assume cross-platform)
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Write / modify
Network behavior
External requests
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

01
Phase 1: Map SwiftData Architecture

Phase 1: Map SwiftData Architecture

02
Step 1: Identify the @Model Inventory

Step 1: Identify the @Model Inventory

03
Step 2: Identify Container & Context Topology

Step 2: Identify Container & Context Topology

04
Step 3: Identify Migration Surface

Step 3: Identify Migration Surface

05
Step 4: Identify Sync & Storage Surface

Step 4: Identify Sync & Storage Surface

06
Phase 2: Detect Known Anti-Patterns

Run all 10 detection patterns. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.

07
Phase 3: Reason About SwiftData Completeness

Using the SwiftData Map from Phase 1 and your domain knowledge, check for what's *missing* — not just what's wrong. Question · What it detects · Why it matters Is every @Model class registered in at least one VersionedSchema? · Orphan models · Models defined but unregistered crash at container init or vanish silently Does the SchemaMigrationPlan cover the full path from oldest supported version to current? · Migration gaps · Users on intermediate versions skip stages and crash on launch

08
Phase 4: Cross-Reference Findings

Bump severity for these combinations: Finding A · + Finding B · = Compound · Severity @Model struct (Pattern 1) · @Relationship array on same model · Decode crash on every fetch — guaranteed runtime failure · CRITICAL Missing models in VersionedSchema (Pattern 2) · Production app with active users · Silent data loss across versions, no error surfaced · CRITICAL Background ops on @Environment context (Pattern 5) · Missing save() (Pattern 6) · Data races AND lost work — both correctness and durability fail · CRITICAL

09
Phase 5: SwiftData Health Score

Metric · Value @Model count · N classes Schema registration coverage · M of N models registered in VersionedSchema (Z%) Migration plan coverage · Stages defined / oldest supported version reachable Context isolation · Background work uses dedicated ModelContext (yes/no)

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.