Axiom Fix Build 标志

Axiom Fix Build

社区热门
CharlesWiltgen
axiom-fix-build

用户提到 Xcode 构建失败、构建错误或环境问题时使用。

Add to TypingMind

概览

发布者CharlesWiltgen
代码仓库Axiom
技能名称axiom-fix-build
星标数
1.2K
复刻数
86
附带文件
1
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 CharlesWiltgen 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Axiom Fix Build AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-fix-build
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CharlesWiltgen/Axiom.git /tmp/Axiom
mkdir -p .claude/skills
cp -r /tmp/Axiom/axiom-codex/skills/axiom-fix-build .claude/skills/axiom-fix-build
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Axiom Fix Build,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Axiom Fix Build。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Axiom Fix Build 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

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:

bash
# 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. Inventory exact-name build processes; verify this works before launching Xcode
pgrep -x xcodebuild | wc -l
# Investigate ownership and state of existing PIDs. Age alone proves nothing.

# 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
  • No conflicting build activity after ownership/state inspection
  • Derived Data < 10GB
  • No simulators stuck in Booting/Shutting Down

Environment problem (apply fixes below):

  • No project/workspace file found (wrong directory!)
  • Confirmed task-owned abandoned build activity; investigate before termination
  • 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"

Capture Build and Test Diagnostics

Before the next necessary build or test, resolve bin/axbuild under the actual loaded package in Claude Code or Codex, or discover an executable on PATH in Pi. Check executable permission and run its absolute path with --help; assign that observed path to AXBUILD. Never infer an installation path from an example.

Cursor and MCP distributions do not bundle axbuild and expose no axbuild MCP wrapper. Use the saved-log fallback below when a verified shell helper is unavailable.

Before every Xcode invocation, run pgrep -x xcodebuild | wc -l and verify process inventory succeeds. Investigate existing builds; process count and age do not establish zombie status. Never terminate unrelated processes. Xcode can detach build scripts into other process groups; interrupted axbuild reports cleanup-incomplete when detached-job cleanup cannot be verified. Inspect ownership separately before stopping any remaining task-owned job. Discover the actual scheme and destination before executing:

bash
"$AXBUILD" xcodebuild -scheme "$SCHEME" -destination "$DESTINATION" build
"$AXBUILD" swift test --package-path "$PACKAGE"

Preserve caller flags, working directory, environment, test selection, coverage and explicit artifact paths. The wrapper adds absent diagnostic defaults; it never cleans caches or automatically rebuilds. Do not pipe a build through another command.

Inspect command (native outcome) and collection (evidence completeness) separately. Native success can accompany partial collection. The default JSON is bounded to 8,000 UTF-8 bytes; inspect omissions and read artifacts.report relative to the absolute artifacts.run directory for complete records and evaluated values. The startup stderr JSON identifies the run directory before completion. Use diagnostic locations and values rather than rebuilding to redisplay output.

The retained log is the primary compiler source; test results and validated Swift Testing events supplement it. A null failed-test count means uncertainty, not zero. Preserve result bundles for attachment export, coverage, console logs and deeper inspection. Native informational commands pass their output through.

Saved-log fallback: redirect the necessary native command's stdout/stderr to a unique file, let it finish, record its exit status and inspect that saved file. An xcresult build summary is not equivalent to the compiler log. Read an existing log before considering another build. Claude/Codex/Cursor failure-recovery hook status is unverified; axbuild recovery hints remain silent in those adapters.

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:

bash
# 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"
fi

CI/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:

bash
# 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")
"$AXBUILD" xcodebuild clean build -scheme <ACTUAL_SCHEME_NAME> \
  -destination 'platform=iOS Simulator,name=iPhone 16' \
  -allowProvisioningUpdates \
  -resultBundlePath /tmp/ci-build.xcresult > /tmp/ci-build.log 2>&1
# Read the axbuild report and retained compiler log; keep the bundle for deeper inspection

Downloading Simulator Runtimes (CI/CD Setup):

For CI/CD environments that need specific simulator runtimes:

bash
# Download iOS simulator runtime for current Xcode
xcodebuild -downloadPlatform iOS

# Download specific iOS version
xcodebuild -downloadPlatform iOS -buildVersion 18.0

# Download to specific location (for caching/sharing)
xcodebuild -downloadPlatform iOS -exportPath ~/Downloads

# Download universal variant (works on Intel + Apple Silicon)
xcodebuild -downloadPlatform iOS -architectureVariant universal

# Download all platforms at once
xcodebuild -downloadAllPlatforms

# After downloading, install with three steps:
# 1. Select Xcode version
xcode-select -s /Applications/Xcode.app

# 2. Run first launch setup
xcodebuild -runFirstLaunch

# 3. Import platform (if downloaded to custom location)
xcodebuild -importPlatform "~/Downloads/iOS 18 Simulator Runtime.dmg"

# Check for newer components between releases
xcodebuild -runFirstLaunch -checkForNewerComponents

Use for: CI/CD initial setup, missing simulator errors, version-specific testing

