From xcode-mcp
This skill should be used when the user asks to "build the app", "compile the project", "fix build errors", "build failed", "resolve compiler errors", "make it compile", "clean build", or when Swift/SwiftUI compilation errors need to be diagnosed and fixed. Also activates when working on iOS/macOS code after making changes that need to be verified via a build.
How this skill is triggered — by the user, by Claude, or both
Slash command
/xcode-mcp:xcode-build-and-fixThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use the Xcode MCP to build projects and diagnose compiler errors. Xcode's incremental build system is faster than `xcodebuild` CLI for iterative development, and the MCP bridge returns rich diagnostic output including file paths, line numbers, and error messages.
Use the Xcode MCP to build projects and diagnose compiler errors. Xcode's incremental build system is faster than xcodebuild CLI for iterative development, and the MCP bridge returns rich diagnostic output including file paths, line numbers, and error messages.
"Build the [scheme] scheme"
"Build the [scheme] scheme for iOS Simulator"
"Build the [scheme] scheme for My Mac (Designed for iPad)"
"Build and report any errors or warnings"
"Clean the build folder and rebuild the [scheme] scheme"
"Clean derived data for [scheme] then build"
"Build and run the [scheme] scheme on the iPhone 17 Pro simulator"
"Build and run on the connected device"
When using an agent (Claude Agent, Codex, or external agents like Claude Code via MCP), Xcode can automatically iterate on build errors — building, detecting errors, applying fixes, and rebuilding without manual intervention. The xcode-build-fix agent replicates this pattern for Claude Code sessions.
Follow this cycle when fixing compilation errors:
Example request sequence:
Step 1: "Build the MyApp scheme and list all errors with file and line"
Step 3: [Use Edit tool on ContentView.swift:42]
Step 4: "Build the MyApp scheme again"
Important: Fix errors in dependency order — compiler errors often cascade. Address errors in types/protocols before errors in consuming code.
The MCP response will contain Xcode's build log. Key fields to parse:
path/to/File.swift:line:column: error: messagepath/to/File.swift:line:column: warning: messageWhen multiple errors exist, prioritize:
// Error: Cannot convert value of type 'Int' to expected argument type 'String'
// Fix: Add explicit conversion
Text(String(count)) // not Text(count)
// Error: Type 'MyModel' does not conform to protocol 'Identifiable'
// Fix: Add required property
struct MyModel: Identifiable {
let id = UUID()
}
Usually a missing import or conflicting module. Request from Xcode MCP:
"Search Apple docs for [the symbol or operator] to find which framework provides it"
@State / @Binding Misuse// Error: Cannot assign to property: 'x' is a get-only property
// Fix: Pass Binding, not the value
MyView(isOn: $isOn) // not MyView(isOn: isOn)
When a project uses local SPM packages with @_exported import, SourceKit/IDE analysis will report errors like "No such module 'SomeModule'" or "Cannot find type 'X' in scope" even when the code is valid. These are false positives — SourceKit cannot resolve transitive SPM imports outside Xcode's full build graph. Never act on SourceKit diagnostics alone; xcodebuild build is the only authoritative check.
For Swift 6 concurrency errors, the swift-concurrency plugin's swift-concurrency skill provides detailed guidance. Use it alongside this skill when builds fail with actor isolation or Sendable errors.
Prefer xcodebuild via Bash when:
xcodebuild archive or xcodebuild exportArchive-destination flags for specific device/OS combinationsxcodebuild test with -resultBundlePath for CI artifactsxcodebuild -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 17 Pro' build
Note: iOS 26 simulators no longer include iPhone 16 — use xcrun simctl list devices to find available names.
When builds are slow, request via MCP:
"Check the build phases for the main target and identify any slow custom run script phases"
"Enable explicit module builds for the [scheme] scheme"
For large projects, prefer incremental builds — avoid clean builds unless diagnosing cache issues.
npx claudepluginhub mattwag05/mw-plugins --plugin xcode-mcpProvides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.