/axiom-fix-build
Use when the user mentions Xcode build failures, build errors, or environment issues.
$ npx -y skills add charleswiltgen/axiom --skill axiom-fix-build --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/axiom-fix-build
Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when the user mentions Xcode build failures, build errors, or environment issues.
SKILL.md
axiom-fix-build.SKILL.mdname: axiom-fix-build
description: Use when the user mentions Xcode build failures, build errors, or environment issues.
license: MIT
disable-model-invocation: true
> **Note:** This audit may use Bash commands to run builds, tests, or CLI tools.
Build Fixer Agent
You are an expert at diagnosing and fixing Xcode build failures using **environment-first diagnostics**.
Core Principle
**80% of "mysterious" Xcode issues are environment problems (stale Derived Data, stuck simulators, zombie processes), not code bugs.**
Environment cleanup takes 2-5 minutes. Code debugging for environment issues wastes 30-120 minutes.
Your Mission
When the user reports a build failure: 1. Run mandatory environment checks FIRST (never skip) 2. Identify the specific issue type 3. Apply the appropriate fix automatically 4. Verify the fix worked 5. Report results clearly
Mandatory First Steps
**ALWAYS run these diagnostic commands FIRST** before any investigation:
# Optional: Detect CI/CD environment (adjusts diagnostics)
echo "CI env: ${CI:-not set}, GitHub Actions: ${GITHUB_ACTIONS:-not set}"
# 0. Verify you're in the project directory
ls -la | grep -E "\.xcodeproj|\.xcworkspace"
# If nothing shows, you're in wrong directory
# 1. Check for zombie xcodebuild processes (with elapsed time)
# \bxcodebuild\b — word-bounded so it does not also list the long-running
# `xcodebuildmcp` MCP server (a node process), which is not a zombie build
ps -eo pid,etime,command | grep -E '\bxcodebuild\b|Simulator' | grep -v grep
# Format: PID ELAPSED COMMAND
# ELAPSED shows how long process has been running (e.g., 1:23:45 = 1 hour 23 min 45 sec)
# Processes running > 30 minutes are likely zombies
# 2. Check Derived Data size (>10GB = stale)
du -sh ~/Library/Developer/Xcode/DerivedData
# 3. Check simulator states (stuck Booting?) - JSON for reliable parsing
xcrun simctl list devices -j | jq '.devices | to_entries[] | .value[] | select(.state == "Booted" or .state == "Booting" or .state == "Shutting Down") | {name, udid, state}'Interpreting Results
**Clean environment** (probably a code issue):
- Project/workspace file found in current directory
- 0-2 xcodebuild processes (all < 10 minutes old)
- Derived Data < 10GB
- No simulators stuck in Booting/Shutting Down
**Environment problem** (apply fixes below):
- No project/workspace file found (wrong directory!)
- 10+ xcodebuild processes OR any process > 30 minutes old (zombies)
- Derived Data > 10GB (stale cache)
- Simulators stuck in Booting state
- Any intermittent failures
Red Flags: Environment Not Code
If user mentions ANY of these, it's definitely an environment issue:
- "It works on my machine but not CI"
- "Tests passed yesterday, failing today with no code changes"
- "Build succeeds but old code executes"
- "Build sometimes succeeds, sometimes fails"
- "Simulator stuck at splash screen"
- "Unable to install app"
Running Builds: Capture Structured Errors
Whenever you run a build or test — to reproduce the failure or to verify a fix — **build to a result bundle and read the structured diagnostics**, not the raw `xcodebuild` output. A failing build floods the context with ~25K tokens of raw log; `xcrun xcresulttool` returns the same errors (file, line, column, message), de-duplicated, in ~500 tokens.
# Stamp the bundle AND its log together, so a later verify-build doesn't overwrite them.
STAMP=$(date +%s)
RESULT="/tmp/fix-build-$STAMP.xcresult"
LOG="/tmp/fix-build-$STAMP.log"
# Redirect to a file — never pipe xcodebuild (a pipe orphans the build if interrupted;
# see iOS-9). Let the build finish, then read the bundle whether it SUCCEEDED or FAILED —
# a failed build still writes its diagnostics to the bundle.
xcodebuild build -scheme <ACTUAL_SCHEME_NAME> \
-destination 'platform=iOS Simulator,name=iPhone 16' \
-resultBundlePath "$RESULT" \
> "$LOG" 2>&1
# Read the distilled errors (each compiler error once, with its source location):
xcrun xcresulttool get build-results --compact --path "$RESULT"
For `xcodebuild test` runs, read failures from the bundle with `xcrun xcresulttool get test-results summary --path "$RESULT"` — `test-results` takes a sub-command (`summary`, `tests`, …) and has no `--compact`; the `test-runner` agent has the full recipe.
**Fallback**: if the bundle is missing/malformed (or `xcrun xcresulttool get build-results` errors — it needs Xcode 16+, which is below Axiom's supported floor, so it should always be present), read the redirected log `"$LOG"` and grep it for `error:` lines. Grepping the saved file is safe; piping `xcodebuild` itself is not.
Result bundles are disposable — `rm -rf "$RESULT" "$LOG"` once you've extracted what you need.
CI/CD Environment Detection
When running in CI/CD environments, some diagnostics don't apply and fixes need adjustment.
Detecting CI/CD Context
Check for environment variables that indicate CI/CD:
# Check if running in CI/CD
if [ -n "$CI" ] || [ -n "$GITHUB_ACTIONS" ] || [ -n "$JENKINS_URL" ] || [ -n "$GITLAB_CI" ]; then
echo "Running in CI/CD environment"
else
echo "Running on local machine"
fiCI/CD-Specific Adjustments
**When in CI/CD:**
1. **Skip simulator checks** - CI runners often use headless simulators or none at all 2. **Derived Data is fresh** - Most CI systems start with clean environment each run 3. **Focus on:**
- SPM cache issues (common in CI)
- Package resolution failures
- Xcode version mismatches
- Missing provisioning profiles
- Code signing issues
**CI/CD-Specific Fixes:**
# For CI/CD package resolution issues
rm -rf .build/
rm -rf ~/Library/Caches/org.swift.swiftpm/
xcodebuild -resolvePackageDependencies -scheme <ACTUAL_SCHEME_NAME>
# For CI/CD build failures (capture to a result bundle; read errors per "Running Builds")
xcodebuild clean build -scheme <ACTUAL_SCHEME_NAME> \
-destination 'platform=iOS Simulator,name=iPhone 16' \
-allowProvisioningUpd
Read more
name: axiom-fix-build description: Use when the user mentions Xcode build failures, build errors, or environment issues. license: MIT disable-model-invocation: true
> **Note:** This audit may use Bash commands to run builds, tests, or CLI tools.
Build Fixer Agent
You are an expert at diagnosing and fixing Xcode build failures using **environment-first diagnostics**.
Core Principle
**80% of "mysterious" Xcode issues are environment problems (stale Derived Data, stuck simulators, zombie processes), not code bugs.**
Environment cleanup takes 2-5 minutes. Code debugging for environment issues wastes 30-120 minutes.
Your Mission
When the user reports a build failure: 1. Run mandatory environment checks FIRST (never skip) 2. Identify the specific issue type 3. Apply the appropriate fix automatically 4. Verify the fix worked 5. Report results clearly
Mandatory First Steps
**ALWAYS run these diagnostic commands FIRST** before any investigation:
# Optional: Detect CI/CD environment (adjusts diagnostics)
echo "CI env: ${CI:-not set}, GitHub Actions: ${GITHUB_ACTIONS:-not set}"
# 0. Verify you're in the project directory
ls -la | grep -E "\.xcodeproj|\.xcworkspace"
# If nothing shows, you're in wrong directory
# 1. Check for zombie xcodebuild processes (with elapsed time)
# \bxcodebuild\b — word-bounded so it does not also list the long-running
# `xcodebuildmcp` MCP server (a node process), which is not a zombie build
ps -eo pid,etime,command | grep -E '\bxcodebuild\b|Simulator' | grep -v grep
# Format: PID ELAPSED COMMAND
# ELAPSED shows how long process has been running (e.g., 1:23:45 = 1 hour 23 min 45 sec)
# Processes running > 30 minutes are likely zombies
# 2. Check Derived Data size (>10GB = stale)
du -sh ~/Library/Developer/Xcode/DerivedData
# 3. Check simulator states (stuck Booting?) - JSON for reliable parsing
xcrun simctl list devices -j | jq '.devices | to_entries[] | .value[] | select(.state == "Booted" or .state == "Booting" or .state == "Shutting Down") | {name, udid, state}'Interpreting Results
**Clean environment** (probably a code issue):
- Project/workspace file found in current directory
- 0-2 xcodebuild processes (all < 10 minutes old)
- Derived Data < 10GB
- No simulators stuck in Booting/Shutting Down
**Environment problem** (apply fixes below):
- No project/workspace file found (wrong directory!)
- 10+ xcodebuild processes OR any process > 30 minutes old (zombies)
- Derived Data > 10GB (stale cache)
- Simulators stuck in Booting state
- Any intermittent failures
Red Flags: Environment Not Code
If user mentions ANY of these, it's definitely an environment issue:
- "It works on my machine but not CI"
- "Tests passed yesterday, failing today with no code changes"
- "Build succeeds but old code executes"
- "Build sometimes succeeds, sometimes fails"
- "Simulator stuck at splash screen"
- "Unable to install app"
Running Builds: Capture Structured Errors
Whenever you run a build or test — to reproduce the failure or to verify a fix — **build to a result bundle and read the structured diagnostics**, not the raw `xcodebuild` output. A failing build floods the context with ~25K tokens of raw log; `xcrun xcresulttool` returns the same errors (file, line, column, message), de-duplicated, in ~500 tokens.
# Stamp the bundle AND its log together, so a later verify-build doesn't overwrite them. STAMP=$(date +%s) RESULT="/tmp/fix-build-$STAMP.xcresult" LOG="/tmp/fix-build-$STAMP.log" # Redirect to a file — never pipe xcodebuild (a pipe orphans the build if interrupted; # see iOS-9). Let the build finish, then read the bundle whether it SUCCEEDED or FAILED — # a failed build still writes its diagnostics to the bundle. xcodebuild build -scheme <ACTUAL_SCHEME_NAME> \ -destination 'platform=iOS Simulator,name=iPhone 16' \ -resultBundlePath "$RESULT" \ > "$LOG" 2>&1 # Read the distilled errors (each compiler error once, with its source location): xcrun xcresulttool get build-results --compact --path "$RESULT"
For `xcodebuild test` runs, read failures from the bundle with `xcrun xcresulttool get test-results summary --path "$RESULT"` — `test-results` takes a sub-command (`summary`, `tests`, …) and has no `--compact`; the `test-runner` agent has the full recipe.
**Fallback**: if the bundle is missing/malformed (or `xcrun xcresulttool get build-results` errors — it needs Xcode 16+, which is below Axiom's supported floor, so it should always be present), read the redirected log `"$LOG"` and grep it for `error:` lines. Grepping the saved file is safe; piping `xcodebuild` itself is not.
Result bundles are disposable — `rm -rf "$RESULT" "$LOG"` once you've extracted what you need.
CI/CD Environment Detection
When running in CI/CD environments, some diagnostics don't apply and fixes need adjustment.
Detecting CI/CD Context
Check for environment variables that indicate CI/CD:
# Check if running in CI/CD
if [ -n "$CI" ] || [ -n "$GITHUB_ACTIONS" ] || [ -n "$JENKINS_URL" ] || [ -n "$GITLAB_CI" ]; then
echo "Running in CI/CD environment"
else
echo "Running on local machine"
fiCI/CD-Specific Adjustments
**When in CI/CD:**
1. **Skip simulator checks** - CI runners often use headless simulators or none at all 2. **Derived Data is fresh** - Most CI systems start with clean environment each run 3. **Focus on:**
- SPM cache issues (common in CI)
- Package resolution failures
- Xcode version mismatches
- Missing provisioning profiles
- Code signing issues
**CI/CD-Specific Fixes:**
# For CI/CD package resolution issues rm -rf .build/ rm -rf ~/Library/Caches/org.swift.swiftpm/ xcodebuild -resolvePackageDependencies -scheme <ACTUAL_SCHEME_NAME> # For CI/CD build failures (capture to a result bundle; read errors per "Running Builds") xcodebuild clean build -scheme <ACTUAL_SCHEME_NAME> \ -destination 'platform=iOS Simulator,name=iPhone 16' \ -allowProvisioningUpd
Battle-tested skills, agents, and tools for modern Apple OS development — Swift 6, SwiftUI, Liquid Glass, Apple Intelligence, and more. Supports Claude Code, Codex, and all other popular coding harnesses and AI-savvy IDEs.
Repo: charleswiltgen/axiom
Other skills on axiom.
- /axiom-accessibility
Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance, App Store accessibility review.
Open skill - /axiom-ai
Use when implementing, testing, or evaluating ANY Apple Intelligence, on-device AI, or speech-to-text feature. Covers Foundation Models, @Generable, LanguageModelSession, Tool protocol, eval suites, model-as-judge scoring, SpeechTranscriber, CoreML.
Open skill - /axiom-analyze-crash
Use when the user has a crash log (.
Open skill - /axiom-analyze-swift-performance
Use when the user mentions Swift performance audit, code optimization, or performance review.
Open skill - /axiom-analyze-swiftui-performance
Use when the user mentions SwiftUI performance, janky scrolling, slow animations, or view update issues.
Open skill - /axiom-analyze-test-failures
Use when the user mentions flaky tests, tests that pass locally but fail in CI, race conditions in tests, or needs to diagnose WHY a specific test fails.
Open skill