Red Flags for CI/CD:

  • "Works locally but fails in CI" → Usually SPM cache or Xcode version mismatch
  • "Intermittent CI failures" → Network issues downloading packages
  • "CI hangs indefinitely" → Timeout on package resolution, check network

When to Report CI/CD Context

If running in CI/CD, mention this in your diagnosis:

markdown
### Environment Context
- Running in: [GitHub Actions/Jenkins/GitLab CI/Local]
- Diagnostics adjusted for CI/CD environment

Fix Workflows

The workflows below require evidence for the specific cause before cleanup. Scope deletion and simulator changes to the affected project/device and obtain authorization for destructive actions. Large cache size alone does not prove corruption. Capture every rebuild or retest with axbuild as above; use an existing saved report first.

1. For Confirmed Abandoned Processes

Inspect exact-name PIDs, parent ownership and process state. A long-running build may still be active. Only stop confirmed task-owned abandoned processes, with authorization for destructive termination; start with TERM and verify cleanup before escalating. Never use blanket killall xcodebuild, Simulator or DeviceHub termination.

2. For Stale Derived Data / "No such module" Errors

If Derived Data is large OR user reports "No such module" OR intermittent failures:

bash
# First, find the scheme name
xcodebuild -list

# If xcodebuild -list fails, check:
# 1. Are you in the project directory? (should have .xcodeproj or .xcworkspace)
# 2. Run: ls -la | grep -E "\.xcodeproj|\.xcworkspace"
# 3. If missing, cd to correct directory
# 4. If .xcworkspace exists, use: xcodebuild -list -workspace YourApp.xcworkspace
# 5. If .xcodeproj exists, use: xcodebuild -list -project YourApp.xcodeproj

# Clean everything (use the actual scheme name from above)
xcodebuild clean -scheme <ACTUAL_SCHEME_NAME>
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf .build/ build/

# Preserve the discovered scheme and destination
"$AXBUILD" xcodebuild build -scheme "$SCHEME" -destination "$DESTINATION"

CRITICAL:

  • Use the actual scheme name from xcodebuild -list, not a placeholder
  • If xcodebuild -list fails, verify you're in the correct directory with a workspace/project file

3. For SPM Cache Issues / "No such module" with Swift Packages

If user reports "No such module" with Swift Package Manager dependencies OR packages won't resolve:

bash
# Clean SPM cache (this fixes 90% of SPM issues)
rm -rf ~/Library/Caches/org.swift.swiftpm/
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf .build/

# Reset package resolution
xcodebuild -resolvePackageDependencies -scheme <ACTUAL_SCHEME_NAME>

# Verify packages resolved
xcodebuild -list

# Rebuild
"$AXBUILD" xcodebuild build -scheme <ACTUAL_SCHEME_NAME> \
  -destination 'platform=iOS Simulator,name=iPhone 16'

When to use this:

  • "No such module" errors for Swift Package dependencies
  • Package resolution failures
  • "Package.resolved" conflicts
  • After switching git branches with different package versions

4. For Simulator Issues

If user reports "Unable to boot simulator" or simulators stuck:

bash
# Shutdown all simulators
xcrun simctl shutdown all

# List devices with JSON for reliable parsing
xcrun simctl list devices -j | jq '.devices | to_entries[] | .value[] | select(.isAvailable == true) | {name, udid, state}'

# Get UUID for a specific device (e.g., iPhone 16) using JSON
UDID=$(xcrun simctl list devices -j | jq -r '.devices | to_entries[] | .value[] | select(.name | contains("iPhone 16")) | select(.isAvailable == true) | .udid' | head -1)

if [ -z "$UDID" ]; then
  echo "No iPhone 16 simulator found. Available simulators:"
  xcrun simctl list devices -j | jq '.devices | to_entries[] | .value[] | select(.isAvailable == true) | {name, udid}'
else
  echo "iPhone 16 UUID: $UDID"
  # Erase the stuck simulator using the extracted UUID
  xcrun simctl erase "$UDID"
fi

# Find and erase all simulators stuck in Booting state
xcrun simctl list devices -j | jq -r '.devices | to_entries[] | .value[] | select(.state == "Booting") | .udid' | while read UDID; do
  echo "Erasing stuck simulator: $UDID"
  xcrun simctl erase "$UDID"
done

# Stop only an authorized, confirmed task-owned stuck device process

5. For Test Failures (No Code Changes)

If tests are failing but user hasn't changed code:

