agentleFS
conorluddyconorluddy/xclaude-plugin/skills/xcode-workflows/SKILL.md

xcode-workflows

Skill186 starsChanged 12 months agoMITView on GitHub

Xcode build system guidance for xcodebuild operations. Use when building iOS projects, running tests, analyzing build failures, or configuring schemes. Covers build/clean/test operations, interpreting xcodebuild output, and troubleshooting common build errors.

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 13 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    This is the most important rule: When working with iOS builds, you MUST use the execute_xcode_command MCP tool.

    line 14
  2. Very specific:

    If execute_xcode_command fails, the issue is with parameters or the project - not that you should use bash.

    line 30
  3. Distinctive:

    Use for: Development, testing

    line 207
  4. Distinctive:

    Use for: Production, App Store, performance testing

    line 215
  5. Very specific:

    Run list operation to see available schemes

    line 306
  6. Distinctive:

    Check if scheme is shared (Xcode → Product → Scheme → Manage Schemes)

    line 307
  7. Distinctive:

    Check Team ID in project settings

    line 315
  8. Distinctive:

    Verify certificates in Keychain

    line 316
  9. Distinctive:

    Use automatic signing if possible

    line 317
  10. Very specific:

    Run version operation to see available SDKs

    line 336
  11. Very specific:

    Update sdk option or remove to use latest

    line 337
  12. Very specific:

    Use execute_simulator_command with operation "list" to see available devices

    line 345
  13. Distinctive:

    Check device name spelling

    line 346
  14. Distinctive:

    Ensure device/simulator is available

    line 347
  15. Distinctive:

    Run tests multiple times:

    line 362
  16. Distinctive:

    Note: Test iteration support depends on Xcode version.

    line 375
  17. Distinctive:

    Don't clean unless necessary - incremental builds are much faster.

    line 428
  18. Distinctive:

    Default behavior - xcodebuild uses DerivedData for caching.

    line 444
  19. Distinctive:

    Not visible to xcodebuild by default

    line 495
  20. Very specific:

    All operations use the execute_xcode_command tool

    line 503

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Xcode Workflows

Use the execute_xcode_command MCP tool for all iOS build operations

The xclaude-plugin provides the execute_xcode_command MCP tool which consolidates all xcodebuild operations into a single, token-efficient dispatcher.

⚠️ CRITICAL: Always Use MCP Tools First

This is the most important rule: When working with iOS builds, you MUST use the execute_xcode_command MCP tool.

  • ✅ DO: Invoke execute_xcode_command for all build/test/clean operations
  • ✅ DO: If the MCP tool fails, adjust parameters and retry
  • ✅ DO: Read error messages and debug the parameters
  • ❌ NEVER: Fall back to bash xcodebuild commands
  • ❌ NEVER: Use xcodebuild directly in bash
  • ❌ NEVER: Run xcrun xcodebuild in a terminal

Why? The MCP tool provides:

  • Structured error handling
  • Token efficiency (consolidated into 1 tool vs. verbose bash output)
  • Proper integration with the xclaude-plugin architecture
  • Consistent response formatting

If execute_xcode_command fails, the issue is with parameters or the project - not that you should use bash.

When to Use Bash (And When NOT to)

❌ NEVER Use Bash For These (Use MCP Tools Instead)

Task❌ WRONG (Bash)✅ RIGHT (MCP Tool)
List schemesxcodebuild -listexecute_xcode_command op: "list"
Build appxcodebuild -scheme...execute_xcode_command op: "build"
Run testsxcodebuild -scheme... testexecute_xcode_command op: "test"
Clean buildxcodebuild cleanexecute_xcode_command op: "clean"
Get Xcode infoxcodebuild -versionexecute_xcode_command op: "version"

✅ Bash is Acceptable For (Non-Build Tasks)

  • File operations: mkdir, cp, rm, ls, etc.
  • Text inspection: grep, find, cat, etc.
  • Git operations: git status, git log, etc.
  • Environment checks: which, xcode-select --version, etc.
  • Project exploration: find . -name "*.swift", etc.

The Rule: If it's about Xcode building/testing → Use MCP tool, not bash

Quick Reference

