Agent skill
xcode-project
Add files and frameworks to Xcode projects programmatically
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/xcode-project
SKILL.md
/xcode-project - Xcode Project Management
Purpose
Safely add Swift source files, frameworks, and xcframeworks to Xcode projects without manual Xcode intervention. This skill handles the complex project.pbxproj file structure automatically.
Usage
/xcode-project add-files <path1> [path2...] # Add Swift files to project
/xcode-project add-framework <path> # Add framework/xcframework
/xcode-project list-files # List source files in project
/xcode-project verify # Verify project integrity
How It Works
The skill uses a Ruby script (scripts/xcode-project-helper.rb) that leverages the xcodeproj gem to safely manipulate project.pbxproj files. This is the same library used by CocoaPods and fastlane.
Adding Source Files
When adding Swift files:
- Creates PBXFileReference entry
- Adds to appropriate PBXGroup (based on file path)
- Adds to PBXSourcesBuildPhase for compilation
/xcode-project add-files UnaMentis/Services/TTS/NewService.swift
Adding Frameworks
When adding frameworks/xcframeworks:
- Creates PBXFileReference entry
- Adds to Frameworks group
- Adds to PBXFrameworksBuildPhase (Link Binary With Libraries)
- For embedded frameworks, adds to PBXCopyFilesBuildPhase
/xcode-project add-framework UnaMentis/Frameworks/MyLib.xcframework
Options
--embed- Embed framework (copy to app bundle)--no-embed- Link only, don't embed (default for system frameworks)--target <name>- Specify target (default: first app target)--group <path>- Specify group for file placement
Prerequisites
The Ruby xcodeproj gem must be installed:
gem install xcodeproj
Or using bundler (recommended):
cd <repository-root>
bundle install
Examples
Add a single Swift file:
/xcode-project add-files UnaMentis/Services/TTS/KyutaiPocketTTSService.swift
Add multiple files:
/xcode-project add-files UnaMentis/Services/TTS/PocketTTSBindings.swift UnaMentis/Services/TTS/KyutaiPocketModelManager.swift
Add an xcframework:
/xcode-project add-framework UnaMentis/Frameworks/PocketTTS.xcframework
Add framework with embedding:
/xcode-project add-framework UnaMentis/Frameworks/MyDynamicLib.framework --embed
Project Structure
The skill understands the UnaMentis project structure:
UnaMentis/- Main app sourceUnaMentis/Frameworks/- Third-party frameworksUnaMentis/Services/- Service layer codeUnaMentisTests/- Unit testsUnaMentisUITests/- UI tests
Files are automatically placed in the correct group based on their path.
Error Handling
The script validates:
- File exists on disk before adding
- File not already in project (prevents duplicates)
- Framework architecture compatibility
- Project file integrity after modification
If errors occur, the original project file is preserved (backup created).
Workflow Integration
Use this skill when:
- Adding new Swift source files created by Claude
- Integrating new frameworks or xcframeworks
- After generating UniFFI bindings
- When moving files between groups
This prevents the manual project.pbxproj editing that can cause:
- Missing file references
- Incorrect build phases
- UUID collisions
- Project corruption
Verification
After adding files, verify with:
/xcode-project verify
This checks:
- All referenced files exist on disk
- All source files are in build phases
- No duplicate entries
- Framework linking is correct
See Also
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?