/apple-dev-skills:parallel-agent-xcode-hygienefrom apple-dev-skills
Prevents parallel AI-agent sessions building Apple apps on one Mac from corrupting each other's results or filling the disk. Manages simulator UDID ownership, per-worktree DerivedData paths, disk-space gates before xcodebuild, and verified cleanup.
Ships in apple-dev-skills. 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.
Read when SKILL.md points to them.
Rules for an agent that builds, tests or runs an Apple app on a Mac where other agent sessions do the same at the same time. Each rule removes one way that sessions collide: a shared simulator, a shared build folder, an unbounded build, or disk that nobody frees. The rules are written for git worktrees, one per session, but apply to any shared checkout.
These rules stop the agent's own default actions (build here, use the booted simulator, open the project), so no user request names them. Copy the lines in "Adopt in your project" into the project's always-loaded instructions file so they hold even when this skill is not loaded.
Thresholds are parameters. The worked examples come from one 8-core Mac with a 228 GB disk; set your own numbers.
xcodebuild build or xcodebuild test, or tuist generate, in a git
worktree or on a Mac where other agent sessions run.xcodebuild test reports hundreds of Crash: <App> at XCTWaiter failures, or a test result
disagrees with the same test in another session.No space left on device, or macOS shows
System Data growing.Owns: resource ownership between sessions on one Mac (simulators, DerivedData, worktrees, processes), the gates before a heavy build, the local-versus-CI build decision, and verified cleanup. Does not own:
simulator-runtime-verification.idb, and how many simulators fit in RAM →
interactive-simulator-ux-audit (its Preflight section and fleet-sizing reference).xcode-cloud-single-track-ci.xcodebuild and simctl command syntax → xcode-build-skill:xcode-build.Placeholders: <UDID> (a simulator this session created), <session> (a name unique to this
session), <bundle-id>, <App>.
Rules that live only in this skill fire only when the skill loads. Put these lines in the
project's always-loaded instructions file (CLAUDE.md, AGENTS.md, or your agent's
equivalent), with your own numbers:
- Simulators: create your own (`xcrun simctl create`), address it by UDID everywhere, never by name or `booted`, and delete it when done.
- Builds: pass `-derivedDataPath "$PWD/DerivedData"` from the worktree root. Never touch another session's DerivedData, worktree, or simulator.
- Before a heavy build: skip it and report if the 1-minute load average is above 2 × `sysctl -n hw.ncpu` or free disk is below <N> GB.
- Never open Xcode: `tuist generate --no-open`, no `open *.xcworkspace`, no `xed`. Details: the `parallel-agent-xcode-hygiene` skill.
| Resource | Rule |
|---|---|
| Simulator | Create one per session and use its UDID in every command. Never name=<device>, never booted, never a simulator you did not create. |
| DerivedData | One folder per worktree, inside the worktree. Never the default location, a scratch path, or another worktree's folder. |
| Worktree | Delete only worktrees this session created. |
| Processes | Kill only processes you started, matched by your UDID or path. |
| Machine-wide commands | Never xcrun simctl shutdown all, erase all or delete all, and never wipe the shared DerivedData folder. These belong to the user. |
When something that is not yours blocks you (a full disk, a stuck simulator), report it and let the user decide. Do not delete it.
xcrun simctl list runtimes and xcrun simctl list devicetypes.create prints the new UDID:
UDID=$(xcrun simctl create "<session>" "<device type>" <runtime>).xcodebuild … -destination "platform=iOS Simulator,id=$UDID"xcrun simctl <subcommand> "$UDID" …idb … --udid "$UDID"id=$UDID and leaves the simulator shut down.name=<device> matches any simulator with that name, including one another session is
driving. The special booted value is worse. xcrun simctl help says that when several
devices are booted, simctl "will choose one of them" (Xcode 27.2).
Device types and runtimes differ by Mac and Xcode version. As one machine's observation
(Xcode 27.2, 2026-11-13): the iOS 27.0 runtime offered the regular iPhone device types; the
iOS 27.1 runtime offered only a foldable device type whose screen stayed dark under idb; iOS
17.0 installed for old-OS checks; iOS 15 and 16 runtimes would not install on that macOS.
Check your own list before you choose.
xcodebuild test runs against one simulator. Both install the same host app
under the same bundle ID and overwrite each other, which produces hundreds of false
Crash: <App> at XCTWaiter failures. Test branches one after another, or give each run its
own simulator.xcrun simctl erase "$UDID" before you run tests on that simulator.pkill to your simulator:
pkill -f "simctl spawn $UDID log stream". A bare pkill -f "log stream" ends every
session's streams.-derivedDataPath "$PWD/DerivedData" from the worktree root on every xcodebuild
call. Add DerivedData/ to .gitignore and to the exclude lists of SwiftLint and
SwiftFormat, or the linters scan the checked-out package sources inside it.~/Library/Developer/Xcode/DerivedData keeps one folder per checkout path forever, and a
folder under an agent scratch directory is invisible to whoever cleans up worktrees.DerivedData folder when the task is done or when you stop building for a
while.There is no XCFramework found at <path> while the folder exists, the cached build
description still holds the state from before the artifacts were present. Delete
DerivedData/<project>/Build/Intermediates.noindex/XCBuildData and
DerivedData/<project>/SourcePackages/artifacts/extract, then build again. You do not need
to download the packages again (observed once, Xcode 27).A heavy build is a full xcodebuild build or test, or an archive. Run the gates before each
one, and run at most one heavy build per session at a time.
| Gate | Check | Threshold (parameter) | Worked example | When it fails |
|---|---|---|---|---|
| CPU load | uptime, 1-minute average | above 2 × sysctl -n hw.ncpu | 8 cores → do not start above 16 | Wait about 5 minutes and check again. After 3 failed checks, report instead of building. |
| Free disk | df -h /System/Volumes/Data, Avail column | below a floor that fits one clean build plus margin | 15 GB on a 228 GB disk | Do not start. Delete your own leftovers, then report. |
Measure used space as df -k / size minus available. Do not trust the APFS "Used" column.
To find where the space went, read references/disk-hotspots.md.
When CI builds and tests every pushed branch, the default is to push and read the result
(gh pr checks, gh run view --log-failed). Local builds cost the shared CPU and disk that
other sessions need. Build locally only when one of these applies, and name the reason in your
report:
| Reason | Local action |
|---|---|
| The change edits project generation, build settings or xcconfig files, or adds a target or module | Debug build |
| CI failed twice in a row on a compile error | Debug build to iterate |
The change touches release-only code (#if !DEBUG, a Release-only setting) | Release build with -destination generic/platform=iOS |
| The build regenerates a file you must commit, such as a String Catalog | Debug build once, commit the result → ai-translated-localization |
| The branch gets no CI (for example a pull request stacked on another branch) | Build locally. Leave tests until CI runs. |
| A change needs a runtime check on a simulator | Build, install, check → simulator-runtime-verification |
Do not run the full xcodebuild test locally when CI runs it. To reproduce one crash or flaky
test, run only that test with -only-testing:<Target>/<Class>/<test> and say why. Lint and
format checks (swiftlint, swiftformat --lint) are cheap and stay local.
Tuist opens the generated workspace in Xcode unless you pass --no-open (Tuist 4). Always run
tuist generate --no-open, or set TUIST_GENERATE_OPEN to turn opening off. The same applies to any
generator or script that opens the result. Never run open <App>.xcworkspace or xed. Each
Xcode window starts indexing the project, which takes CPU and memory from every session, and
nobody closes it when the agent finishes.
A command that exits 0 is not proof that space came back. For each simulator you created:
df -h /System/Volumes/Data.xcrun simctl shutdown "$UDID", then xcrun simctl delete "$UDID".~/Library/Developer/CoreSimulator/Devices/$UDID no longer exists, and that
df shows more free space than in step 1.Delete your own DerivedData folder and any temporary worktrees the same way, and report
the free space before and after.
Most collisions here produce a wrong answer, not an error. Two test runs on one simulator look like a crash regression. A signed-in simulator fails tests that pass on a clean one. A build that picked another session's simulator verifies the wrong install. A full disk stops every session, not only the one that filled it. Owning resources by UDID and by path, and proving each deletion, keeps one session's results its own.
The aggregated apple-skills plugin reached the same premise on its own: it removed its
simulator-utils skill because "it booted and drove simulators directly, which collides with
other sessions on a shared Mac" (CHANGELOG.md in
https://github.com/Prisma-Labs-Dev/apple-skills, 2026-09-26 entry).
-destination 'platform=iOS Simulator,name=<device>' on a shared Mac. It can pick
another session's simulator. Use id=<UDID>.booted in simctl commands while other sessions have simulators booted.xcodebuild test runs on one simulator, then reading the mass XCTWaiter crashes
as a regression.-derivedDataPath, or into a scratch folder, so the output outlives
the worktree and nobody deletes it.tuist generate without --no-open, or open/xed on the workspace.pkill -f "log stream", simctl shutdown all, or deleting another session's
DerivedData to free space.df checks.xcodebuild -destination, simctl and idb command uses the UDID of a simulator
this session created.xcodebuild call passes -derivedDataPath "$PWD/DerivedData" from the worktree
root, and DerivedData/ is gitignored and excluded from the linters.tuist generate ran with --no-open; no Xcode window was opened.df
shows the space returned.references/disk-hotspots.md — where build and simulator data accumulate on macOS, how to
measure it quickly, and what deleting each one frees.references/official-docs.md — the sources behind the claims above, and which claims no
official page states.simulator-runtime-verification — what to verify on the simulator this skill has you
create, and the traps that fake a result.interactive-simulator-ux-audit — the idb audit loop and fleet sizing by RAM; pass it the
UDID of a simulator you created.host-driven-xcuitest-e2e — scripted UI tests; give each run its own simulator.xcode-cloud-single-track-ci — the CI this skill hands builds and tests to.mise-tool-management — tool setup in a fresh git worktree (mise trust).collaboration-skills:subagent-conflict-detection — worktree setup and conflicts between
parallel agents at the git level.xcode-build-skill:xcode-build (aggregated external) — plain xcodebuild and simctl
syntax. Its examples pick a simulator by name and build into a temporary folder; apply the
ownership rules above when you follow them on a shared Mac.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
xcode, simulator, parallel-builds, disk-cleanup, git-worktree
npx claudepluginhub wei18/apple-dev-skills --plugin apple-dev-skills28 skills in this plugin
/ai-translated-localizationLocalization scope and AI-translation execution for Apple-platform Apps on `Localizable.xcstrings` — default locale set, source / primary language rule, per-locale review gotchas, completeness gates. Use when deciding which locales to ship at project setup; when adding or refreshing user-facing strings (UI keys, Game Center, App Store metadata) in non-source locales; when `extractionState: stale` entries or untranslated placeholder markers appear; or when asked "how many locales", "how do translations enter git". Does NOT cover RTL layout or ASC upload mechanics → asc-api-automation./apple-platform-targetsDefault minimum deployment target for Apple-platform Swift Apps — iOS 26 / macOS 26 on the Xcode 26 toolchain (Swift 6 language mode) — and how to deviate down (iOS 18 / 17) or up. Use when starting a new Apple-platform project, writing the Package.swift `platforms:` list, deciding whether an API newer than the floor is worth bumping for or a client requirement forces dropping below it, or when asked "what should the minimum iOS / macOS version be". Entry point of the bootstrap chain; does NOT own language mode → swift6-concurrency, or module layout → swiftpm-modularization./apple-public-repo-securityUse when a repo goes public or open-sources, when a CloudKit server-to-server PEM, ASC API `.p8`, APNs key, signing `.p12`, or provisioning profile first enters the pipeline, or when asked how to prevent or respond to a secret leak (gitleaks, lefthook, GitHub Secret Scanning, `git filter-repo`, rotate-first). Also for Apple upstream telemetry disclosure (MetricKit, Game Center, sysdiagnose). Repo-hygiene baseline only; ship-in-binary identifiers (AdMob IDs via xcconfig) and CLI keys in `secrets/.env` are build-time-secret-injection; ASC API usage is asc-api-automation./apple-three-piece-analyticsChoose analytics and metrics sources for a solo / small-team Apple app and decide whether a third-party tracking SDK is justified. Use when picking an analytics SDK; when asked "should I add Firebase / Mixpanel / Amplitude / TelemetryDeck"; when asked what App Store Connect Analytics, MetricKit (`MXMetricPayload`) or Game Center can measure without an SDK; when the analytics choice drives `PrivacyInfo.xcprivacy` or forces ATT. Does NOT own MetricKit perf wiring (ios-performance-engineering), App Review privacy-label parity (app-store-review-rejections), or sink code (telemetry-facade-pattern)./app-store-review-rejectionsUse when preparing an App Store submission, reading an App Review rejection or Resolution Center message citing a guideline number (2.1, 2.3.x, 3.1.1, 4.3, 5.1.1, 5.1.2), or a privacy-manifest upload email (ITMS-91061 / ITMS-91056, missing required-reason API), or auditing an ads + Remove-Ads IAP + CloudKit + Game Center app for the rejection classes it realistically hits: the ATT-vs-AdMob trap, privacy-label parity with `PrivacyInfo.xcprivacy`, Restore Purchases, screenshot metadata, export compliance. Maps each class to a pre-submit fix. Not the submission mechanics (asc-api-automation) nor StoreKit implementation (storekit2-iap-defaults)./asc-api-automationUse when automating App Store Connect from a script or CI via the ASC REST API (`api.appstoreconnect.apple.com`) — ASC API `.p8` key / JWT auth, TestFlight `betaGroups` / `betaBuildLocalizations`, `appStoreVersions` / `releaseType`, `reviewSubmissions`, `salesReports`, `analyticsReportRequests` — or asked "automate TestFlight / submission / release notes", "should I use fastlane", or debugging 401 NOT_AUTHORIZED / 429 RATE_LIMIT_EXCEEDED, or asked which ASC steps have no API and must be clicked by hand. API side only: build & upload → xcode-cloud-single-track-ci / local-archive-export-upload; `.p8` storage → build-time-secret-injection.Other plugins' skills for the same job