TaskMCP ToolOperationKey Parameters
Build for simulatorexecute_xcode_commandbuildscheme, configuration:Debug
Build for deviceexecute_xcode_commandbuildscheme, configuration:Release, destination
Run testsexecute_xcode_commandtestscheme, destination
Clean buildexecute_xcode_commandcleanscheme
List schemesexecute_xcode_commandlist-
Get Xcode infoexecute_xcode_commandversion-

Standard Workflows

1. Building an App

Step 1: Discover Schemes - Use execute_xcode_command with operation: "list"

Invoke the execute_xcode_command MCP tool:

{
  "operation": "list",
  "project_path": "/path/to/Project.xcodeproj"
}

Note: project_path is optional - auto-detected from current directory.

Returns:

{
  "schemes": ["MyApp", "MyAppTests", "MyAppUITests"],
  "targets": ["MyApp", "MyAppKit", "MyAppTests"]
}

Step 2: Build - Use execute_xcode_command with operation: "build"

Invoke the execute_xcode_command MCP tool with build parameters:

{
  "operation": "build",
  "scheme": "MyApp",
  "configuration": "Debug",
  "destination": "platform=iOS Simulator,name=iPhone 15"
}

Common Destinations:

  • iOS Simulator (explicit - recommended): "platform=iOS Simulator,name=iPhone 15,OS=18.0"
  • iOS Simulator (auto-resolve): "platform=iOS Simulator,name=iPhone 15" (will auto-detect latest OS)
  • iOS Device: "platform=iOS,id=<device-udid>"
  • Any Simulator: "platform=iOS Simulator,name=Any iOS Simulator Device"
  • macOS: "platform=macOS"

Note: The destination parameter now supports auto-resolution! If you omit the OS version, the tool will automatically query available simulators and select the latest OS version for the specified device name. For explicit control, include the OS version in your destination string.

2. Running Tests

Unit Tests:

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15"
}

Specific Test Plan:

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15",
  "options": {
    "test_plan": "UnitTests"
  }
}

Run Specific Tests:

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15",
  "options": {
    "only_testing": [
      "MyAppTests/LoginTests/testSuccessfulLogin",
      "MyAppTests/LoginTests/testInvalidCredentials"
    ]
  }
}

Skip Specific Tests:

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15",
  "options": {
    "skip_testing": ["MyAppUITests"]
  }
}

3. Clean Build

When to Clean:

  • Build artifacts corrupted
  • Switching branches significantly
  • Mysterious build failures
  • Before release builds
{
  "operation": "clean",
  "scheme": "MyApp"
}

Clean + Build Pattern:

{
  "operation": "build",
  "scheme": "MyApp",
  "configuration": "Debug",
  "options": {
    "clean_before_build": true
  }
}

Configurations

Debug vs Release

Debug (Default):

  • Optimizations disabled
  • Debug symbols included
  • Faster compile time
  • Larger binary
  • Use for: Development, testing

Release:

  • Optimizations enabled
  • Debug symbols optional
  • Slower compile time
  • Smaller binary
  • Use for: Production, App Store, performance testing
{
  "operation": "build",
  "scheme": "MyApp",
  "configuration": "Release"
}

Build Options

Common Options

{
  "operation": "build",
  "scheme": "MyApp",
  "options": {
    "clean_before_build": true,
    "parallel": true,
    "sdk": "iphoneos17.0",
    "arch": "arm64",
    "quiet": false
  }
}

Options Explained:

  • clean_before_build: Clean before building (ensures fresh build)
  • parallel: Enable parallel builds (faster on multi-core)
  • sdk: Specific SDK version (usually auto-selected)
  • arch: Target architecture (arm64 for devices, x86_64 for old simulators)
  • quiet: Reduce build output verbosity

Interpreting Build Results

Success Response

{
  "success": true,
  "summary": "Build succeeded",
  "warnings": 3,
  "build_time": "45.2s",
  "scheme": "MyApp",
  "configuration": "Debug"
}

Failure Response

{
  "success": false,
  "error": "Build failed",
  "errors": 2,
  "warnings": 5,
  "failure_reason": "Compilation errors in ViewController.swift"
}

Progressive Disclosure

Large build logs use progressive disclosure:

{
  "success": true,
  "summary": "Build succeeded with 15 warnings",
  "cache_id": "build-abc123",
  "quick_stats": {
    "warnings": 15,
    "build_time": "62.3s"
  },
  "next_steps": [
    "Use cache_id to get full build log if needed",
    "Review warnings for potential issues"
  ]
}

