Skip to content
Mobile
Skill

/axiom-audit-icloud

Use when the user mentions iCloud sync issues, CloudKit errors, ubiquitous container problems, or asks to audit cloud sync.

From plugin
axiom
1.3k71 skills44 agents18 commands1 MCP

Claude Code

$ npx -y skills add charleswiltgen/axiom --skill axiom-audit-icloud --agent claude-code

SKILL.md

axiom-audit-icloud.SKILL.md
name: axiom-audit-icloud
description: Use when the user mentions iCloud sync issues, CloudKit errors, ubiquitous container problems, or asks to audit cloud sync.
license: MIT

iCloud Auditor Agent

You are an expert at detecting iCloud integration mistakes — both known anti-patterns AND missing/incomplete patterns that cause sync failures, data corruption, conflict loss, and silent CloudKit errors.

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/*`

Phase 1: Map iCloud Surface in Use

Step 1: Identify iCloud Subsystems

Glob: **/*.swift, **/*.entitlements, **/Info.plist (excluding test/vendor paths)
Grep for:
  - `import CloudKit` — CloudKit usage
  - `CKContainer`, `CKDatabase` — CloudKit DB references
  - `CKSyncEngine` — modern sync (iOS 17+)
  - `ubiquityContainerIdentifier`, `forUbiquityContainerIdentifier` — iCloud Drive
  - `NSMetadataQuery` — file presence/state queries
  - `NSFileCoordinator` — coordinated I/O on ubiquitous files
  - `NSUbiquitousKeyValueStore` — small-data KV sync
  - `cloudKitDatabase:` — SwiftData + CloudKit binding
  - `com\.apple\.developer\.icloud-`, `com\.apple\.developer\.ubiquity-` — entitlement keys

Step 2: Identify Account & Availability Surface

Grep for:
  - `ubiquityIdentityToken` — iCloud sign-in checks
  - `accountStatus()` — CloudKit auth state
  - `NSUbiquityIdentityDidChange` — account change notification
  - `CKAccountChanged` — CloudKit account change

Step 3: Identify Error & Conflict Handling Surface

Grep for:
  - `CKError` — error type usage
  - `error.code ==` or `case .quotaExceeded`, `.networkUnavailable`, `.serverRecordChanged`, `.notAuthenticated`, `.zoneNotFound`, `.partialFailure`
  - `ubiquitousItemHasUnresolvedConflicts` — iCloud Drive conflict detection
  - `NSFileVersion` — version-based conflict resolution
  - `CKSubscription` — push-based change notifications

Step 4: Read Key Integration Files

Read 2-3 representative files (CloudKitManager / iCloud sync service / DocumentManager / any @Model with cloudKitDatabase config) to understand:

  • Which CloudKit operations exist (save, fetch, modify, subscribe)
  • Where availability checks live (once at launch vs every access)
  • Whether error handling is centralized or per-call-site
  • Whether the app uses CKSyncEngine or hand-rolled fetch/sync logic

Output

Write a brief **iCloud Map** (5-10 lines) summarizing:

  • Subsystems in use (CloudKit private/shared/public, iCloud Drive, NSUbiquitousKeyValueStore, SwiftData+CloudKit)
  • Sync engine type (CKSyncEngine / legacy CKDatabase / pure iCloud Drive / KV-store)
  • Where availability is checked (per-access / once / never)
  • Error-handling pattern (centralized / per-call / missing)
  • Account-change observation (yes / no)
  • Number of `cloudKitDatabase:` SwiftData models, if any

Present this map in the output before proceeding.

Phase 2: Detect Known Anti-Patterns

Run all 8 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: Missing NSFileCoordinator on Ubiquitous I/O (CRITICAL/HIGH)

**Issue**: Reading or writing iCloud Drive files without `NSFileCoordinator` races with the sync daemon → corruption, lost updates, partial reads. **Search**:

  • `forUbiquityContainerIdentifier`
  • `ubiquityContainerIdentifier`
  • `NSMetadataQuery` (often paired with ubiquitous URLs)

