Prompt file imported from xmtplabs/convos-ios (
.claude/commands/setup.md). Copyright stays with the author.
Setup
Initialize the Claude Code session for any branch or worktree ā creates a dedicated simulator and configures build defaults.
Purpose
This command sets up an iOS simulator and XcodeBuildMCP session defaults so /build and /build --run work correctly. It works in any context:
- convos-task worktrees: Uses the task config from
.convos-task - Regular branches: Derives the simulator name from the current git branch
- Main repo: Works on any branch, no special setup required
When to Run
- At the start of any new session when working on a feature branch
- Automatically suggested at session start when
.convos-taskfile exists - Can be run manually anytime to reset or verify the setup
Instructions
Step 1: Determine Simulator Name
Check for configuration in this order:
.convos-taskfile exists: ReadTASK_NAMEandSIMULATOR_NAMEfrom it- No
.convos-taskfile: Derive from the current git branch:- Run
git branch --show-currentto get the branch name - Sanitize the branch name: replace
/and special characters with-, lowercase it - Simulator name:
convos-<sanitized-branch-name> - Example: branch
jarod/push-notificationsā simulatorconvos-jarod-push-notifications - Special case: if on
mainormaster, useconvos-main
- Run
Step 2: Run Project Setup
Run Scripts/setup.sh with CI=true CLAUDE_SETUP=1 ā CI skips one-time machine setup (git hooks, Xcode defaults, brew installs of the GitHub CLI) and CLAUDE_SETUP=1 re-enables the .env / Firebase debug token check so missing .env symlinks in worktrees surface as warnings:
CI=true CLAUDE_SETUP=1 Scripts/setup.sh
This ensures SwiftLint, SwiftFormat, and other dependencies are installed, and surfaces any .env gap that would otherwise cause Firebase App Check failures at runtime.
Step 3: Create Simulator if Needed
- Use
mcp__XcodeBuildMCP__list_simsto check if the simulator already exists - If the simulator doesn't exist:
- Find a base iPhone simulator to clone from (prefer iPhone 17 Pro, iPhone 17 Pro Max, or latest available)
- Use bash to clone it:
xcrun simctl clone "BASE_SIM_NAME" "SIMULATOR_NAME"
- Get the simulator's UUID from the list
Step 4: Set XcodeBuildMCP Session Defaults
Call mcp__XcodeBuildMCP__session-set-defaults with:
simulatorName: The simulator name (e.g., "convos-push-notifications")projectPath: Path toConvos.xcodeprojscheme: "Convos (Dev)" (default scheme)useLatestOS: true
Step 5: Save Simulator ID for Session
Write the simulator UUID to .claude/.simulator_id for use by /build command.
Step 6: Report Setup Complete
Inform the user:
ā
Session setup complete
š± Simulator: SIMULATOR_NAME (UUID)
š§ XcodeBuildMCP defaults configured
š Project: Convos.xcodeproj
šÆ Scheme: Convos (Dev)
Ready to build! Use /build or /build --run
Teardown (when the task is done)
The simulator created here is task-scoped. Delete it from disk once the task is done - PR merged or work abandoned, not merely session end:
xcrun simctl shutdown "$(cat .claude/.simulator_id)" 2>/dev/null
xcrun simctl delete "$(cat .claude/.simulator_id)"
rm -f .claude/.simulator_id
Each clone holds 1-6 GB of app data and the shared disk runs chronically
near-full. convos-task cleanup already deletes its task's sim; every other
creation path (worktree /setup, branch /setup, ad-hoc QA clones) must clean
up after itself. To sweep accumulated orphans, run
.claude/scripts/cleanup-orphaned-sims (dry run by default; add --delete).
Example Flows
In a convos-task worktree:
User: /setup
Claude: Found .convos-task: TASK_NAME=push-notifications, SIMULATOR_NAME=convos-push-notifications
Running Scripts/setup.sh...
ā
All dependencies installed
Simulator convos-push-notifications exists (A1B2C3D4-...)
Setting XcodeBuildMCP defaults...
ā
Session setup complete
š± Simulator: convos-push-notifications (A1B2C3D4-...)
š§ XcodeBuildMCP defaults configured
š Project: Convos.xcodeproj
šÆ Scheme: Convos (Dev)
On a regular branch (no .convos-task):
User: /setup
Claude: No .convos-task found. Deriving from branch name...
Branch: jarod/retry-errors ā Simulator: convos-jarod-retry-errors
Running Scripts/setup.sh...
ā
All dependencies installed
Cloning iPhone 17 Pro ā convos-jarod-retry-errors...
Created simulator: convos-jarod-retry-errors (E5F6G7H8-...)
Setting XcodeBuildMCP defaults...
ā
Session setup complete
š± Simulator: convos-jarod-retry-errors (E5F6G7H8-...)
š§ XcodeBuildMCP defaults configured
š Project: Convos.xcodeproj
šÆ Scheme: Convos (Dev)
Error Handling
- If simulator creation fails: Show the error and suggest checking available simulators with
xcrun simctl list devices - If no base simulator found: "No iPhone simulator found to clone. Install iOS Simulator runtimes in Xcode."
- If
Scripts/setup.shfails: Show the error output and suggest running it manually
