apple-cktool
Skill7 starsChanged 10 months agoMITView on GitHub
Operates Apple's Xcode-bundled `cktool` command-line utility for CloudKit development automation on macOS. Use when Codex needs to run, script, explain, or troubleshoot `xcrun cktool`; manage `.ckdb` schemas with export, validate, import, or reset; discover CloudKit teams; create, query, or delete test records; configure management or user tokens in Keychain or CI; or prepare CloudKit-backed integration tests. For equivalent typed JavaScript or TypeScript automation, use `apple-cktool-js` with this skill.
In this repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- apple-cktool-jsSkill
- audit-training-experimentSkill
- awkSkill
- close-out-ml-experimentSkill
- compare-models-blindlySkill
- conventional-commitsSkill
- design-resumable-model-evaluationSkill
- gogopowermanagerSkill
- ios-design-reviewSkill
- mikrotik-routerosSkill
- obsidian-dailySkill
- orbstack-cliSkill
- package-private-ml-artifactsSkill
- prepare-training-corpusSkill
- proxmox-adminSkill
- review-ios-ui-apple-higSkill
- review-training-data-qualitySkill
- run-hugging-face-training-smokeSkill
- sedSkill
- select-and-verify-best-checkpointSkill
- send-to-minionSkill
- swift-reviewSkill
- technical-writerSkill
- tmuxinatorSkill
- topydoSkill
- unhobble-agent-contextSkill
- validate-structured-model-outputSkill
- write-a-promptSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
29 rules. About 0 are common, 10 are distinctive, and 19 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
19
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use the stateless cktool CLI distributed with Xcode to manage CloudKit schemas and test data from macOS.
- Very specific: line 19
Use both skills when a repository exposes a simple local cktool path and a portable CKTool JS CI path.
- Distinctive: line 23
Inspect the local tool: Run:
- Very specific: line 33
Treat local help as authoritative for the installed Xcode.
- Very specific: line 37
Select the token class: Use a management token for team/container discovery and schema operations.
- Distinctive: line 41
Confirm destructive scope: Before a destructive operation, state the exact container, environment, database, zone, record type or record …
- Distinctive: line 43
Execute without exposing credentials: Prefer interactive Keychain storage for local work and environment injection from a secret manager …
- Distinctive: line 45
Verify the result: Check the exit status, capture structured JSON when the command returns it, re-export a changed schema, or re-query …
- Very specific: line 49
Default to development. Treat any production record mutation as high impact.
- Distinctive: line 52
Do not assume schema import to production is a normal deployment path merely because a local parser accepts an environment value.
- Very specific: line 53
Run validate-schema before import-schema.
- Very specific: line 54
Run delete-records with its default --dry-run true first.
- Very specific: line 55
Prefer --fields-file or --fields-stdin over large inline JSON.
- Very specific: line 56
Do not use command-line --token in shared shells, process listings, CI logs, or recorded terminal sessions.
- Very specific: line 72
Keep .ckdb schema files in version control when the repository uses declarative CloudKit schema management.
- Distinctive: line 90
After import, export again and compare the effective schema when exact server state matters.
- Distinctive: line 100
Use this only when deleting all development data is intended.
- Very specific: line 119
Read references/records-and-filters.md before composing field JSON, filters, sorts, assets, pagination, or deletions.
- Very specific: line 147
Do not change the dry run to false until the returned count and target are verified.
- Very specific: line 151
If xcrun cannot find cktool, inspect xcode-select -p, verify Xcode 13 or newer is installed, and select the intended Xcode developer …
- Distinctive: line 152
If authentication fails, verify the operation uses the correct token class and check token expiration or revocation.
- Distinctive: line 153
If a query fails, inspect record type spelling, field types, zone, database, and Queryable/Sortable indexes.
- Distinctive: line 154
If JSON parsing fails, move inline fields to a file and validate the JSON separately.
- Very specific: line 155
If the CLI reports usage error 64, re-read xcrun cktool help <subcommand> for the installed version.
- Very specific: line 156
If CloudKit rejects a schema, run validate-schema, inspect the .ckdb diff, and verify the environment/container pair.
- Very specific: line 160
Read references/command-reference.md for the complete command surface, required flags, exit codes, and examples.
- Very specific: line 161
Read references/records-and-filters.md for field JSON, assets, filters, sorts, indexes, pagination, and safe deletion.
- Very specific: line 162
Read references/authentication-and-automation.md for token precedence, Keychain, environment variables, Xcode test setup, and CI patterns.
- Very specific: line 163
Read references/sources.md for Apple documentation, WWDC sessions, samples, and the verification snapshot.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Apple cktool
Use the stateless cktool CLI distributed with Xcode to manage CloudKit schemas and test data from macOS. Keep the target explicit and default all development automation to the development environment.
Choose the right companion
| Need | Use |
| Shell commands, Xcode schemes, or a macOS runner | This skill |
| TypeScript, Node.js, browser tooling, or non-macOS CI | apple-cktool-js |
| A shell wrapper around a few stable commands | This skill |
| Reusable branching logic, typed models, updates, or richer error handling | apple-cktool-js |
Use both skills when a repository exposes a simple local cktool path and a portable CKTool JS CI path. Keep the same team, container, environment, schema file, and safety policy across both implementations.
Follow the operating workflow
Inspect the local tool. Run:
xcode-select -p xcrun --find cktool xcrun cktool --version xcrun cktool --help xcrun cktool help <subcommand>Treat local help as authoritative for the installed Xcode. Use
man cktoolfor field formats, token precedence, and examples. Do not assume flags from a different Xcode release.- Resolve the complete target. Record the team ID, container ID, environment, database type, zone, record type, and schema path that apply. Do not infer a production target from an app bundle identifier. Use
get-teamswhen the team ID is unknown. - Select the token class. Use a management token for team/container discovery and schema operations. Use a user token for record operations on behalf of an iCloud user. Read
references/authentication-and-automation.mdbefore configuring tokens or CI. - Prepare a reversible command. Export before schema changes, validate before import, query before a single-record deletion, and use the default dry run before bulk deletion. Treat reset, import, creation, and deletion as remote mutations.
- Confirm destructive scope. Before a destructive operation, state the exact container, environment, database, zone, record type or record name, and expected effect. Require explicit user authorization for production writes, schema reset, or permanent deletion unless that exact operation is already the user's request.
- Execute without exposing credentials. Prefer interactive Keychain storage for local work and environment injection from a secret manager for CI. Never print, paste into logs, commit, or pass a token in a command when a safer mechanism is available.
- Verify the result. Check the exit status, capture structured JSON when the command returns it, re-export a changed schema, or re-query affected records. Report the resolved target and outcome, with tokens redacted.
Apply safety invariants
- Default to
development. Treat anyproductionrecord mutation as high impact. - Remember that
reset-schemaresets the development schema to production and deletes all development data. - Remember that exporting a schema backs up schema text, not record data.
- Do not assume schema import to production is a normal deployment path merely because a local parser accepts an environment value. Apple's documented workflow imports into development and deploys schema to production through the supported CloudKit workflow.
- Run
validate-schemabeforeimport-schema; useimport-schema --validateonly when one combined step is appropriate. - Run
delete-recordswith its default--dry-run truefirst. Use--dry-run false --yesonly after reviewing the match count and filters. - Prefer
--fields-fileor--fields-stdinover large inline JSON. This reduces quoting errors and accidental shell expansion. - Do not use command-line
--tokenin shared shells, process listings, CI logs, or recorded terminal sessions. - Preserve pagination. If
query-recordsreturnscontinuationToken, continue until the requested scope is complete and stop on a repeated token. - Expect indexed-query requirements. A queried or sorted field must have the appropriate CloudKit index; an unfiltered query may require
___recordIDto be Queryable.
Use common schema recipes
Export a baseline
xcrun cktool export-schema \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--output-file Schema.ckdbKeep .ckdb schema files in version control when the repository uses declarative CloudKit schema management. Review the diff before importing.
Validate, then import
xcrun cktool validate-schema \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--file Schema.ckdb
xcrun cktool import-schema \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--file Schema.ckdbAfter import, export again and compare the effective schema when exact server state matters.
Reset test state
xcrun cktool reset-schema \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID"Use this only when deleting all development data is intended. Reapply the tested schema and seed data in a deterministic order before integration tests.
Use common record recipes
Query with a bounded result
xcrun cktool query-records \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--database-type public \
--zone-name _defaultZone \
--record-type Book \
--filters "pageCount >= int64Type:1000" \
--requested-fields title pageCount \
--limit 50Read references/records-and-filters.md before composing field JSON, filters, sorts, assets, pagination, or deletions.
Create from a file
xcrun cktool create-record \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--database-type public \
--zone-name _defaultZone \
--record-type Book \
--fields-file fixtures/book.jsonPreview a bulk deletion
xcrun cktool delete-records \
--container-id "$CONTAINER_ID" \
--environment development \
--database-type public \
--zone-name _defaultZone \
--record-type Book \
--filters "fixtureRun == stringType:run-123" \
--dry-run trueDo not change the dry run to false until the returned count and target are verified.
Diagnose failures
- If
xcruncannot findcktool, inspectxcode-select -p, verify Xcode 13 or newer is installed, and select the intended Xcode developer directory. - If authentication fails, verify the operation uses the correct token class and check token expiration or revocation. User tokens are short-lived.
- If a query fails, inspect record type spelling, field types, zone, database, and Queryable/Sortable indexes.
- If JSON parsing fails, move inline fields to a file and validate the JSON separately.
- If the CLI reports usage error 64, re-read
xcrun cktool help <subcommand>for the installed version. - If CloudKit rejects a schema, run
validate-schema, inspect the.ckdbdiff, and verify the environment/container pair.
Load references on demand
- Read
references/command-reference.mdfor the complete command surface, required flags, exit codes, and examples. - Read
references/records-and-filters.mdfor field JSON, assets, filters, sorts, indexes, pagination, and safe deletion. - Read
references/authentication-and-automation.mdfor token precedence, Keychain, environment variables, Xcode test setup, and CI patterns. - Read
references/sources.mdfor Apple documentation, WWDC sessions, samples, and the verification snapshot.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