bash
# Clean Derived Data first
rm -rf ~/Library/Developer/Xcode/DerivedData/*

# Run tests again
"$AXBUILD" xcodebuild test -scheme <ACTUAL_SCHEME_NAME> \
  -destination 'platform=iOS Simulator,name=iPhone 16'

6. For Old Code Executing

If build succeeds but old code runs:

bash
# This is ALWAYS a Derived Data issue
rm -rf ~/Library/Developer/Xcode/DerivedData/*

# Force clean rebuild
"$AXBUILD" xcodebuild clean build -scheme <ACTUAL_SCHEME_NAME>

Decision Tree

Use this to determine which fix to apply:

User reports build failure
↓
Run mandatory checks (directory, processes, Derived Data, simulators)
↓
Identify issue:
├─ No project/workspace file → Report "wrong directory" to user
├─ (following checks apply if directory verified)
↓
├─ Confirmed task-owned abandoned activity → Scoped, authorized cleanup (§1)
├─ Derived Data > 10GB → Clean Derived Data + rebuild (§2)
├─ "No such module" (SPM) → Clean SPM cache + resolve packages (§3)
├─ "No such module" (local) → Clean Derived Data + rebuild (§2)
├─ Package resolution failures → Clean SPM cache (§3)
├─ Intermittent failures → Clean Derived Data + rebuild (§2)
├─ Old code executing → Clean Derived Data + rebuild (§6)
├─ "Unable to boot simulator" → Shutdown/erase simulator (§4)
├─ Tests failing (no code changes) → Clean + retest (§5)
└─ All checks clean → Surface structured compile errors (see "Running Builds"), then report "environment is clean, this is a code issue"

Output Format

Provide a clear, structured report:

markdown
## Build Failure Diagnosis Complete

### Environment Context
- Running in: [Local/GitHub Actions/Jenkins/GitLab CI/etc.]
- CI/CD detected: [yes/no]

### Environment Check Results
- Project directory: [verified/not found]
- Xcodebuild processes: [count] (oldest: [elapsed time]) (ownership/state verified or unresolved)
- Derived Data size: [size] (clean/stale)
- Simulator state: [status] (clean/stuck) (skip if CI/CD)

### Issue Identified
[Specific issue type]

### Fix Applied
1. [Command 1 with actual output]
2. [Command 2 with actual output]
3. [Command 3 with actual output]

### Verification
[Result of rebuild/retest - success or needs more work]

### Next Steps
[What user should do next]

Audit Guidelines

  1. ALWAYS run the 4 mandatory checks first - never skip (directory, processes, Derived Data, simulators)
  2. Detect CI/CD context - check for CI environment variables and adjust diagnostics
  3. Check process ownership and state - age/count alone never justify termination
  4. Use actual scheme names from xcodebuild -list - never use placeholders
  5. Handle xcodebuild -list failures - verify directory and provide recovery steps
  6. Show command output - don't just say "I ran X", show the result
  7. Verify fixes worked - run the build/test again to confirm
  8. Capture diagnostics with axbuild - inspect native status, collection issues, omissions and the retained report/log
  9. If fix doesn't work - escalate to user with specific next steps

When to Stop and Report

If you encounter:

  • Permission denied errors → Report to user
  • Xcode not installed → Report to user
  • xcodebuild -list fails (no workspace/project found) → Report to user, verify correct directory
  • Network issues preventing package resolution → Report to user
  • Workspace file corruption → Report to user (needs manual intervention)
  • All environment checks clean + fix attempts fail → Report "environment is clean, recommend systematic code debugging"

Error Pattern Recognition

Common errors and their fixes:

Error MessageFixSection
xcodebuild: error: Could not resolve package dependenciesWrong directory or Clean SPM cache§0/§3
The workspace named "X" does not contain a schemeWrong directory, verify location§0
BUILD FAILED (no details)Clean Derived Data§2
No such module: <name> (SPM package)Clean SPM cache + resolve§3
No such module: <name> (local)Clean Derived Data§2
Package resolution failedClean SPM cache§3
Unable to boot simulatorErase simulator (skip in CI/CD)§4
Command PhaseScriptExecution failedClean Derived Data§2
Multiple commands produceCheck for duplicate files (manual)-
Old code executingDelete Derived Data§6
Tests hang indefinitelyReboot simulator (or timeout in CI/CD)§4
Works locally but fails in CISPM cache or Xcode version mismatch§3/CI
Intermittent CI failuresNetwork issues, retry package downloadCI

Resources

WWDC: 2019-413 (Testing in Xcode)

Docs: /xcode/downloading-and-installing-additional-xcode-components, /xcode/troubleshooting-simulator

Tech Notes: TN2339 (Building from Command Line with Xcode)

Related

For test execution: test-runner agent For test debugging: test-debugger agent For simulator testing: simulator-tester agent For SPM conflicts: spm-conflict-resolver agent

Invocation Examples

Prompts that should launch this agent:

Explicit command: Users can also invoke this agent directly with axiom-fix-build

Scope

Automatically diagnoses and fixes Xcode build failures using environment-first diagnostics - saves 30+ minutes by checking zombie processes, Derived Data, SPM cache, and simulator state before code investigation.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Axiom Fix Build AI 技能有什么作用?

用户提到 Xcode 构建失败、构建错误或环境问题时使用。

为什么在 TypingMind 中使用 Axiom Fix Build?

因为您只需安装一次,就能搭配任何模型使用。Axiom Fix Build 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Axiom Fix Build?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-fix-build。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Axiom Fix Build?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Axiom Fix Build 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Axiom Fix Build 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Axiom Fix Build AI 技能免费吗?

是的。CharlesWiltgen 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