Axiom Audit Icloud 标志

Axiom Audit Icloud

社区热门
CharlesWiltgen
axiom-audit-icloud

当用户提到 iCloud 同步问题、CloudKit 错误、ubiquitous container 问题,或要求审计云同步时使用。

Add to TypingMind

概览

发布者CharlesWiltgen
代码仓库Axiom
技能名称axiom-audit-icloud
星标数
1.2K
复刻数
86
附带文件
1
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 CharlesWiltgen 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Axiom Audit Icloud AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-audit-icloud
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CharlesWiltgen/Axiom.git /tmp/Axiom
mkdir -p .claude/skills
cp -r /tmp/Axiom/axiom-codex/skills/axiom-audit-icloud .claude/skills/axiom-audit-icloud
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Axiom Audit Icloud,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Axiom Audit Icloud。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Axiom Audit Icloud 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

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
  • cloudKitDatabase: configuration in ModelConfiguration Verify: Read SwiftData model files; confirm @Attribute(.unique) and required relationships are absent on synced models. Fix: Remove .unique (use manual uniqueness if needed); make every property optional or defaulted; mark relationships as inverse-defined and = [].

Pattern 5: Missing Conflict Resolution for iCloud Drive (MEDIUM/MEDIUM)

Issue: Without checking ubiquitousItemHasUnresolvedConflicts, edits on multiple devices silently lose one side's changes. Search:

  • ubiquitousItemHasUnresolvedConflicts — conflict detection
  • NSFileVersion — version-based resolution Verify: Read iCloud Drive document handling files; confirm conflict detection runs before opening/editing each document. Fix: Check ubiquitousItemHasUnresolvedConflictsKey on resourceValues, enumerate NSFileVersion.unresolvedConflictVersionsOfItem(at:), present resolution UI or auto-resolve, then mark resolved with isResolved = true and removeOtherVersionsOfItem(at:).

Pattern 6: Legacy CloudKit APIs on iOS 17+ Targets (MEDIUM/LOW)

Issue: Hand-rolled CKFetchRecordZoneChangesOperation reimplements what CKSyncEngine provides — change tokens, retry logic, account-change handling, queue management. Search:

  • CKFetchRecordZoneChangesOperation, CKModifyRecordsOperation
  • Manual serverChangeToken plumbing Verify: Read deployment target (Info.plist or project settings). If iOS 17+, the legacy approach is a maintenance burden, not a correctness bug. Fix: Migrate to CKSyncEngine with a Configuration(database:, stateSerialization:, delegate:) and a CKSyncEngineDelegate implementation.

Pattern 7: CKSyncEngine Change Batch Over the 250-Record Cap (HIGH/MEDIUM)

