/xcode-disk-cleanup:xcode-disk-cleanupfrom xcode-disk-cleanup
Audits and safely cleans Xcode-related developer storage on macOS, including DerivedData, simulators, archives, and caches. Useful when low disk space or build failures occur.
Ships in xcode-disk-cleanup. 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; scripts run unread.
rm -rf, sudo, SIP changes, or manual deletion
inside system-managed CoreSimulator and MobileAsset directories.Package.resolved, signing assets, credentials, custom DocSets, the
active Xcode, a running simulator, or an Xcode that uniquely provides a required
SDK/toolchain.Read references/safety-model.md before applying cleanup.
xcodebuild, Swift build, test, archive, and
package-resolution processes.ps. For
regenerable documentation caches, moving an old cache while Xcode is open may
temporarily remove local documentation until it reloads, but does not require
quitting Xcode or Simulator. State that cost instead..build and .derived-data
scanning. Do not crawl the whole home directory.python3 "${SKILL_DIR}/scripts/xcode_disk_cleanup.py" audit \
--output-dir .xcode-disk-cleanup-audit \
[--scan-root /path/to/projects]
Read both generated files:
.xcode-disk-cleanup-audit/report.md.xcode-disk-cleanup-audit/audit.jsonThe script audits DerivedData, documentation caches, CocoaPods caches, simulator devices and runtimes (including stale superseded beta runtimes), orphan runtime volumes, simulator dyld caches, Xcode-managed components, Xcode installers, installed Xcodes, archives (including never-distributed orphans), DeviceSupport for every platform, diagnostic logs, XCTest device clones, legacy DocSets, and explicitly requested project roots.
Shared compiler caches (ModuleCache.noindex, precompiled SDK modules) and the
global SwiftPM download cache are deliberately out of scope: they are always in
use on an active development machine, and clearing them trades real build-time
pain for little lasting space. Do not propose them.
Use the category router:
| Finding | Reference |
|---|---|
DerivedData, module caches, project .build, CocoaPods | references/generated-data.md |
| Simulator devices, runtimes, dyld caches, XCTest clones | references/simulators.md |
| Archives, dSYMs, DeviceSupport, logs, DocSets | references/release-artifacts.md |
| Xcode DMGs/XIPs and installed Xcodes | references/xcode-installations.md |
| Confirmation and deletion behavior | references/safety-model.md |
Do not mechanically accept a scanner classification. Verify uncertain ownership, custom paths, backups, and toolchain requirements.
Sort by recoverable GiB and show:
Keep the proposal scannable:
file:// links so the user can inspect
them before approving. Show the candidate ID only where the user needs it to
approve, not as the item's display name.evidence and reason fields into your notes. The script
already explains why each item is stale ("Unchanged for 4 days", "Superseded
by 16.4.1 (325) archived 2026-07-21", "the same documentation stays available");
dropping that context turns an explainable proposal into a bare file list.report.md for reference. Do not pad the proposal with a "small items" bucket —
it adds questions, not signal.Orphan archive candidates already encode proof (no Organizer
distribution record plus a newer archive of the same app); do not demote them
back to preserve just because archives are preserve-by-default elsewhere.Format each category like this example, adapting labels to the machine:
### Orphaned DerivedData — 15.5 GiB · regenerable
All four belong to workspaces that no longer exist.
| Folder | Size | Why stale |
|---|---:|---|
| [RocketSim-beqqrx…](file:///Users/me/Library/Developer/Xcode/DerivedData/RocketSim-beqqrximmvoaakbpvjshhqhuacyv) | 5.6 GiB | Workspace deleted; unchanged for 1 day |
| [RocketSim-fjapct…](file:///Users/me/Library/Developer/Xcode/DerivedData/RocketSim-fjapctdhvtzcaaabmtsyumkmcarf) | 4.0 GiB | Only package downloads, no build products; unchanged for 4 days |
Include:
After a completed audit, a request such as “delete all stale DerivedData” or “clean up all outdated documentation caches” may approve every currently audited candidate in that category only when all of the following hold:
Never infer category membership from a broad request before the audit, and never include preserve items, archives/dSYMs, active assets, or simulator operations unless their separate safeguards and approvals are met.
Invoke apply only after direct per-ID approval or a plain-language approval of a frozen expanded ID set from the current audit:
python3 "${SKILL_DIR}/scripts/xcode_disk_cleanup.py" apply \
--audit-file .xcode-disk-cleanup-audit/audit.json \
--ids "<approved-id-1>" "<approved-id-2>" \
--confirm I_APPROVED_THE_SELECTED_ITEMS \
--output .xcode-disk-cleanup-audit/cleanup-result.json
Simulator device and runtime deletions are irreversible and require a second approval plus:
--confirm-irreversible I_APPROVED_IRREVERSIBLE_SIMULATOR_DELETION
A stale runtime is only proposed when simctl reports it deletable, no installed
Xcode SDK resolves to its build, and a newer runtime supersedes it on the same
platform. This is the pattern behind leftover beta platforms in Xcode Settings →
Components after installing a newer Xcode beta.
Do not pass either confirmation phrase unless the corresponding user approval is present in the conversation.
“Separate approval” means distinct, explicit intent for the irreversible Simulator category, not necessarily a separate message. After exact Simulator IDs and permanent data loss have been shown, a single request such as “remove the DerivedData and unavailable simulators” contains both ordinary approval and separate category-specific irreversible approval. Revalidate and execute both in that turn. A generic “clean everything” does not provide irreversible approval.
df free space before and after..xip, .dmg, and .zip installers through Spotlight and common
download folders.kMDItemLastUsedDate reflects LaunchServices opens, not command-line
use. Combine it with xcode-select, DEVELOPER_DIR, running processes,
.xcode-version, CI scripts, and unique SDK/toolchain evidence.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub avdlee/xcode-disk-cleanup-agent-skill --plugin xcode-disk-cleanupOther plugins' skills for the same job