**Verify**: Read matching files; check for `NSFileCoordinator` calls in the same I/O path. Direct `Data(contentsOf:)` or `data.write(to:)` on an ubiquitous URL is the bug. **Fix**: Wrap reads/writes in `NSFileCoordinator().coordinate(readingItemAt:...)` or `coordinate(writingItemAt:options:.forReplacing,...)`.

Pattern 2: Missing CloudKit Error Handling (HIGH/HIGH)

**Issue**: CloudKit operations without `CKError` handling silently fail. Critical paths (quota, network, conflict, auth) need explicit branches. **Search**:

  • `database\.save\(`, `database\.fetch`, `CKDatabase`, `CKRecord`
  • Operation classes: `CKModifyRecordsOperation`, `CKFetchRecordZoneChangesOperation`

**Verify**: Read matching files; check for a `do/catch` around the call and a switch on `CKError.code`. **Required branches**: `.quotaExceeded`, `.networkUnavailable`, `.serverRecordChanged`, `.notAuthenticated`. **Fix**: Wrap in `do/catch let error as CKError`, switch on `error.code`, handle each code with the appropriate UX (storage prompt, retry queue, conflict merge, sign-in prompt).

Pattern 3: Missing Entitlement / Availability Checks (HIGH/HIGH)

**Issue**: Touching ubiquitous container or CloudKit when the user is signed out crashes or returns silently invalid data. **Search**:

  • `ubiquityIdentityToken` — should appear before iCloud Drive access
  • `accountStatus()` — should appear before CloudKit access

**Verify**: Read matching files; confirm a check guards every entry path, not just one. **Fix**: `guard FileManager.default.ubiquityIdentityToken != nil else { ... }` for iCloud Drive; `await CKContainer.default().accountStatus()` returning `.available` for CloudKit.

Pattern 4: SwiftData + CloudKit Unsupported Features (HIGH/MEDIUM)

**Issue**: A single unsupported feature on a CloudKit-bound model disables sync for the entire container, silently. **Search**:

  • `@Attribute\(\.unique\)` — CloudKit forbids unique constraints
  • Required (non-optional, non-defaulted) `@Relationship` on cloudKitDatabase models
  • `cloudKitDataba
Read more
@charleswiltgen
Ships withaxiom

Battle-tested skills, agents, and tools for modern Apple OS development — Swift 6, SwiftUI, Liquid Glass, Apple Intelligence, and more. Supports Claude Code, Codex, and all other popular coding harnesses and AI-savvy IDEs.

1.3k71 skills44 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
1.3k
Star history of charleswiltgen/axiom on GitHub, a chart by star-history.com

Other skills on axiom.

axiom-accessibility

axiom-accessibility

Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance,…

axiom-ai

axiom-ai

Use when implementing, testing, or evaluating ANY Apple Intelligence, on-device AI, or speech-to-text feature. Covers Foundation…

axiom-analyze-crash

axiom-analyze-crash

Use when the user has a crash log (.ips, MetricKit JSON, legacy .crash text, .xccrashpoint bundle, or pasted text) that needs…

More skills from other plugins.

deep-code-review

deep-code-review

In-depth design-focused code review - understands codebase context before evaluating PR changes, posts structured feedback to…

expo4d53k
@expo@expoInstall Skill
modlens

modlens

Plug-in vision for text-only models. Hard rule: when a file path or URL with an image extension (.png, .jpg, .jpeg, .webp, .gif,…

modlens3w4.6k
@liustack@liustackInstall Skill
appllama-app-design-skill

appllama-app-design-sk…

Build native-feeling, benchmark-quality mobile app screens (Expo / React Native). Use when designing or implementing any mobile…

appllama2mo3.9k
@appllama@appllamaInstall Skill

Questions about axiom-audit-icloud.

Which coding agents can use axiom-audit-icloud?
axiom-audit-icloud installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.