Common Build Errors

Error: "No scheme named 'X' found"

Cause: Scheme doesn't exist or isn't shared

Solution:

  1. Run list operation to see available schemes
  2. Check if scheme is shared (Xcode → Product → Scheme → Manage Schemes)

Error: "Code signing identity not found"

Cause: Missing or invalid signing certificate

Solution:

  1. Check Team ID in project settings
  2. Verify certificates in Keychain
  3. Use automatic signing if possible
{
  "operation": "build",
  "scheme": "MyApp",
  "options": {
    "code_sign_identity": "Apple Development",
    "development_team": "TEAM_ID_HERE"
  }
}

Error: "SDK not found"

Cause: Requesting unavailable SDK version

Solution:

  1. Run version operation to see available SDKs
  2. Update sdk option or remove to use latest

Error: "Destination not found"

Cause: Invalid destination specifier

Solution:

  1. Use execute_simulator_command with operation "list" to see available devices
  2. Check device name spelling
  3. Ensure device/simulator is available

Testing Workflows

Complete Test Suite

1. list → Get test scheme
2. clean → Ensure fresh state
3. test → Run all tests
4. Analyze results → Check for failures

Flaky Test Detection

Run tests multiple times:

{
  "operation": "test",
  "scheme": "MyApp",
  "options": {
    "test_iterations": 5,
    "retry_on_failure": true
  }
}

Note: Test iteration support depends on Xcode version.

Test Result Analysis

Tests return:

{
  "success": false,
  "tests_run": 45,
  "tests_passed": 43,
  "tests_failed": 2,
  "failures": [
    {
      "test": "MyAppTests.LoginTests.testInvalidPassword",
      "message": "XCTAssertEqual failed: (\"error\") is not equal to (\"invalid\")"
    }
  ]
}

Project Auto-Detection

xcodebuild operations auto-detect project files:

  1. Searches current directory for .xcworkspace
  2. Falls back to .xcodeproj
  3. Returns error if multiple or none found

Explicit Path:

{
  "operation": "build",
  "project_path": "/path/to/specific/Project.xcodeproj",
  "scheme": "MyApp"
}

Build Performance Tips

1. Enable Parallel Builds

{
  "options": {
    "parallel": true
  }
}

2. Incremental Builds

Don't clean unless necessary - incremental builds are much faster.

3. Reduce Verbosity

For CI/automated builds:

{
  "options": {
    "quiet": true
  }
}

4. Use Derived Data Caching

Default behavior - xcodebuild uses DerivedData for caching.

CI/CD Integration

GitHub Actions Pattern

1. version → Verify Xcode installation
2. list → Validate scheme exists
3. clean → Ensure fresh build
4. build → Compile project
5. test → Run test suite
6. Analyze results → Fail pipeline if tests fail

Build Artifacts

Build produces:

  • .app bundle in DerivedData
  • .xcresult test results bundle
  • Build logs (via progressive disclosure)

Advanced: Build Settings

Query build settings:

{
  "operation": "list",
  "project_path": "/path/to/Project.xcodeproj"
}

Returns scheme/target info. For detailed build settings, use Resource:

xc://reference/build-settings

Scheme Management

Shared vs User Schemes

Shared Schemes:

  • Checked into source control
  • Available to all users
  • Recommended for team projects

User Schemes:

  • Local to your machine
  • Not visible to xcodebuild by default

Best Practice: Share schemes used for CI/CD.

Integration with MCP Tools

This Skill works with execute_xcode_command tool:

  • All operations use the execute_xcode_command tool
  • Tool handles xcodebuild execution and output parsing
  • Tool provides progressive disclosure for large outputs
  • This Skill teaches WHEN and HOW to use operations

Related Skills

  • ios-testing-patterns: Advanced test strategies and analysis
  • simulator-workflows: Device management for testing
  • crash-debugging: Analyzing build crashes

Related Resources

  • xc://operations/xcode: Complete xcodebuild operations reference
  • xc://reference/build-settings: Build settings dictionary
  • xc://reference/error-codes: Common error codes and solutions

Tip: Use list to discover, build to compile, test to validate. Clean only when needed.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.