> add-to-xcode
REQUIRED: After creating ANY .swift, .m, .mm, .c, .cpp, or .h file in a directory containing a .xcodeproj, you MUST run add_to_xcode.rb to register it with the project. Without this step, the file will NOT appear in Xcode and will NOT compile.
curl "https://skillshub.wtf/michaelboeding/skills/add-to-xcode?format=md"Add to Xcode
⚠️ MANDATORY: Run After Creating Source Files
Every time you create a .swift, .m, .mm, .c, .cpp, or .h file in an Xcode project, you MUST run:
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb <filepath>
If you skip this step:
- ❌ File will NOT appear in Xcode's navigator
- ❌ File will NOT compile with the app
- ❌ User will have to manually add it
Quick Reference
# ALWAYS do this after creating any source file:
# Use subshell to get latest version (handles multiple cached versions)
ruby "$(ls -1d ~/.claude/plugins/cache/michaelboeding-skills/skills/*/skills/add-to-xcode/scripts/add_to_xcode.rb 2>/dev/null | sort -V | tail -1)" NewFile.swift
Supported File Types
| Extension | Added to Compile Sources |
|---|---|
.swift | ✅ Yes |
.m | ✅ Yes |
.mm | ✅ Yes |
.c | ✅ Yes |
.cpp | ✅ Yes |
.h | ❌ No (reference only) |
Workflow
Step 1: Create the file normally
# Example: Create a new Swift file
cat > Sources/Features/MyFeature.swift << 'EOF'
import Foundation
class MyFeature {
// Implementation
}
EOF
Step 2: Add to Xcode project
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb Sources/Features/MyFeature.swift
Output:
✓ Added Sources/Features/MyFeature.swift to MyApp.xcodeproj (target: MyApp)
What the Script Does
- Finds the
.xcodeproj- Searches current directory and parents - Creates group hierarchy - Matches the file's directory structure
- Adds file reference - Registers with the project
- Adds to build target - Source files (
.swift,.m,.mm,.c,.cpp) are added to the first target's compile sources
Requirements
Ruby with the xcodeproj gem:
gem install xcodeproj
Examples
Adding a new Swift file
# Create the file
cat > MyApp/ViewModels/ProfileViewModel.swift << 'EOF'
import SwiftUI
@Observable
class ProfileViewModel {
var name: String = ""
var email: String = ""
}
EOF
# Add to Xcode
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb MyApp/ViewModels/ProfileViewModel.swift
Adding a header file
# Create header
cat > MyApp/Bridge/MyApp-Bridging-Header.h << 'EOF'
#import <SomeLibrary/SomeLibrary.h>
EOF
# Add to Xcode (headers are added but not to compile sources)
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb MyApp/Bridge/MyApp-Bridging-Header.h
Adding Objective-C files
# Create implementation
cat > MyApp/Legacy/LegacyManager.m << 'EOF'
#import "LegacyManager.h"
@implementation LegacyManager
// Implementation
@end
EOF
# Add to Xcode
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb MyApp/Legacy/LegacyManager.m
Agent Integration
When working in an Xcode project, agents should:
- Check for
.xcodeprojbefore creating source files - Create the file using standard file creation
- Run add_to_xcode.rb immediately after file creation
# Pattern for agents:
# 1. Create file
cat > NewFile.swift << 'EOF'
// content
EOF
# 2. Register with Xcode
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb NewFile.swift
Troubleshooting
"No .xcodeproj found"
- Make sure you're running from within the Xcode project directory or a subdirectory
"gem not found: xcodeproj"
- Install with:
gem install xcodeproj - On macOS with system Ruby, you may need:
sudo gem install xcodeproj
File added but not compiling
- Check that the file extension is recognized (
.swift,.m,.mm,.c,.cpp) - Verify the target exists and has a source build phase
- Header files (
.h) are not added to compile sources (this is correct)
Related Skills
| Skill | Use Case |
|---|---|
ios-to-android | Convert iOS code to Android |
android-to-ios | Convert Android code to iOS |
> related_skills --same-repo
> xlsx
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas
> voice-generation
Use this skill for AI text-to-speech generation. Triggers include: "generate voice", "create audio", "text to speech", "TTS", "read this aloud", "generate narration", "create voiceover", "synthesize speech", "podcast audio", "dialogue audio", "multi-speaker", "audiobook" Supports Google Gemini TTS, ElevenLabs, and OpenAI TTS.
> video-producer-agent
Use this skill to create complete videos with voiceover and music. Triggers: "create video", "product video", "explainer video", "promo video", "demo video", "training video", "ad video", "commercial", "marketing video", "video with voiceover", "video with music", "brand video", "testimonial video" Orchestrates: script, voiceover, background music, video clips/images, and final assembly.
> video-generation
Use this skill for AI video generation. Triggers include: "generate video", "create video", "make video", "animate", "text to video", "video from image", "video of", "animate image", "bring to life", "make it move", "add motion", "video with audio", "video with dialogue" Supports text-to-video, image-to-video, video with dialogue/audio using Google Veo 3.1 (default) or OpenAI Sora.