PluginBench
Skill
Official
Review
Audit score 70

xcode-project-setup

firebase/agent-skills

Safely add Swift Packages and link files to Xcode projects without manual .pbxproj editing.

What is xcode-project-setup?

Modifies Xcode projects (.pbxproj) to install Swift Package dependencies and link configuration files. Use this when an iOS project needs to add frameworks like Firebase or Alamofire. Requires Swift toolchain and macOS environment.

  • Adds Swift Package repository dependencies to Xcode projects
  • Automatically links product modules to target frameworks
  • Injects required linker flags (e.g., -ObjC) for frameworks like Firebase
  • Links optional configuration files (e.g., GoogleService-Info.plist) to resources
  • Idempotent operations—safely skips already-linked packages and files
  • Uses native Swift scripting instead of Ruby or manual .pbxproj parsing

How to install xcode-project-setup

npx skills add https://github.com/firebase/agent-skills --skill xcode-project-setup
Prerequisites
  • Swift toolchain installed locally (verify with `swift --version`)
  • macOS environment
  • An existing Xcode project (.xcodeproj) created manually
  • Absolute path to the skill's scripts/xcode_spm_setup directory
Claude Code
Cursor
Windsurf
Cline

How to use xcode-project-setup

  1. 1.Verify Swift is installed by running `swift --version`
  2. 2.Locate the absolute path to the skill's scripts/xcode_spm_setup directory
  3. 3.For generic packages, run: `swift run --package-path <SKILL_PATH>/scripts/xcode_spm_setup xcode_spm_setup <ProjectPath.xcodeproj> <RepoURL> <Version> <Product1> [Product2...]`
  4. 4.For Firebase or packages requiring config files, add `--plist <path/to/config.plist>` before product names
  5. 5.Execute the command and verify the packages appear in Xcode's Package Dependencies and target Frameworks

Use cases

Good for
  • Installing Firebase SDK and linking GoogleService-Info.plist to an iOS app
  • Adding third-party Swift packages like Alamofire to an existing Xcode project
  • Configuring multiple Firebase products (Auth, Firestore, etc.) in one operation
  • Setting up dependencies for a new iOS feature without manual Xcode UI steps
  • Ensuring correct linker flags are applied to prevent runtime crashes from stripped Objective-C categories
Who it's for
  • iOS developers automating project setup
  • AI coding agents (Claude Code, Cursor) managing Xcode projects
  • Teams standardizing dependency installation across multiple apps
  • Developers integrating Firebase or other complex SPM packages

xcode-project-setup FAQ

Do I need to manually edit the .pbxproj file?

No. The skill's Swift script handles all .pbxproj modifications safely. Never manually edit .pbxproj files with this skill.

Why do I get runtime crashes when adding Firebase?

Firebase relies on Objective-C categories that the linker strips if not linked correctly. The script automatically injects the -ObjC linker flag to prevent this. Verify it is present in build settings if crashes persist.

What if my Xcode project doesn't exist yet?

Create an empty Xcode project manually first via Xcode, then use this skill to add dependencies. The skill requires an existing .xcodeproj file.

Is the script idempotent (safe to run multiple times)?

Yes. The script automatically skips packages and files already linked to the project, making it safe to re-run.

Can I use this on non-macOS or without Swift installed?

No. This skill requires macOS and a local Swift toolchain. If Swift is not found, install it via `xcode-select --install` or ask for help before proceeding.

Full instructions (SKILL.md)

Source of truth, from firebase/agent-skills.


name: xcode-project-setup description: Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire). compatibility: Requires Swift to be installed locally and macOS environment.

Xcode Project Setup

⛔️ CRITICAL RULES & ENVIRONMENT CHECKS

Before performing any Xcode setup or file manipulation, you MUST adhere to the following rules. A hefty fee will be applied if you violate them.

1. The Anti-Ruby Mandate

You are strictly forbidden from using Ruby, Rails, or any Ruby gems (including the xcodeproj gem). Under no circumstances may you write or execute Ruby scripts.

2. Modern Xcode Folder Synchronization

Modern Xcode projects support folder synchronization. When adding new source code (.swift) or resource files, simply write them to the correct directory on disk. They will be automatically included in the Xcode project. Never manually modify the .pbxproj file to add files.

3. Allowed Scripting Languages

