.claude/skills/tooling/xcode-build/SKILL.md
Xcode build system knowledge for macOS apps. Build settings, configurations, schemes, signing, distribution, and optimization.
npx skillsauth add brdohman/agile-maestro xcode-build-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
MCP Alternative: When Xcode is running with the project loaded, prefer Xcode MCP tools (
BuildProject,GetBuildLog,XcodeListNavigatorIssues) over directxcodebuildcommands. See.claude/skills/tooling/xcode-mcp/SKILL.mdfor the full reference. The patterns below remain the authoritative fallback for headless/CI environments.
Key build settings for macOS apps:
| Setting | Debug | Release | Purpose |
|---------|-------|---------|---------|
| SWIFT_ACTIVE_COMPILATION_CONDITIONS | DEBUG | (empty) | Conditional compilation |
| SWIFT_OPTIMIZATION_LEVEL | -Onone | -O | Compiler optimization |
| DEBUG_INFORMATION_FORMAT | dwarf | dwarf-with-dsym | Debug symbols |
| ENABLE_TESTABILITY | YES | NO | @testable import support |
| GCC_PREPROCESSOR_DEFINITIONS | DEBUG=1 | (empty) | C/ObjC conditional compilation |
Important settings to verify:
PRODUCT_BUNDLE_IDENTIFIER — must be unique for signingINFOPLIST_FILE — path to Info.plist (or GENERATE_INFOPLIST_FILE = YES)MACOSX_DEPLOYMENT_TARGET — should match CLAUDE.md (26.0)SWIFT_STRICT_CONCURRENCY — should be complete for strict checkingStandard configurations: Debug (development) and Release (distribution).
Custom configurations (if needed):
Each configuration can override any build setting. Use #if DEBUG in code to branch behavior:
#if DEBUG
let baseURL = "https://staging.api.example.com"
#else
let baseURL = "https://api.example.com"
#endif
Use .xcconfig files for shared build settings across targets:
// Shared.xcconfig
MACOSX_DEPLOYMENT_TARGET = 26.0
SWIFT_VERSION = 6.0
SWIFT_STRICT_CONCURRENCY = complete
// Debug.xcconfig
#include "Shared.xcconfig"
SWIFT_OPTIMIZATION_LEVEL = -Onone
ENABLE_TESTABILITY = YES
// Release.xcconfig
#include "Shared.xcconfig"
SWIFT_OPTIMIZATION_LEVEL = -O
ENABLE_TESTABILITY = NO
Set in Xcode: Project > Info > Configurations > set xcconfig file for each configuration.
Mark schemes as "Shared" to include in version control: Manage Schemes > check "Shared" column.
Create test plans for organized test execution:
*Tests targets*UITests targetsSet in Edit Scheme > Run > Arguments > Environment Variables:
| Variable | Value | Purpose |
|----------|-------|---------|
| SQLITE_ENABLE_THREAD_ASSERTIONS | 1 | Catch SQLite threading issues |
| CFNETWORK_DIAGNOSTICS | 3 | Network debugging |
| CG_CONTEXT_SHOW_BACKTRACE | YES | Graphics debugging |
SWIFT_COMPILATION_MODE = wholemodule (release only)singlefile for DebugBUILD_LIBRARY_FOR_DISTRIBUTION = YES only when creating frameworks# Clear derived data (fixes phantom build errors)
rm -rf ~/Library/Developer/Xcode/DerivedData/AppName-*
# Check derived data size
du -sh ~/Library/Developer/Xcode/DerivedData/
| Method | Signing | Notarization | Use When | |--------|---------|-------------|----------| | Developer ID | Developer ID cert | Required | Direct distribution (website, GitHub) | | App Store | Distribution cert | Automatic | App Store distribution | | TestFlight | Distribution cert | Automatic | Beta testing | | Development | Development cert | Not needed | Local testing only |
For this project (personal use, no App Store): Developer ID with notarization.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>developer-id</string>
<key>signingStyle</key>
<string>automatic</string>
<key>teamID</key>
<string>YOUR_TEAM_ID</string>
</dict>
</plist>
# Resolve packages (downloads + caches)
swift package resolve
# Clean package cache
swift package purge-cache
# Update all packages to latest compatible versions
swift package update
Package.resolved to version controlswift package resolve uses the lock file; swift package update regenerates itCache ~/Library/Caches/org.swift.swiftpm/ and DerivedData/SourcePackages/ between CI runs to speed up builds.
testing
XCTest patterns for macOS Swift apps. Unit tests, async tests, Core Data tests, mock patterns, and assertion reference. Use when writing or reviewing tests.
tools
How to transition workflow state between review stages. Rules for setting review_stage and review_result fields on Stories and Epics.
documentation
Comment structure and rules for task workflow updates. Use when adding any comment to a task during implementation, review, or fix cycles.
testing
Validate task/story/epic/bug/techdebt metadata against schema v2.0. Run after TaskCreate or TaskUpdate to verify compliance. Returns pass/fail with actionable details.