/apple-dev:cloudkitfrom apple-dev
Use this skill when a task involves CloudKit — adding iCloud sync or storage to an app (SwiftData, Core Data, CKSyncEngine, or direct CKDatabase), creating or changing a container schema, inspecting or editing container records, preparing a CloudKit app for TestFlight or the App Store, or debugging sync. Not needed for local-only persistence with no iCloud involvement.
Ships in apple-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
cktool needs tokens saved to the keychain before it runs. The user creates them in CloudKit Console (https://icloud.developer.apple.com → account menu → Manage Tokens): a management token for schema and container work, and a user token for record commands. Ask them to run xcrun cktool save-token --type management (and --type user when needed) themselves in their own terminal, where it prompts for the token — never ask for a token in chat or pass one on the command line. Once saved, cktool runs without auth flags. If a cktool command later fails with a missing-token or expired-session error, ask them to save a fresh token.
The project's schema lives in CloudKitSchema.ckdb at the project root — keep it committed as the versioned source of truth.
xcrun cktool export-schema --team-id <team> --container-id <container> --environment development --output-file CloudKitSchema.ckdb writes a container's schema to the file; xcrun cktool validate-schema --team-id <team> --container-id <container> --environment development --file CloudKitSchema.ckdb checks the file against a container.
To apply the file to the development environment, use cktool directly:
xcrun cktool import-schema --team-id <team> --container-id <container> --environment development --file CloudKitSchema.ckdb
Direct cktool commands need --team-id. List teams with xcrun cktool get-teams (after saving the management token) and use the team that owns the container.
xcrun cktool reset-schema resets the development environment to match production and deletes all development data. Destructive — confirm with the user first.
Never derive a container identifier from a placeholder bundle ID — containers are permanent once registered with a team. If PRODUCT_BUNDLE_IDENTIFIER is still a placeholder (such as Bitrig's app.bitrig..), follow the xcodegen-project skill's Bundle Identifier rules first (reuse the App Store Connect bundle ID if there is one, otherwise ask the user for a reverse-DNS ID they own), then update everything derived from it. Never invent a bundle ID yourself.
Each target that uses CloudKit needs these entitlements (in a Project.json project, via the target's entitlements block in Project.json, same shape as App Groups; otherwise in the target's .entitlements file):
"com.apple.developer.icloud-services": ["CloudKit"],
"com.apple.developer.icloud-container-identifiers": ["iCloud.<bundle-id>"]
Derive the container identifier from the real PRODUCT_BUNDLE_IDENTIFIER — container identifiers are globally owned, like App Groups. Use the exact same string in code and in cktool calls. Apps that rely on push-driven sync (SwiftData/Core Data mirroring, CKSyncEngine, subscriptions) also need the aps-environment entitlement set to "development" in the same entitlements block, plus the remote-notification background mode ("UIBackgroundModes": ["remote-notification"] in the target's info properties). No APNs key is needed — CloudKit delivers its own pushes. See the notifications skill for details.
CloudKit's pushes reach the app only; they cannot drive WidgetKit push updates, which need a token the app's own server sends to. A widget backed by CloudKit data refreshes from its timeline and from WidgetCenter.reloadAllTimelines() after the app syncs, so don't add aps-environment to a widget extension for CloudKit's sake — it does nothing there.
cktool operates on containers that already exist under the team. Registering the app's capabilities with xc provision, as the capability-provisioning skill describes, creates a missing container under the team in the target's DEVELOPMENT_TEAM. Use that same team as cktool's --team-id.
Pick the CloudKit API based on how the app stores data, keeping its existing persistence:
The first two mirror the app's models into CloudKit records automatically, which imposes model rules: every attribute optional or given a default, every relationship optional with an inverse, no unique constraints. A model that breaks them fails at container setup with errors that name the store, not the model. Mirrored records land in the private database in zone com.apple.coredata.cloudkit.zone as CD_ record types — that's what to expect in cktool output. In development the mirrored schema is created at runtime as records are saved, so save an instance of each model (or use Core Data's initializeCloudKitSchema) before exporting; otherwise the export will be missing record types.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub chrislaupama/apple-dev-kit --plugin apple-dev25 skills in this plugin
/app-intentsUse when adding or modifying App Intents, App Shortcuts, Siri actions, Spotlight actions, Action Button actions, or parameters exposed through those systems./apple-app-extensionsUse when adding or modifying a Widget, Control Center control, Live Activity, WidgetKit extension, complication, or App Group shared between an app and its extensions./apple-higConsult Apple's Human Interface Guidelines when creating a new app's user-facing interface, designing a new screen or UI component, substantially redesigning UI layout, controls, navigation, or interactions, or answering an explicit HIG guidance or review request. Not triggered by code architecture, API or data-model design, or implementation changes that preserve the UI.Other plugins' skills for the same job