If you absolutely must write a script to manipulate the project environment (e.g., configuring SPM packages beyond what the provided xcode_spm_setup script does), you must use Swift. Only as an absolute last resort, if Swift is completely unviable, may you use Node.js or TypeScript.

4. Toolchain Verification

Because this skill relies entirely on a native Swift script, you must verify the environment:

  • Run swift --version before proceeding.
  • If the Swift command is not found, you must stop and recommend the user install the Swift toolchain (e.g., via xcode-select --install on macOS), or ask if you can attempt to install it for them. Do not attempt to proceed without Swift.

5. Mandatory Linker Flags for Static Frameworks (Firebase)

When setting up SPM dependencies that heavily rely on internal Objective-C categories and +load methods (such as the Firebase iOS SDK suite), the Apple linker will aggressively strip these methods out if they are linked statically.

This causes fatal runtime crashes (e.g., FirebaseAuth/Auth.swift:167: Fatal error: Unexpectedly found nil).

The provided xcode_spm_setup Swift script automatically injects the -ObjC flag to OTHER_LDFLAGS when adding Firebase products. However, you should still verify it is present in the build settings if you encounter issues.

  • Failing to include this flag when adding Firebase dependencies is a critical error.

Empty Directory Workflow

If you are asked to build an iOS app or configure Xcode dependencies but no .xcodeproj or .xcworkspace exists, you MUST ask the user to create the project first:

"No Xcode project found in this directory. Please create an empty Xcode project manually and let me know when you are ready to proceed."

Wait for the user to confirm they have created the .xcodeproj via Xcode, then proceed with the Standard Xcode Workflow below.


Standard Xcode Workflow

Do not use raw text parsing, sed, or Ruby scripts to modify .pbxproj files directly.

Instead, execute the Swift configuration package bundled with this skill (scripts/xcode_spm_setup) to securely install SPM packages and link optional config files (like GoogleService-Info.plist).

CRITICAL: Always Use Latest SDK Version

To ensure access to the latest features and security fixes, always use the most recent version of the Firebase iOS SDK. Check for the latest release version at https://github.com/firebase/firebase-ios-sdk/releases.

  • Use the most recent version number (e.g., 11.x.y) in your commands instead of hardcoded placeholders.

Understanding the Script's Actions

When adding a Swift Package to an Xcode project, two distinct steps must occur:

  1. Adding the package repository dependency (e.g., https://github.com/Alamofire/Alamofire).
  2. Selecting the target (e.g., MyApp), navigating to General > Frameworks, Libraries, and Embedded Content, and hitting the + button to explicitly link the specific product modules (e.g., Alamofire).

The provided xcode_spm_setup Swift script automatically handles BOTH of these steps for you. By passing the list of modules as arguments, it safely injects the package dependency and automatically wires those modules to the main target's Frameworks build phase. You do not need to do any manual linking.

Usage

  1. Locate the package path: Find the absolute path to this skill's scripts/xcode_spm_setup directory on disk.
  2. Execute: Run the native swift run command using the signature below:
swift run --package-path <PATH_TO_SKILL>/scripts/xcode_spm_setup xcode_spm_setup <ProjectPath.xcodeproj> <RepoURL> <VersionRequirement> [--plist <Optional/Path/To/Config.plist>] <Product1> [Product2 ...]

Example 1: Generic Package (e.g., Alamofire)

Adding Alamofire to a standard Xcode project. Notice there is no --plist flag.

swift run --package-path /Users/foo/.agents/skills/xcode-project-setup/scripts/xcode_spm_setup xcode_spm_setup MyApp.xcodeproj https://github.com/Alamofire/Alamofire 5.8.1 Alamofire

Example 2: Firebase (Requires Plist)

Adding Firebase and linking the GoogleService-Info.plist to the resources build phase automatically. Note: Replace 11.0.0 with the actual latest version from the releases page.

swift run --package-path /Users/foo/.agents/skills/xcode-project-setup/scripts/xcode_spm_setup xcode_spm_setup MyApp.xcodeproj https://github.com/firebase/firebase-ios-sdk 11.0.0 --plist MyApp/GoogleService-Info.plist FirebaseCore FirebaseAuth FirebaseFirestore

Note: The script is idempotent. It will automatically skip linking files or packages that are already present in the project.