---
name: multi-agent-build-optimize
language: en
description: "Wrapper that dispatches to xcode-build-orchestrator on iOS repos. Benchmarks the current Xcode build, runs compilation / project / SPM analyzers, produces a recommend-first optimization plan in .build-benchmark/, and re-benchmarks after the developer approves changes. Fails fast on non-iOS stacks. Use when an iOS build is slow and needs measuring before anything is changed."
user-invocable: true
argument-hint: "(none - operates on current repo)"
---

# multi-agent-build-optimize - Xcode Build Performance Wrapper

**Input**: $ARGUMENTS (none - operates on the current repo)

Thin wrapper around the vendored `xcode-build-orchestrator` skill so iOS users do not have to remember the underlying skill name. Recommend-first: no project files are modified without explicit developer approval. Output lands in `.build-benchmark/` in the cwd.

> **Language**: Per `refs/rules.md` Language Application matrix - instruction prose stays English.

## When to use

- Slow clean or incremental Xcode builds
- Build settings audit before a release branch cut
- SPM resolution time concerns, plugin overhead suspicions
- Pre-CI optimization pass when build wall-clock dominates PR cycle time

## Flow

| Phase | Action |
|-------|--------|
| 0. Stack detect | Find `.xcodeproj` / `.xcworkspace` / `Package.swift`. On non-iOS stacks, exit with explanatory error pointing to platform-appropriate perf skill. |
| 1. Project context | Identify project + scheme + configuration + destination. Single AskUserQuestion when multiple schemes exist. |
| 2. Dispatch analyze | Skill tool: `xcode-build-orchestrator`. Orchestrator runs benchmark + 3 specialists, writes `.build-benchmark/optimization-plan.md`. No project file edits. |
| 3. Review handoff | Surface the plan path to the user for explicit approval via checkboxes in the plan. |
| 4. Dispatch fix | When the user signals approval, Skill tool: `xcode-build-fixer`. Applies approved items, re-benchmarks, appends wall-clock delta. |

## Side-effect contract

- Phase 1 writes only inside `.build-benchmark/`. No project file edits, no branches, no worktrees, no commits, no PRs.
- Phase 2 edits build settings / source / packages / scripts the developer approved. Re-benchmarks to verify.

## Detailed implementation

Full steps: `$HOME/.claude/commands/multi-agent/build-optimize/SKILL.md`.
Upstream attribution: ai-ios-toolkit plugin NOTICE (xcode build skills).

## Notes

- Wall-clock build time is the primary metric; parallel CPU savings are labeled separately.
- Python 3 standard library is the only runtime dependency (vendored upstream uses no pip packages).
- Default `outputLanguage` follows the pipeline user preference for any wrapper-authored prompts. Upstream skill output (the plan body) is English by upstream convention.
