$npx -y skills add AvdLee/Xcode-Build-Optimization-Agent-Skill --skill xcode-project-analyzerAudit Xcode project configuration, build settings, scheme behavior, and script phases to find build-time improvements with explicit approval gates. Use when a developer wants project-level build analysis, slow incremental builds, guidance on target dependencies, build settings re
| 1 | # Xcode Project Analyzer |
| 2 | |
| 3 | Use this skill for project- and target-level build inefficiencies that are unlikely to be solved by source edits alone. |
| 4 | |
| 5 | ## Core Rules |
| 6 | |
| 7 | - Recommendation-first by default. |
| 8 | - Require explicit approval before changing project files, schemes, or build settings. |
| 9 | - Prefer measured findings tied to timing summaries, build logs, or project configuration evidence. |
| 10 | - Distinguish debug-only pain from release-only pain. |
| 11 | |
| 12 | ## What To Review |
| 13 | |
| 14 | - scheme build order and target dependencies |
| 15 | - debug vs release build settings against the [build settings best practices](references/build-settings-best-practices.md) |
| 16 | - run script phases and dependency-analysis settings |
| 17 | - derived-data churn or obviously invalidating custom steps |
| 18 | - opportunities for parallelization |
| 19 | - explicit module dependency settings and module-map readiness |
| 20 | - "Planning Swift module" time in the Build Timing Summary -- if it dominates incremental builds, suspect unexpected input modification or macro-related invalidation |
| 21 | - asset catalog compilation time, especially in targets with large or numerous catalogs |
| 22 | - `ExtractAppIntentsMetadata` time in the Build Timing Summary -- if this phase consumes significant time, record it as `xcode-behavior` (report the cost and impact, but do not suggest a repo-local optimization unless there is explicit Apple guidance) |
| 23 | - zero-change build overhead -- if a no-op rebuild exceeds a few seconds, investigate fixed-cost phases (script execution, codesign, validation, CopySwiftLibs) |
| 24 | - CocoaPods usage -- if a `Podfile` or `Pods.xcodeproj` exists, CocoaPods is deprecated; recommend migrating to SPM and do not attempt CocoaPods-specific optimizations (see [project-audit-checks.md](references/project-audit-checks.md)) |
| 25 | - Task Backtraces (Xcode 16.4+: Scheme Editor > Build > Build Debugging) to diagnose why tasks re-run unexpectedly in incremental builds |
| 26 | |
| 27 | ## Build Settings Best Practices Audit |
| 28 | |
| 29 | Every project audit should include a build settings checklist comparing the project's Debug and Release configurations against the recommended values in [build-settings-best-practices.md](references/build-settings-best-practices.md). Present results using checkmark/cross indicators (`[x]`/`[ ]`). The scope is strictly build performance -- do not flag language-migration settings like `SWIFT_STRICT_CONCURRENCY` or `SWIFT_UPCOMING_FEATURE_*`. |
| 30 | |
| 31 | ## Apple-Derived Checks |
| 32 | |
| 33 | Review these items in every audit: |
| 34 | |
| 35 | - target dependencies are accurate and not missing or inflated |
| 36 | - schemes build in `Dependency Order` |
| 37 | - run scripts declare inputs and outputs |
| 38 | - `.xcfilelist` files are used when scripts have many inputs or outputs |
| 39 | - `DEFINES_MODULE` is enabled where custom frameworks or libraries should expose module maps |
| 40 | - headers are self-contained enough for module-map use |
| 41 | - explicit module dependency settings are consistent for targets that should share modules |
| 42 | |
| 43 | ## Typical Wins |
| 44 | |
| 45 | - skip debug-time scripts that only matter in release |
| 46 | - add missing script guards or dependency-analysis metadata |
| 47 | - remove accidental serial bottlenecks in schemes |
| 48 | - align build settings that cause unnecessary module variants |
| 49 | - fix stale project structure that forces broader rebuilds than necessary |
| 50 | - identify linters or formatters that touch file timestamps without changing content, silently invalidating build inputs and forcing module replanning |
| 51 | - split large asset catalogs into separate resource bundles across targets to parallelize compilation |
| 52 | - use Task Backtraces to pinpoint the exact input change that triggers unnecessary incremental work |
| 53 | |
| 54 | ## Reporting Format |
| 55 | |
| 56 | For each issue, include: |
| 57 | |
| 58 | - evidence |
| 59 | - likely scope |
| 60 | - why it affects clean builds, incremental builds, or both |
| 61 | - estimated impact |
| 62 | - approval requirement |
| 63 | |
| 64 | If the evidence points to package graph or build plugins, hand off to [`spm-build-analysis`](../spm-build-analysis/SKILL.md) by reading its SKILL.md and applying its workflow to the same project context. |
| 65 | |
| 66 | ## Additional Resources |
| 67 | |
| 68 | - For the detailed audit checklist, see [references/project-audit-checks.md](references/project-audit-checks.md) |
| 69 | - For build settings best practices, see [references/build-settings-best-practices.md](references/build-settings-best-practices.md) |
| 70 | - For the shared recommendation structure, see [references/recommendation-format.md](references/recommendation-format.md) |
| 71 | - For Apple-aligned source summaries, see [references/build-optimization-sources.md](references/build-optimization-sources.md) |