# Spm Build Analysis

Analyze Swift Package Manager dependencies, package plugins, module variants, and...

- Repository: https://github.com/AvdLee/Xcode-Build-Optimization-Agent-Skill (1268 stars)
- Category: Mobile
- License: MIT
- Last updated: 2026-09-14
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add AvdLee/Xcode-Build-Optimization-Agent-Skill --skill spm-build-analysis -g -a claude-code -y`
Codex: `npx skills add AvdLee/Xcode-Build-Optimization-Agent-Skill --skill spm-build-analysis -g -a codex -y`
Cursor: `npx skills add AvdLee/Xcode-Build-Optimization-Agent-Skill --skill spm-build-analysis -g -a cursor -y`
Gemini CLI: `npx skills add AvdLee/Xcode-Build-Optimization-Agent-Skill --skill spm-build-analysis -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add AvdLee/Xcode-Build-Optimization-Agent-Skill`

## Description

Analyze Swift Package Manager dependencies, package plugins, module variants, and CI-oriented build overhead that slow Xcode builds. Use when a developer suspects packages, plugins, or dependency graph shape are hurting clean or incremental build performance, mentions SPM slowness, package resolution time, build plugin overhead, duplicate module builds from configuration drift, circular dependencies between modules, oversized modules needing splitting, or modularization best practices.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# SPM Build Analysis

Use this skill when package structure, plugins, or dependency configuration are likely contributing to slow Xcode builds.

## Core Rules

- Treat package analysis as evidence gathering first, not a mandate to replace dependencies.
- Separate package-graph issues from project-setting issues.
- Do not rewrite package manifests or dependency sources without explicit approval.

## What To Inspect

- `Package.swift` and `Package.resolved`
- local packages vs remote packages
- package plugin and build-tool usage
- binary target footprint
- dependency layering, repeated imports, and potential cycles
- build logs or timing summaries that show package-related work

## Verification Before Recommending

Before including any local package in a recommendation, verify that it is actually part of the project's dependency graph. A `Vendor/` directory may contain packages that are not linked to any target.

- Check `project.pbxproj` for `XCLocalSwiftPackageReference` entries that reference the package path.
- Check `XCSwiftPackageProductDependency` entries to confirm the package's product is linked to at least one target.
- If a local package exists on disk but is not referenced in the project, do not include it in build-time recommendations.

When recommending version pins for branch-tracked dependencies:

- Use the helper script to scan all branch-pinned dependencies at once:
  ```bash
  python3 scripts/check_spm_pins.py --project App.xcodeproj
  ```
  This checks `git ls-remote --tags` for each branch-pinned package and reports which have tags available for pinning.
- If no tags exist, recommend pinning to a specific commit revision hash for determinism instead.
- Note which packages are branch-pinned because the upstream simply has no tags, versus packages that have tags but are intentionally tracking a branch.

## Focus Areas

The rest: https://github.com/AvdLee/Xcode-Build-Optimization-Agent-Skill/blob/HEAD/skills/spm-build-analysis/SKILL.md