Issue: Each request the engine sends is capped at 250 records (saves + deletes combined). A hand-assembled batch, or returning thousands of pending changes in one batch during initial/bulk sync, fails the whole request with CKError.limitExceeded. Search:

  • nextRecordZoneChangeBatch
  • RecordZoneChangeBatch\(
  • pendingRecordZoneChanges Verify: Read the nextRecordZoneChangeBatch(_:syncEngine:) implementation. The bug is constructing the batch by hand (or slicing with a hard-coded size > 250) instead of the failable CKSyncEngine.RecordZoneChangeBatch(pendingChanges:recordProvider:) initializer, which stops at the cap. Fix: return await CKSyncEngine.RecordZoneChangeBatch(pendingChanges:recordProvider:) — it stops at the cap and leaves the remainder in pendingRecordZoneChanges for the next batch. Treat .limitExceeded as retry-with-smaller-batch. (Server-side limit; applies on every CKSyncEngine version, iOS 17+.)

Pattern 8: Persisted or Shipped ExportedAssetID (HIGH/LOW) OS27

Issue: CKAsset.ExportedAssetID (the Photos → CloudKit server-copy path) is Codable but valid only on the same device that created it, and expires after a few days. Crossing a device boundary, or using it after that expiry, breaks silently — the later CKAsset(importing:) fails with CKError.assetNotAvailable. Persisting it is fragile for exactly that reason. Search:

  • CKAsset\(importing:
  • ExportedAssetID
  • exportedAssetID\( Verify: Read the surrounding code. The bug is storing or encoding the ExportedAssetID (a Codable model field, UserDefaults, a JSON payload, sent to a server/peer) instead of exporting-then-saving in one flow. Also flag any read of fileURL on an imported asset — it is always nil. Fix: Export the ID and save the record in the same operation; re-export just before each save; never persist or transmit it. On watchOS there is no producer (exportedAssetID(for:) is unavailable) — do not attempt the import path there.

Phase 3: Reason About iCloud Completeness

Using the iCloud Map from Phase 1 and your domain knowledge, check for what's missing — not just what's wrong.

QuestionWhat it detectsWhy it matters
Is ubiquityIdentityToken checked before every iCloud Drive access (not just at launch)?Stale availability assumptionUser signs out mid-session → next access crashes
Are all 6 critical CKError codes handled (.quotaExceeded, .networkUnavailable, .serverRecordChanged, .notAuthenticated, .zoneNotFound, .partialFailure)?Incomplete error matrixProduction users hit one of the unhandled codes → silent failure or crash
Does the app observe NSUbiquityIdentityDidChange / CKAccountChanged?Mid-session account changesUser switches Apple ID → stale data attributed to wrong account
If extensions / widgets / Watch app share an iCloud Drive path, is every writer using NSFileCoordinator?Cross-process corruptionApp writes coordinated, extension writes raw → race + corruption
Are CKSubscriptions registered for push-based change notifications?Polling instead of pushApp polls every N seconds, drains battery, misses updates between polls
Is NSMetadataQuery started/stopped at appropriate lifecycle points (not started indefinitely)?Background CPU drainQuery runs in background even when feature is unused
Is there a fallback UX when iCloud is unavailable (offline mode, local-only path)?Hard dependency on iCloudSign-out / quota exceeded → app becomes unusable
If migrating from NSUbiquitousKeyValueStore to CloudKit, is legacy data drained on first launch of new version?Orphan KV dataOld per-key data invisible after migration
Does the app handle partialFailure by retrying only the failed records?Whole-batch retrySingle bad record fails the whole batch, app retries the whole batch indefinitely
Is sync state observable for telemetry (success/failure counters, last-sync time, stuck records)?Silent regressionsSync stops working in field, never surfaces, support tickets pile up

Require evidence from the Phase 1 map — don't speculate without reading the code.

Phase 4: Cross-Reference Findings

Bump severity for these combinations:

Finding A+ Finding B= CompoundSeverity
Missing NSFileCoordinator (Pattern 1)Multi-process access (extension / widget / Watch)Guaranteed corruption — different processes race on every concurrent writeCRITICAL
Missing entitlement check (Pattern 3)iCloud Drive write pathCrash on signed-out user, no graceful pathCRITICAL
Missing CKError handling (Pattern 2)Automated retry loopSilent infinite retry on quotaExceeded → drains user data plan and batteryHIGH
SwiftData @Attribute(.unique) (Pattern 4)cloudKitDatabase: configuredSync silently disabled for the entire containerHIGH
Missing conflict resolution (Pattern 5)Multi-device app (iPhone + iPad + Mac)Edits accumulate conflicts over time, data loss compoundsHIGH
Legacy CKDatabase APIs (Pattern 6)iOS 17+ deployment targetReinvents CKSyncEngine — every bug fix Apple ships costs you eng timeMEDIUM
Missing CKSubscription registrationTime-sensitive sync requirementUpdates lag by polling interval — minutes to hours visible to userMEDIUM
Missing partialFailure handlingBatch save of N recordsOne bad record poisons the whole batch, retries foreverMEDIUM

Cross-auditor overlap notes:

  • CloudKit-synced @Model classes → compound with swiftdata-auditor (Pattern 4 specifically)
  • iCloud Drive container vs Documents location → compound with storage-auditor
  • Network connectivity prerequisites for sync → compound with networking-auditor
  • Sync callbacks on wrong queue → compound with concurrency-auditor

Phase 5: iCloud Health Score

MetricValue
Subsystems in useCloudKit / iCloud Drive / KV / SwiftData+CK count
Coordination coverageM of N ubiquitous I/O sites use NSFileCoordinator (Z%)
Availability check coverageM of N entry paths guard with token / accountStatus (Z%)
CKError code coverageM of 6 critical codes handled
Account-change observationyes / no
Conflict resolutionimplemented / missing / N/A
Sync engineCKSyncEngine / legacy / hand-rolled
HealthSAFE / FRAGILE / DANGEROUS

Scoring:

  • SAFE: No CRITICAL issues, every ubiquitous I/O is coordinated, every entry path checks availability, all 6 critical CKError codes handled, account-change observed, conflict resolution present, CKSyncEngine in use on iOS 17+.
  • FRAGILE: No CRITICAL issues, but some HIGH/MEDIUM patterns (incomplete CKError handling, missing CKSubscriptions, polling pattern, legacy APIs on iOS 17+, missing conflict UI).
  • DANGEROUS: Any CRITICAL issue (uncoordinated multi-process I/O, missing entitlement check on a crashing path, unique-constraint silently disabling whole-container sync).

Output Format

markdown
# iCloud Audit Results

## iCloud Map
[5-10 line summary from Phase 1]

## Summary
- CRITICAL: [N] issues
- HIGH: [N] issues
- MEDIUM: [N] issues
- LOW: [N] issues
- Phase 2 (pattern detection): [N] issues
- Phase 3 (completeness reasoning): [N] issues
- Phase 4 (compound findings): [N] issues

## iCloud Health Score
[Phase 5 table]

## Issues by Severity

### [SEVERITY/CONFIDENCE] [Pattern Name]: [Description]
**File**: path/to/file.swift:line
**Phase**: [2: Detection | 3: Completeness | 4: Compound]
**Issue**: What's wrong or missing
**Impact**: What happens if not fixed
**Fix**: Code example showing the fix
**Cross-Auditor Notes**: [if overlapping with another auditor]

## Recommendations
1. [Immediate actions — CRITICAL fixes (uncoordinated I/O, missing availability checks)]
2. [Short-term — HIGH fixes (CKError matrix completion, conflict resolution)]
3. [Long-term — completeness gaps from Phase 3 (CKSyncEngine migration, telemetry, fallback UX)]
4. [Test plan — sign-out / quota exceeded / multi-device conflict / offline / account switch scenarios]

Output Limits

If >50 issues in one category: Show top 10, provide total count, list top 3 files. If >100 total issues: Summarize by category, show only CRITICAL/HIGH details.

False Positives (Not Issues)

  • Local file operations (URLs not in iCloud container)
  • CloudKit Console / Web Services access (not runtime code)
  • Test code with mocked CloudKit / mocked file URLs
  • @Attribute(.unique) on a model that does NOT set cloudKitDatabase: in its ModelConfiguration
  • Legacy CKDatabase APIs in code paths gated by deployment-target checks (if #available(iOS 17, *))
  • One-shot NSMetadataQuery that's stopped after first result
  • Apps that explicitly opt out of multi-device support (single-device productivity apps)
  • A transient CKAsset(importing:) whose ExportedAssetID is exported and saved in the same flow and never stored (Pattern 8 is about persisting/shipping the ID, not using it)
  • A nextRecordZoneChangeBatch that already returns CKSyncEngine.RecordZoneChangeBatch(pendingChanges:recordProvider:) (the failable initializer already enforces the 250 cap — Pattern 7)

Related

For modern CloudKit patterns: axiom-data (skills/cloudkit-ref.md) For iCloud Drive coordination: axiom-data (skills/icloud-drive-ref.md) For sync troubleshooting: axiom-data (skills/cloud-sync-diag.md) For SwiftData + CloudKit specifics: swiftdata-auditor agent For file location and backup exclusion: storage-auditor agent For sync callback queue safety: axiom-concurrency

Invocation Examples

Prompts that should launch this agent:

Explicit command: Users can also invoke this agent directly with axiom-audit-icloud

Scope

Automatically runs comprehensive iCloud audit to detect missing entitlement checks, unsafe file coordination, missing error handling, and CloudKit anti-patterns - prevents sync failures and data conflicts.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Axiom Audit Icloud AI 技能有什么作用?

当用户提到 iCloud 同步问题、CloudKit 错误、ubiquitous container 问题,或要求审计云同步时使用。

为什么在 TypingMind 中使用 Axiom Audit Icloud?

因为您只需安装一次,就能搭配任何模型使用。Axiom Audit Icloud 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Axiom Audit Icloud?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-audit-icloud。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Axiom Audit Icloud?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Axiom Audit Icloud 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Axiom Audit Icloud 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Axiom Audit Icloud AI 技能免费吗?

是的。CharlesWiltgen 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