Audits iOS, iPadOS, and macOS app size, dead-code candidates, unused Assets.car facets, cold-start initializers, linker startup order files, and archive/IPA equivalence by combining xcloom xray, order-profile, verify diff-ipa, and ci size gates with targeted source, Storyboard/XIB, Info.plist, and dynamic-dispatch verification. Use when reducing app install/download size, diagnosing PR size growth, or optimizing cold-launch page-ins.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Xcloom Binary Audit?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/xcloom-xcloom-binary-audit)
---
name: xcloom-binary-audit
description: "Audits iOS, iPadOS, and macOS app size, dead-code candidates, unused Assets.car facets, cold-start initializers, linker startup order files, and archive/IPA equivalence by combining xcloom xray, order-profile, verify diff-ipa, and ci size gates with targeted source, Storyboard/XIB, Info.plist, and dynamic-dispatch verification. Use when reducing app install/download size, diagnosing PR size growth, or optimizing cold-launch page-ins."
---
# Binary Size, Dead Code, and Cold-Start Audit (`xcloom-binary-audit`)
Use `xcloom xray`, `xcloom order-profile`, and `xcloom verify diff-ipa` to measure exact Mach-O sections, `Assets.car` renditions, LinkMap modules, and cold-launch page locality, while the agent inspects source files, Storyboards/XIBs, `Info.plist`, and dynamic dispatch sites before recommending any deletion or refactoring.
Run the audit in three ordered phases: collect machine-verified size, startup, and equivalence evidence first, load the relevant reference to separate genuine savings from static-analysis false positives, and report ranked recommendations backed by verified bytes and source proof.
## Phase 1: Collect Deterministic Binary, Asset, and Startup Evidence
Prefer an exported `.ipa` over an unpacked `.app` or `.xcarchive` whenever available so compressed and thinned sizes come from real ZIP members rather than fixed estimation ratios. Pass `--json` on every tool.
```sh
# 1. Full Mach-O, Assets.car, dead-strip candidate, and cold-start audit
xcloom xray ./Candidate.ipa [--dsym ./App.dSYM] [--linkmap ./LinkMap.txt] [--html ./treemap.html] --json
# Compact summary when triaging totals and top findings first:
xcloom xray ./Candidate.ipa --summary --json
# 2. PR install/compressed/thinned size, module, symbol, and file deltas
xcloom xray ./Candidate.ipa --baseline ./Baseline.ipa \
[--linkmap ./Candidate.LinkMap.txt --baseline-linkmap ./Baseline.LinkMap.txt] --json
# 3. Cold-start LinkMap package leaderboard and startup order-file profiling/verification
xcloom order-profile --linkmap ./LinkMap.txt [--order-file ./startup.order] --out-md ./launch-leaderboard.md --json
xcloom order-profile --emit-probe ./xcloom_order_probe.c --print-flags
xcloom order-profile --binary ./App.app --trace-offsets ./xcloom.trace --out ./startup.order --json
xcloom order-profile --verify --app ./Baseline.app --ordered-app ./Ordered.app \
--order-file ./startup.order [--linkmap ./LinkMap.txt] [--rounds 4] [--udid <UUID>] --out-md ./order-verify.md --json
# 4. Structural and content equivalence check after refactors or packaging changes
xcloom verify diff-ipa ./Baseline.ipa ./Candidate.ipa [--ignore-plist-key CFBundleVersion] --json
xcloom verify diff-archive ./Baseline.xcarchive ./Candidate.xcarchive --json
# 5. Automated PR byte-budget and preflight gate
xcloom ci report ./Candidate.ipa --baseline ./Baseline.ipa --linkmap ./Candidate.LinkMap.txt \
--baseline-linkmap ./Baseline.LinkMap.txt --max-size-delta-bytes 524288 --fail-on-error --json
```
Record exact measurement provenance and limits before drawing conclusions:
- `xcloom xray`: inspect `report.compressed_is_estimate`. Only `.ipa` inputs read actual ZIP compressed sizes (`compressed_is_estimate: false`); `.app`, `.xcarchive`, and bare Mach-O targets estimate compressed sizes with fixed ratios (`0.96` for images, video, and `Assets.car`; `0.43` for other files). Preserve `thinned_compressed_bytes: null` and `thinned_unavailable_reason` rather than inventing an OTA number.
- `report.dead_strip`: `analysis` is always `"static-unreferenced-candidates"`. Static reachability never proves code unused; confidence is at most `medium`, and `estimated_reclaimable_code_bytes` is an upper bound. Check `symbol_attribution.dsym_paths` and `unattributed_bytes` so stripped Release binaries are attributed with matching UUID dSYMs or a LinkMap.
- `xcloom order-profile --verify`: requires an explicit `--ordered-app` (never defaults to `--app`). On an iOS Simulator `.app` without `--udid`, static `LC_SYMTAB` layout and LinkMap checks run while live A/B timing returns `status: "unavailable"`.
- `xcloom verify diff-ipa`: reports `structurally_equivalent`, `content_equivalent`, `mismatches`, and `normalized` rules so every ignored field (`LC_UUID`, `LC_CODE_SIGNATURE`, timestamps) is explicit.
- Record any skipped Phase 1 command (for example, no LinkMap, no `.ipa`, or no booted simulator for live ABBA launch timing) as `UNVERIFIED` in the report.
## Phase 2: Verify Dynamic Escape Hatches and Startup Attribution
Load the reference matching the audit focus, then grep source, Storyboards/XIBs, `Info.plist`, build settings, and package manifests before classifying any item:
| Reference File | Load When Auditing | Topics Covered |
| --- | --- | --- |
| [references/xray-dead-code-and-assets.md](references/xray-dead-code-and-assets.md) | Dead functions, dead Swift types, ObjC selectors, `Assets.car` facets, loose resources, symbol tables, or bundle duplicates | `medium` vs `low` confidence semantics, dynamic dispatch and reflection escape hatches, Swift small-string (`low_confidence_unused_*`) triage, `LC_SYMTAB` stripping, and safe asset wins |
| [references/startup-order-and-diff.md](references/startup-order-and-diff.md) | Cold-launch overhead, static initializers, `+load`, embedded dylibs, LinkMap attribution, `.order` files, or `diff-ipa` checks | `cold_start` audit, LinkMap package leaderboard, SanitizerCoverage vs `/usr/bin/sample` tracing, ABBA `order-profile --verify`, `verify diff-ipa` normalization, and PR byte-budget gates |
Inspect these project surfaces before classifying any `xray` candidate as removable:
- Storyboards and XIBs (`*.storyboard`, `*.xib`: `customClass`, `customModule`, `selector=`, image names).
- `Info.plist` and extension manifests (`NSPrincipalClass`, `NSExtensionPrincipalClass`, `UISceneDelegateClassName`, `BGTaskSchedulerPermittedIdentifiers`).
- Dynamic lookup and reflection sites (`NSClassFromString`, `NSSelectorFromString`, `performSelector`, `dlsym`, `Mirror`, `Codable`, `#Preview`, string-interpolated asset names).
- Build settings (`DEAD_CODE_STRIPPING`, `STRIP_STYLE`, `STRIP_INSTALLED_PRODUCT`, `DEPLOYMENT_POSTPROCESSING`, `SWIFT_REFLECTION_METADATA_LEVEL`, `MERGED_BINARY_TYPE`, `LD_GENERATE_MAP_FILE`).
## Phase 3: Calibrated Size and Startup Optimization Report
Apply these anti-false-positive rules before recommending any deletion or build-setting change:
1. Never recommend deleting functions or Swift types solely from `xray` static candidates. Confirm zero references across source, Storyboards/XIBs, `Info.plist`, `NSClassFromString`, `NSSelectorFromString`, `dlsym`, and reflection; otherwise classify as `NEEDS DYNAMIC VERIFICATION` and prefer linker `-dead_strip` (`DEAD_CODE_STRIPPING=YES`) plus runtime coverage.
2. Never treat `low_confidence_unused_car_facets` or `low_confidence_unused_resources` (names of at most 15 UTF-8 bytes in Swift binaries) as confirmed unused without source verification, and check for runtime string construction (`"icon_\(name)"`, server JSON keys) on every `medium` unused asset too.
3. Check build-setting side effects before recommending them: keep `STRIP_STYLE=non-global` on targets loaded by test bundles via `BUNDLE_LOADER`; verify `Mirror` is unused before setting `SWIFT_REFLECTION_METADATA_LEVEL=none`; verify SanitizerCoverage flags are removed from Release builds so `xcloom preflight` does not fail with `XCLOOM-252-COV`.
4. Rank opportunities by verified reclaimable bytes (install vs compressed vs thinned), citing exact `xray` JSON fields, `Assets.car` facet paths, LinkMap modules, or `file:line`.
5. Classify every candidate into one of three dispositions:
- `SAFE TO REMOVE`: verified unused or redundant with direct source/bundle proof (duplicate files, duplicate `Assets.car` renditions, uncompressed bitmaps, unused local symbols, verified dead resources/code with zero dynamic entry points).
- `NEEDS DYNAMIC VERIFICATION`: static candidate or low-confidence item where reflection, remote config, KVC/KVO, or indirect calls could still reach it at runtime; specify the exact test, coverage run, or linker setting to prove it.
- `DO NOT REMOVE / FALSE POSITIVE`: confirmed live via dynamic dispatch, Storyboard/XIB, `Info.plist`, `Codable`, `#Preview`, or dynamic asset naming.
### Report Structure
Output the audit in four compact sections:
1. **Evidence and Size Summary**: artifact kind (`.ipa` vs estimate), install / compressed / thinned totals (and PR deltas if `--baseline` was provided), `cold_start` counts, `symbol_attribution.source`, and any `UNVERIFIED` gaps.
2. **SAFE TO REMOVE (Ranked by Reclaimable Bytes)**: `Item / Path / Symbol | Verified Bytes | Evidence (xray field + source proof) | Action`.
3. **NEEDS DYNAMIC VERIFICATION and Startup Optimizations**: `Item / Package / Metric | Upper-Bound Bytes or Pages | Dynamic Risk or Startup Mechanism | Verification Step`.
4. **DO NOT REMOVE / FALSE POSITIVE and Post-Change Checks**: dismissed candidates with exact call-site/manifest proof, plus post-refactor verification (`xcloom verify diff-ipa`, `xcloom preflight --method app-store`, `xcloom order-profile --verify`).
```text
## Binary Audit Summary — <App Name> (<Version #Build>, <Artifact Kind>)
- Install: <bytes> | Compressed: <bytes> (estimate=<true|false>) | Est. Thinned OTA: <bytes|unavailable>
- Baseline Delta: <install delta> / <compressed delta> / <thinned delta> (or UNVERIFIED)
- Cold-Start: <N> static initializers, <N> ObjC +load classes, <N> embedded dylibs
- Attribution: <xcode-linkmap|function-starts+dsym|function-starts> (unattributed: <bytes>)
- Order Verify / diff-ipa: <verified|no_improvement|unavailable|UNVERIFIED>
### Ranked Recommendations (SAFE TO REMOVE | NEEDS DYNAMIC VERIFICATION | DO NOT REMOVE)
| Disposition | Item / Symbol / Asset | Bytes or Pages | Evidence & Escape-Hatch Check | Action / Verification |
| --- | --- | --- | --- | --- |
| `SAFE TO REMOVE` | `<path or symbol>` | `<verified bytes>` | `<xray field + source/manifest proof>` | `<exact removal or setting>` |
```