Apply approved Xcode build optimization changes following best practices, then re-benchmark to verify improvement. Use when a developer has an approved optimization plan from xcode-build-orchestrator, wants to apply specific build fixes, needs help implementing build setting changes, script phase guards, source-level compilation fixes, or SPM restructuring that was recommended by an analysis skill.
94
92%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Use this skill to implement approved build optimization changes and verify them with a benchmark.
The fixer expects one of:
.build-benchmark/optimization-plan.md with checked approval boxes.DEBUG_INFORMATION_FORMAT to dwarf for Debug").When working from an optimization plan, read the approval checklist and implement only the checked items.
Change project.pbxproj values to match the recommendations in build-settings-best-practices.md.
Typical fixes:
DEBUG_INFORMATION_FORMAT = dwarf for DebugSWIFT_COMPILATION_MODE = singlefile for DebugCOMPILATION_CACHE_ENABLE_CACHING = YESEAGER_LINKING = YES for DebugWhen editing project.pbxproj, locate the correct buildSettings block by matching the target name and configuration name. Verify the change with xcodebuild -showBuildSettings after applying.
Fix run script phases that waste time during incremental or debug builds.
Typical fixes:
[[ "$CONFIGURATION" != "Release" ]] && exit 0 for release-only scripts..xcfilelist files when the list is long.Based on dependency analysis when inputs and outputs are declared.Apply code changes that reduce type-checker and compiler overhead. See references/fix-patterns.md for before/after patterns.
Typical fixes:
final when they are not subclassed.private/fileprivate) for internal-only symbols.body properties into smaller composed subviews.Restructure Swift packages to improve build parallelism and reduce rebuild scope.
Typical fixes:
@_exported import usage.Before applying version pin changes:
git ls-remote --tags <url> to confirm tags exist. If the upstream has no tags, pin to a specific revision hash instead.xcodebuild -resolvePackageDependencies before proceeding.xcodebuild build to confirm no errors were introduced.python3 scripts/benchmark_builds.py \
--project App.xcodeproj \
--scheme MyApp \
--configuration Debug \
--destination "platform=iOS Simulator,name=iPhone 16" \
--output-dir .build-benchmarkNot every slower number is a true regression. The fixer must evaluate the full picture before recommending a revert.
A change like COMPILATION_CACHE_ENABLE_CACHING = YES may make a standard clean build slightly slower (cache population overhead) while making cached clean builds significantly faster. Since cached clean builds reflect the realistic developer workflow (branch switching, pulling changes, Clean Build Folder with a warm cache), a slower standard clean build paired with a faster cached clean build is a net improvement, not a regression. The same logic applies to any change where the first-time cost is higher but subsequent builds benefit.
Evaluate standard clean, cached clean (when available), and incremental builds together. A change is only a clear regression if it makes the metrics that matter to the developer's daily workflow worse. If only the cold-start clean build is slower but the developer rarely does truly cold builds, that may be acceptable.
A single change that regresses on its own may still be worth keeping if it enables a larger cumulative improvement (e.g., enabling compilation caching makes one build type slower but unlocks cache benefits for everything else).
Some build settings are Apple's recommended modern defaults. These should be applied and kept regardless of whether the immediate benchmark shows a measurable improvement. They are not speculative optimizations -- they align the project with Apple's toolchain direction and will compound in value over future Xcode releases. The fixer must never recommend reverting these settings based on a single benchmark result.
Best-practice settings that should always be kept once applied:
COMPILATION_CACHE_ENABLE_CACHING = YES -- Apple is actively investing in this; the cache improves with each Xcode release and compounds across real workflowsEAGER_LINKING = YES (Debug) -- allows the linker to overlap with compilationSWIFT_USE_INTEGRATED_DRIVER = YES -- eliminates inter-process scheduling overheadDEBUG_INFORMATION_FORMAT = dwarf (Debug) -- avoids unnecessary dSYM generationSWIFT_COMPILATION_MODE = singlefile (Debug) -- incremental recompilationONLY_ACTIVE_ARCH = YES (Debug) -- no reason to build all architectures locallyWhen reporting on these settings, use language like: "Applied recommended build setting. No immediate benchmark improvement measured, but this aligns with Apple's recommended configuration and positions the project for future Xcode improvements."
For changes that are not best-practice settings (e.g., source refactors, linkage experiments, script phase modifications, dependency restructuring):
Recommend revert and the measured delta.Lead with the wall-clock result in plain language:
"Your clean build now takes X.Xs (was Y.Ys) -- Z.Zs faster." "Your incremental build now takes X.Xs (was Y.Ys) -- Z.Zs faster."
Then include:
If cumulative task metrics improved but wall-clock did not, say plainly: "Compiler workload decreased but build wait time did not improve. This is expected when Xcode runs these tasks in parallel with other equally long work."
If a fix produced no measurable wall-time improvement, note No measurable wall-time improvement and suggest whether to keep (e.g. for code quality) or revert.
For changes valuable for non-benchmark reasons (deterministic package resolution, branch-switch caching), label them: "No wait-time improvement expected from this change. The benefit is [deterministic builds / faster branch switching / reduced CI cost]."
Note: COMPILATION_CACHE_ENABLE_CACHING has been measured at 5-14% faster clean builds across tested projects (87 to 1,991 Swift files). The benefit compounds in real developer workflows where the cache persists between builds -- branch switching, pulling changes, and CI with persistent DerivedData. The benchmark script auto-detects this setting and runs a cached clean phase for validation.
After the optimization pass is complete, produce a structured execution report. This gives the developer a clear summary of what was attempted, what worked, and what the final state is.
Structure:
## Execution Report
### Baseline
- Clean build median: X.Xs
- Cached clean build median: X.Xs (if applicable)
- Incremental build median: X.Xs
### Changes Applied
| # | Change | Actionability | Measured Result | Status |
|---|--------|---------------|-----------------|--------|
| 1 | Description | repo-local | Clean: X.Xs→Y.Ys, Incr: X.Xs→Y.Ys | Kept / Reverted / Blocked |
| 2 | ... | ... | ... | ... |
### Final Cumulative Result
- Clean build median: X.Xs (was Y.Ys) -- Z.Zs faster/slower
- Cached clean build median: X.Xs (was Y.Ys) -- Z.Zs faster/slower
- Incremental build median: X.Xs (was Y.Ys) -- Z.Zs faster/slower
- **Net result:** Faster / Slower / Unchanged
### Blocked or Non-Actionable Findings
- Finding: reason it could not be addressed from the repoStatus values:
Kept -- Change improved or maintained build times and was kept.Kept (best practice) -- Change is a recommended build setting; kept regardless of immediate benchmark result.Reverted -- Change regressed build times and was reverted.Blocked -- Change could not be applied due to project structure, Xcode behavior, or external constraints.No improvement -- Change compiled but showed no measurable wall-time benefit. Include whether it was kept (for non-performance reasons) or reverted.If during implementation you discover issues outside this skill's scope:
xcode-project-analyzerxcode-compilation-analyzerspm-build-analysisb599058
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.