跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 xcode-project-setup

Xcode Project Setup

安全修改 Xcode项目(.pbxproj)用于添加Swift包并链接文件. 当iOS项目需要安装依赖性(如Firebase,Alamofire)时使用此技能.

106345 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

安全修改 Xcode项目(.pbxproj)用于添加Swift包并链接文件. 当iOS项目需要安装依赖性(如Firebase,Alamofire)时使用此技能.

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Xcode Project Setup、⛔️ CRITICAL RULES & ENVIRONMENT CHECKS、1. The Anti-Ruby Mandate、2. Modern Xcode Folder Synchronization、3. Allowed Scripting Languages、4. Toolchain Verification。 其中含规范建议的小节:分步指令。

文件分析

文件分析:除 SKILL.md 外,正文引用了 scripts/xcode_spm_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).

Xcode Project Setup⛔️ CRITICAL RULES & ENVIRONMENT CHECKS1. The Anti-Ruby Mandate2. Modern Xcode Folder Synchronization3. Allowed Scripting Languages4. Toolchain Verification5. Mandatory Linker Flags for Static Frameworks (Firebase)Empty Directory WorkflowStandard Xcode Workflow**CRITICAL: Always Use Latest SDK Version**Understanding the Script's ActionsUsage

兼容:Requires Swift to be installed locally and macOS environment.

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
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.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 1
  • scripts/xcode_spm_setup

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「xcode-project-setup」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-6f301a797521f624-Xcode-Project-Setup.html
请存为 .cursor/skills/xcode-project-setup/SKILL.md 或 .claude/skills/xcode-project-setup/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/firebase/agent-skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/firebase/agent-skills' --list

npx skills add 'https://github.com/firebase/agent-skills' --skill 'xcode-project-setup'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- 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. metadata: category: ApplicationDevelopment --- # 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](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`). 1. 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. 1. **Execute:** Run the native `swift run` command using the signature below: ```bash swift run --package-path /scripts/xcode_spm_setup xcode_spm_setup [--plist ] [Product2 ...] ``` ### Example 1: Generic Package (e.g., Alamofire) Adding Alamofire to a standard Xcode project. Notice there is no `--plist` flag. ```bash 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](https://github.com/firebase/firebase-ios-sdk/releases).* ```bash 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.*

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…