Skip to content
SwiftSkills

iOS build time with AI agents: time the compile, then change one boundary

Do not guess at Swift compile cost. Time a clean build and a one-file edit build, then change one project or module boundary at a time. Prefer an Xcode build-optimization skill for diagnosis and a build tool skill that keeps raw logs out of the agent context. Confirm incremental-build guidance on developer.apple.com before rewriting the graph.

Last updated:

This page is about getting a coding agent to measure Xcode compile time, find the slow Swift/SPM boundary, and change one thing at a time. Runtime jank and Instruments belong in iOS and SwiftUI performance with AI agents. Simulator drive loops belong in the Xcode MCP / MobileBuildMCP guides.

What the agent has to get right

Apple's Improving the speed of incremental builds and Build system documentation treat compile cost as a measured systems problem: dependency edges, module boundaries and what must rebuild after a one-line edit. Agents still "optimize" by rewriting the app or enabling every parallel flag without a before/after number.

Four layers show up in almost every slow-build PR:

  1. Measurement — a clean build time and an incremental time after a tiny, real edit in the module you care about.

  2. Project / module shape — targets, packages and build configuration files that force wide rebuilds (Creating a standalone Swift package with Xcode, Distributing binary frameworks as Swift packages).

  3. Agent-safe builds — unsigned compile checks and simulator tests without flipping signing flags the human did not approve.

  4. Context hygiene — keep multi-megabyte xcodebuild logs out of the main chat; summarize failures instead of pasting the whole transcript.

Rules worth adding to AGENTS.md or CLAUDE.md:

Build time: never claim a compile win without a timed clean build and a timed one-file incremental build. Change one module or project setting per iteration. Prefer unsigned simulator compile checks. Confirm Improving the speed of incremental builds and the Xcode build system docs on developer.apple.com before inventing build flags.

Step 1: install a build-time-aware tool

Ask the agent to:

  1. Install Xcode Build Optimization (npx skills add https://github.com/avdlee/xcode-build-optimization-agent-skill) so it can benchmark, analyze compilation and SPM cost, then propose fixes with numbers.

  2. Install Apple Platform Build Tools when Claude Code should build, test or archive while keeping raw build logs out of the main context.

  3. add iOS Build-Time Optimisation Skills for Xcode/Tuist/Bazel diagnose loops, or Xcode Build Skill for agent-safe xcodebuild that refuses signing-asset flags.

Honest limit: one measurement skill plus one build-runner skill beats installing every Xcode pack at once.

Step 2: lock the timing contract

Point the agent at Improving the speed of incremental builds. Require:

  1. Two numbers — clean build seconds and incremental seconds after a one-line edit in a named file.

  2. One change — a single module split, package boundary, build setting or dependency pin per iteration.

  3. Same machine / same scheme — customize schemes so before/after use the same configuration.

  4. No signing surprises — do not pass -allowProvisioningUpdates or rewrite certificates from the agent session.

Step 3: shrink what the edit rebuilds

For project shape:

  1. Prefer smaller modules and explicit package products over a single mega-target.

  2. Treat SPM fetch and binary wrappers as first-class cost (Distributing binary frameworks as Swift packages).

  3. Keep xcconfig and scheme changes reviewable; do not flip Whole Module Optimization as a cargo-cult fix without a measurement.

Step 4: re-time before merge

Re-run the same clean and incremental scenarios after the change. Treat missing timings, whole-app rewrites "for speed" and unsigned claims of percent wins as merge blockers. A green build is not a faster build.

Tools compared (4)

ToolBest forAgents (README)Install (README)LicenseStarsLast push
Xcode Build Optimization (AvdLee)Six skills that time clean vs incremental compiles, analyze Swift compile and SPM fetch cost, then propose measured fixesClaude Code, Codexnpx skills add https://github.com/avdlee/xcode-build-optimization-agent-skillMIT126814 Sep 2026
Apple Platform Build Tools (kylehughes)Claude Code plugin/subagent that builds, tests and archives Swift packages and Xcode projects while keeping build logs out of the main contextClaude Code/plugin marketplace add kylehughes/apple-platform-build-tools-claude-code-plugin then /plugin install apple-platform-build-tools@apple-platform-build-tools-claude-code-pluginMIT608 Mar 2026
iOS Build-Time Optimisation Skills (kmuralidharan91)Benchmark/diagnose/simulate/fix loops for Xcode, Tuist and Bazel; recommend-first and citation-required so the skill refuses unmeasured winsClaude Code, Cursor, Codex/plugin marketplace add kmuralidharan91/iOS-app-build-time-optimisation-skill then /plugin install ios-build-skills@ios-build-skillsMIT017 May 2026
Xcode Build Skill (brennanMKE)Agent-safe xcodebuild: prefers unsigned compile checks and simulator tests; refuses -allowProvisioningUpdates and signing-asset changesClaude Code, Codex, Cursornpx skills add brennanMKE/XcodeBuildSkill --skill xcode-buildMIT025 Jul 2026

⚠ = no push for more than 4 weeks. Xcode Build Optimization (14 Sep) is within a few weeks of this page; Apple Platform Build Tools (8 Mar), iOS Build-Time Optimisation Skills (17 May) and Xcode Build Skill (25 Jul) are older—verify guidance against current Xcode build-system docs before treating every recommendation as final.

Which one to pick:

  • Default diagnose loop: Xcode Build Optimization.

  • Claude Code builds without drowning in logs: Apple Platform Build Tools.

  • Tuist/Bazel or citation-required diagnose: iOS Build-Time Optimisation Skills.

  • signing-safe xcodebuild from the agent: Xcode Build Skill.

A prompt that keeps the agent honest

Setting up the agent itself: Claude Code for iOS development, Codex for iOS development or Cursor rules for SwiftUI.

Our Debug compile for scheme App is slow. Time a clean build and a one-file incremental build in Module X. Use Xcode Build Optimization (or the build-time skill after merge). Propose one module or project change. Do not rewrite the app. Do not pass signing-update flags. Re-time the same scenarios and report before/after seconds. Confirm Improving the speed of incremental builds on developer.apple.com.

FAQ

What is iOS build-time work for AI coding agents?
iOS build-time work for agents means teaching Claude Code, Cursor or Codex to time clean and incremental Xcode compiles, find expensive Swift or SPM boundaries, and change one project setting or module edge at a time instead of guessing at flags or rewriting the app for speed.
How should the agent measure compile time?
Follow Apple's incremental-build guidance: record a clean build, make a tiny real edit in the module under study, record the incremental build on the same Mac and scheme, then compare. Skills such as Xcode Build Optimization automate that benchmark pattern; agents should still keep the two numbers in the PR.
Is a faster runtime the same as a faster compile?
No. Runtime hangs, hitches and launch time belong to Instruments and the iOS/SwiftUI performance guide. This page is about how long `xcodebuild` takes before you can run the app. Fixing a hitch does not shrink compile graphs.
Which build-time tool should I install first?
Start with Xcode Build Optimization when you need measured diagnosis. Add Apple Platform Build Tools when Claude Code should run builds without dumping full logs into chat. iOS Build-Time Optimisation Skills covers Tuist/Bazel loops, and Xcode Build Skill keeps signing flags off-limits.
Does a green build mean compile time is fixed?
No. A succeeding build can still be slow. Require before/after clean and incremental timings for the same scheme. Treat unmeasured percent claims and whole-app rewrites as merge blockers.