{"id":12734,"plugin_id":"plugins_6a8ddf314ab88191864c208fda197798","kind":"skill","collection_source":null,"comparison_source":null,"observed_at":"2026-09-30T23:02:06.009Z","digest":"642e9db4ea16853c7ca6b28780520b8f7ece57e0208dbea1a0abd95fd50a1535","against":null,"payload":{"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).","included_files":[{"relative_path":"scripts/xcode_spm_setup/.gitignore","size_in_bytes":153},{"relative_path":"scripts/xcode_spm_setup/Package.resolved","size_in_bytes":1076},{"relative_path":"scripts/xcode_spm_setup/Package.swift","size_in_bytes":428},{"relative_path":"scripts/xcode_spm_setup/Sources/main.swift","size_in_bytes":9135}],"skill_md_contents":"---\nname: xcode-project-setup\ndescription: 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).\ncompatibility: Requires Swift to be installed locally and macOS environment.\nmetadata:\n  category: ApplicationDevelopment\n---\n\n# Xcode Project Setup\n\n## ⛔️ CRITICAL RULES & ENVIRONMENT CHECKS\n\nBefore performing any Xcode setup or file manipulation, you **MUST** adhere to\nthe following rules. A hefty fee will be applied if you violate them.\n\n### 1. The Anti-Ruby Mandate\n\nYou are **strictly forbidden** from using Ruby, Rails, or any Ruby gems\n(including the `xcodeproj` gem). Under no circumstances may you write or execute\nRuby scripts.\n\n### 2. Modern Xcode Folder Synchronization\n\nModern Xcode projects support folder synchronization. When adding new source\ncode (`.swift`) or resource files, simply write them to the correct directory on\ndisk. They will be automatically included in the Xcode project. **Never manually\nmodify the `.pbxproj` file to add files.**\n\n### 3. Allowed Scripting Languages\n\nIf you absolutely must write a script to manipulate the project environment\n(e.g., configuring SPM packages beyond what the provided `xcode_spm_setup`\nscript does), you **must use Swift**. Only as an absolute last resort, if Swift\nis completely unviable, may you use Node.js or TypeScript.\n\n### 4. Toolchain Verification\n\nBecause this skill relies entirely on a native Swift script, you must verify the\nenvironment:\n\n- Run `swift --version` before proceeding.\n- If the Swift command is not found, you must stop and recommend the user\n  install the Swift toolchain (e.g., via `xcode-select --install` on macOS), or\n  ask if you can attempt to install it for them. Do not attempt to proceed\n  without Swift.\n\n### 5. Mandatory Linker Flags for Static Frameworks (Firebase)\n\nWhen setting up SPM dependencies that heavily rely on internal Objective-C\ncategories and `+load` methods (such as the Firebase iOS SDK suite), the Apple\nlinker will aggressively strip these methods out if they are linked statically.\n\nThis causes fatal runtime crashes (e.g.,\n`FirebaseAuth/Auth.swift:167: Fatal error: Unexpectedly found nil`).\n\n**The provided `xcode_spm_setup` Swift script automatically injects the `-ObjC`\nflag to `OTHER_LDFLAGS` when adding Firebase products.** However, you should\nstill verify it is present in the build settings if you encounter issues.\n\n- Failing to include this flag when adding Firebase dependencies is a critical\n  error.\n\n______________________________________________________________________\n\n## Empty Directory Workflow\n\nIf you are asked to build an iOS app or configure Xcode dependencies but **no\n`.xcodeproj` or `.xcworkspace` exists**, you MUST ask the user to create the\nproject first:\n\n**\"No Xcode project found in this directory. Please create an empty Xcode\nproject manually and let me know when you are ready to proceed.\"**\n\nWait for the user to confirm they have created the `.xcodeproj` via Xcode, then\nproceed with the Standard Xcode Workflow below.\n\n______________________________________________________________________\n\n## Standard Xcode Workflow\n\nDo not use raw text parsing, `sed`, or Ruby scripts to modify `.pbxproj` files\ndirectly.\n\nInstead, execute the Swift configuration package bundled with this skill\n(`scripts/xcode_spm_setup`) to securely install SPM packages and link optional\nconfig files (like `GoogleService-Info.plist`).\n\n### **CRITICAL: Always Use Latest SDK Version**\n\nTo ensure access to the latest features and security fixes, always use the most\nrecent version of the Firebase iOS SDK. Check for the latest release version at\n[https://github.com/firebase/firebase-ios-sdk/releases](https://github.com/firebase/firebase-ios-sdk/releases).\n\n- Use the most recent version number (e.g., `11.x.y`) in your commands instead\n  of hardcoded placeholders.\n\n### Understanding the Script's Actions\n\nWhen adding a Swift Package to an Xcode project, two distinct steps must occur:\n\n1. Adding the package repository dependency (e.g.,\n   `https://github.com/Alamofire/Alamofire`).\n1. Selecting the target (e.g., `MyApp`), navigating to **General > Frameworks,\n   Libraries, and Embedded Content**, and hitting the `+` button to explicitly\n   link the specific product modules (e.g., `Alamofire`).\n\n**The provided `xcode_spm_setup` Swift script automatically handles BOTH of\nthese steps for you.** By passing the list of modules as arguments, it safely\ninjects the package dependency and automatically wires those modules to the main\ntarget's Frameworks build phase. You do not need to do any manual linking.\n\n## Usage\n\n1. **Locate the package path:** Find the absolute path to this skill's\n   `scripts/xcode_spm_setup` directory on disk.\n1. **Execute:** Run the native `swift run` command using the signature below:\n\n```bash\nswift 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 ...]\n```\n\n### Example 1: Generic Package (e.g., Alamofire)\n\nAdding Alamofire to a standard Xcode project. Notice there is no `--plist` flag.\n\n```bash\nswift 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\n```\n\n### Example 2: Firebase (Requires Plist)\n\nAdding Firebase and linking the `GoogleService-Info.plist` to the resources\nbuild phase automatically. *Note: Replace `11.0.0` with the actual latest\nversion from\n[the releases page](https://github.com/firebase/firebase-ios-sdk/releases).*\n\n```bash\nswift 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\n```\n\n*Note: The script is idempotent. It will automatically skip linking files or\npackages that are already present in the project.*\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}