axiom-build-debugging by charleswiltgen/axiom
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-build-debugging在指责代码之前,先检查依赖项。核心原则:80% 的持续构建失败是依赖项解析问题(CocoaPods、SPM、框架冲突),而不是代码错误。
这些是开发者提出的真实问题,本技能旨在回答:
→ 本技能涵盖 SPM 解析工作流程、包缓存清理和框架搜索路径诊断
→ 本技能展示如何识别重复的目标成员资格以及解决构建设置中的文件冲突
→ 本技能涵盖 Podfile.lock 冲突解决、链接错误和版本约束调试
→ 本技能解释依赖项缓存差异、特定环境路径和可重现的构建策略
→ 本技能演示针对复杂依赖树的依赖图分析和版本约束解决策略
如果你看到以下任何情况,请怀疑是依赖项问题:
Build failing?
├─ "No such module XYZ"?
│ ├─ After adding SPM package?
│ │ └─ Clean build folder + reset package caches
│ ├─ After pod install?
│ │ └─ Check Podfile.lock conflicts
│ └─ Framework not found?
│ └─ Check FRAMEWORK_SEARCH_PATHS
├─ "Multiple commands produce"?
│ └─ Duplicate files in target membership
├─ SPM resolution hangs?
│ └─ Clear package caches + derived data
└─ Version conflicts?
└─ Use dependency resolution strategies below
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
症状:添加 Swift Package 后出现 "No such module PackageName"
❌ 错误做法:
# Rebuilding without cleaning
xcodebuild build
✅ 正确做法:
# Reset package caches first
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Caches/org.swift.swiftpm
# Reset packages in project
xcodebuild -resolvePackageDependencies
# Clean build
xcodebuild clean build -scheme YourScheme
症状:Pod install 成功,但构建因框架错误而失败
检查 Podfile.lock:
# See what versions were actually installed
cat Podfile.lock | grep -A 2 "PODS:"
# Compare with Podfile requirements
cat Podfile | grep "pod "
修复版本冲突:
# Podfile - be explicit about versions
pod 'Alamofire', '~> 5.8.0' # Not just 'Alamofire'
pod 'SwiftyJSON', '5.0.1' # Exact version if needed
清理并重新安装:
# Remove all pods
rm -rf Pods/
rm Podfile.lock
# Reinstall
pod install
# Open workspace (not project!)
open YourApp.xcworkspace
症状:"Multiple commands produce '/path/to/file'"
原因:同一文件被添加到多个目标或构建阶段
修复方法:
症状:"Framework not found" 或 "Linker command failed"
检查构建设置:
# Show all build settings
xcodebuild -showBuildSettings -scheme YourScheme | grep FRAMEWORK_SEARCH_PATHS
在 Xcode 中修复:
$(PROJECT_DIR)/Frameworks (递归)$(inherited) 以从项目继承症状:包解析因版本冲突而失败
查看依赖关系图:
# In project directory
swift package show-dependencies
# Or see resolved versions
cat Package.resolved
修复冲突:
// Package.swift - be explicit
.package(url: "https://github.com/owner/repo", exact: "1.2.3") // Exact version
.package(url: "https://github.com/owner/repo", from: "1.2.0") // Minimum version
.package(url: "https://github.com/owner/repo", .upToNextMajor(from: "1.0.0")) // SemVer
重置解析:
# Clear package caches
rm -rf .build
rm Package.resolved
# Re-resolve
swift package resolve
当稳定性比最新功能更重要时:
CocoaPods:
pod 'Alamofire', '5.8.0' # Exact version
pod 'SwiftyJSON', '~> 5.0.0' # Any 5.0.x
SPM:
.package(url: "...", exact: "1.2.3")
当你想要错误修复但不想要破坏性更改时:
CocoaPods:
pod 'Alamofire', '~> 5.8' # 5.8.x but not 5.9
pod 'SwiftyJSON', '>= 5.0', '< 6.0' # Range
SPM:
.package(url: "...", from: "1.2.0") // 1.2.0 and higher
.package(url: "...", .upToNextMajor(from: "1.0.0")) // 1.x.x but not 2.0.0
当你需要自定义修改时:
# Fork repo on GitHub
# Clone your fork
git clone https://github.com/yourname/package.git
# In Package.swift, use your fork
.package(url: "https://github.com/yourname/package", branch: "custom-fixes")
当依赖项的依赖项发生冲突时:
SPM(不支持直接排除,使用变通方法):
// Instead of this:
.package(url: "https://github.com/problematic/package")
// Fork it and remove the conflicting dependency from its Package.swift
CocoaPods:
# Exclude specific subspecs
pod 'Firebase/Core' # Not all of Firebase
pod 'Firebase/Analytics'
症状:在 Debug 下构建成功,在 Release 下失败(或反之)
检查优化设置:
# Compare Debug and Release settings
xcodebuild -showBuildSettings -configuration Debug > debug.txt
xcodebuild -showBuildSettings -configuration Release > release.txt
diff debug.txt release.txt
常见原因:
使用 CocoaPods 时始终打开工作区:
# ❌ WRONG
open YourApp.xcodeproj
# ✅ CORRECT
open YourApp.xcworkspace
检查你正在构建的是哪个:
# For workspace
xcodebuild -workspace YourApp.xcworkspace -scheme YourScheme build
# For project only (no CocoaPods)
xcodebuild -project YourApp.xcodeproj -scheme YourScheme build
在截止日期压力下,高级工程师和团队成员会根据模式匹配提供"快速修复":
这些建议听起来很安全,因为它们来自经验。但如果诊断错误,修复会浪费你本就不多的时间。
关键洞察:时间压力会使权威偏见更强。在压力下,你更可能相信建议。
如果你听到以下任何一句话,在执行前暂停 5 分钟:
压力下的大脑:相信这些短语,因为它们听起来很自信。不会问"但他们有证据证明这是根本原因吗?"
当有经验的人在时间压力下建议修复时:
"I understand the pressure. Before we regenerate lock files,
can we spend 5 minutes comparing the broken build to our
working build? I want to know what we're fixing."
If we try "pod install":
- Time to execute: 10 minutes
- Time to learn it failed: 24 hours (next submission cycle)
- Remaining time if it fails: 6 days
- Alternative: Spend 1-2 hours diagnosing first
Cost of being wrong with quick fix: High
Cost of spending 1 hour on diagnosis: Low
"I want to move fast too. A 1-hour diagnosis now means we
won't waste another 24-hour cycle. Let's document what we're
testing before we submit."
场景:App 在 App Store 构建中被拒绝,在本地通过。
高级工程师说:"重新生成 lock 文件并重新提交(有 7 天缓冲期)"
Local build that works:
- Pod versions in Podfile.lock: [list them]
- Xcode version: [version]
- Derived Data: [timestamp]
- CocoaPods version: [version]
App Store build that fails:
- Pod versions used: [from error message]
- Build system: [App Store's environment]
- Differences: [explicitly document]
节省的时间:24 小时的浪费迭代。
快速修复仅在以下情况下是安全的:
# ❌ BAD: .gitignore includes lockfiles
Podfile.lock
Package.resolved
原因:团队成员获得不同的版本,构建结果不同
# ❌ BAD: No version specified
pod 'Alamofire'
原因:依赖项更新时出现破坏性更改
Project uses both:
- CocoaPods (Podfile)
- Carthage (Cartfile)
- SPM (Package.swift)
原因:冲突不可避免,选择一个主要的包管理器
# ❌ BAD: Just rebuild
xcodebuild build
# ✅ GOOD: Clean first
xcodebuild clean build
使用 CocoaPods 时,始终打开 .xcworkspace 而不是 .xcodeproj
# CocoaPods
pod install # Install dependencies
pod update # Update to latest versions
pod update PodName # Update specific pod
pod outdated # Check for updates
pod deintegrate # Remove CocoaPods from project
# Swift Package Manager
swift package resolve # Resolve dependencies
swift package update # Update dependencies
swift package show-dependencies # Show dependency tree
swift package reset # Reset package cache
xcodebuild -resolvePackageDependencies # Xcode's SPM resolve
# Carthage
carthage update # Update dependencies
carthage bootstrap # Download pre-built frameworks
carthage build --platform iOS # Build for specific platform
# Xcode Build
xcodebuild clean # Clean build folder
xcodebuild -list # List schemes and targets
xcodebuild -showBuildSettings # Show all build settings
之前(依赖项试错):
之后(系统化的依赖项管理):
关键洞察:尽早锁定依赖项版本。灵活性带来的问题比它解决的更多。
文档:swift.org/package-manager, /xcode/build-system
GitHub:Carthage/Carthage
技能:axiom-xcode-debugging
历史记录: 查看 git log 了解更改
每周安装次数
102
代码仓库
GitHub 星标数
610
首次出现
Jan 21, 2026
安全审计
安装于
opencode86
codex80
gemini-cli79
claude-code79
cursor76
github-copilot73
Check dependencies BEFORE blaming code. Core principle 80% of persistent build failures are dependency resolution issues (CocoaPods, SPM, framework conflicts), not code bugs.
These are real questions developers ask that this skill is designed to answer:
→ The skill covers SPM resolution workflows, package cache clearing, and framework search path diagnostics
→ The skill shows how to identify duplicate target membership and resolve file conflicts in build settings
→ The skill covers Podfile.lock conflict resolution, linking errors, and version constraint debugging
→ The skill explains dependency caching differences, environment-specific paths, and reproducible build strategies
→ The skill demonstrates dependency graph analysis and version constraint resolution strategies for complex dependency trees
If you see ANY of these, suspect dependency problem:
Build failing?
├─ "No such module XYZ"?
│ ├─ After adding SPM package?
│ │ └─ Clean build folder + reset package caches
│ ├─ After pod install?
│ │ └─ Check Podfile.lock conflicts
│ └─ Framework not found?
│ └─ Check FRAMEWORK_SEARCH_PATHS
├─ "Multiple commands produce"?
│ └─ Duplicate files in target membership
├─ SPM resolution hangs?
│ └─ Clear package caches + derived data
└─ Version conflicts?
└─ Use dependency resolution strategies below
Symptom : "No such module PackageName" after adding Swift Package
❌ WRONG :
# Rebuilding without cleaning
xcodebuild build
✅ CORRECT :
# Reset package caches first
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Caches/org.swift.swiftpm
# Reset packages in project
xcodebuild -resolvePackageDependencies
# Clean build
xcodebuild clean build -scheme YourScheme
Symptom : Pod install succeeds but build fails with framework errors
Check Podfile.lock :
# See what versions were actually installed
cat Podfile.lock | grep -A 2 "PODS:"
# Compare with Podfile requirements
cat Podfile | grep "pod "
Fix version conflicts :
# Podfile - be explicit about versions
pod 'Alamofire', '~> 5.8.0' # Not just 'Alamofire'
pod 'SwiftyJSON', '5.0.1' # Exact version if needed
Clean reinstall :
# Remove all pods
rm -rf Pods/
rm Podfile.lock
# Reinstall
pod install
# Open workspace (not project!)
open YourApp.xcworkspace
Symptom : "Multiple commands produce '/path/to/file'"
Cause : Same file added to multiple targets or build phases
Fix :
Symptom : "Framework not found" or "Linker command failed"
Check build settings :
# Show all build settings
xcodebuild -showBuildSettings -scheme YourScheme | grep FRAMEWORK_SEARCH_PATHS
Fix in Xcode :
$(PROJECT_DIR)/Frameworks (recursive)$(inherited) to inherit from projectSymptom : Package resolution fails with version conflicts
See dependency graph :
# In project directory
swift package show-dependencies
# Or see resolved versions
cat Package.resolved
Fix conflicts :
// Package.swift - be explicit
.package(url: "https://github.com/owner/repo", exact: "1.2.3") // Exact version
.package(url: "https://github.com/owner/repo", from: "1.2.0") // Minimum version
.package(url: "https://github.com/owner/repo", .upToNextMajor(from: "1.0.0")) // SemVer
Reset resolution :
# Clear package caches
rm -rf .build
rm Package.resolved
# Re-resolve
swift package resolve
When stability matters more than latest features:
CocoaPods :
pod 'Alamofire', '5.8.0' # Exact version
pod 'SwiftyJSON', '~> 5.0.0' # Any 5.0.x
SPM :
.package(url: "...", exact: "1.2.3")
When you want bug fixes but not breaking changes:
CocoaPods :
pod 'Alamofire', '~> 5.8' # 5.8.x but not 5.9
pod 'SwiftyJSON', '>= 5.0', '< 6.0' # Range
SPM :
.package(url: "...", from: "1.2.0") // 1.2.0 and higher
.package(url: "...", .upToNextMajor(from: "1.0.0")) // 1.x.x but not 2.0.0
When you need custom modifications:
# Fork repo on GitHub
# Clone your fork
git clone https://github.com/yourname/package.git
# In Package.swift, use your fork
.package(url: "https://github.com/yourname/package", branch: "custom-fixes")
When a dependency's dependency conflicts:
SPM (not directly supported, use workarounds) :
// Instead of this:
.package(url: "https://github.com/problematic/package")
// Fork it and remove the conflicting dependency from its Package.swift
CocoaPods :
# Exclude specific subspecs
pod 'Firebase/Core' # Not all of Firebase
pod 'Firebase/Analytics'
Symptom : Builds in Debug, fails in Release (or vice versa)
Check optimization settings :
# Compare Debug and Release settings
xcodebuild -showBuildSettings -configuration Debug > debug.txt
xcodebuild -showBuildSettings -configuration Release > release.txt
diff debug.txt release.txt
Common culprits :
Always open workspace with CocoaPods :
# ❌ WRONG
open YourApp.xcodeproj
# ✅ CORRECT
open YourApp.xcworkspace
Check which you're building :
# For workspace
xcodebuild -workspace YourApp.xcworkspace -scheme YourScheme build
# For project only (no CocoaPods)
xcodebuild -project YourApp.xcodeproj -scheme YourScheme build
Under deadline pressure, senior engineers and teammates provide "quick fixes" based on pattern-matching:
These feel safe because they come from experience. But if the diagnosis is wrong, the fix wastes time you don't have.
Critical insight Time pressure makes authority bias STRONGER. You're more likely to trust advice when stressed.
If you hear ANY of these, pause 5 minutes before executing:
Your brain under pressure Trusts these phrases because they sound confident. Doesn't ask "but do they have evidence THIS is the root cause?"
When someone senior suggests a fix under time pressure:
"I understand the pressure. Before we regenerate lock files,
can we spend 5 minutes comparing the broken build to our
working build? I want to know what we're fixing."
If we try "pod install":
- Time to execute: 10 minutes
- Time to learn it failed: 24 hours (next submission cycle)
- Remaining time if it fails: 6 days
- Alternative: Spend 1-2 hours diagnosing first
Cost of being wrong with quick fix: High
Cost of spending 1 hour on diagnosis: Low
"I want to move fast too. A 1-hour diagnosis now means we
won't waste another 24-hour cycle. Let's document what we're
testing before we submit."
Scenario App rejected in App Store build, passes locally.
Senior says "Regenerate lock file and resubmit (7 days buffer)"
Local build that works:
- Pod versions in Podfile.lock: [list them]
- Xcode version: [version]
- Derived Data: [timestamp]
- CocoaPods version: [version]
App Store build that fails:
- Pod versions used: [from error message]
- Build system: [App Store's environment]
- Differences: [explicitly document]
Time saved 24 hours of wasted iteration.
Quick fixes are safe ONLY when:
# ❌ BAD: .gitignore includes lockfiles
Podfile.lock
Package.resolved
Why : Team members get different versions, builds differ
# ❌ BAD: No version specified
pod 'Alamofire'
Why : Breaking changes when dependency updates
Project uses both:
- CocoaPods (Podfile)
- Carthage (Cartfile)
- SPM (Package.swift)
Why : Conflicts are inevitable, pick one primary manager
# ❌ BAD: Just rebuild
xcodebuild build
# ✅ GOOD: Clean first
xcodebuild clean build
When using CocoaPods, always open .xcworkspace not .xcodeproj
# CocoaPods
pod install # Install dependencies
pod update # Update to latest versions
pod update PodName # Update specific pod
pod outdated # Check for updates
pod deintegrate # Remove CocoaPods from project
# Swift Package Manager
swift package resolve # Resolve dependencies
swift package update # Update dependencies
swift package show-dependencies # Show dependency tree
swift package reset # Reset package cache
xcodebuild -resolvePackageDependencies # Xcode's SPM resolve
# Carthage
carthage update # Update dependencies
carthage bootstrap # Download pre-built frameworks
carthage build --platform iOS # Build for specific platform
# Xcode Build
xcodebuild clean # Clean build folder
xcodebuild -list # List schemes and targets
xcodebuild -showBuildSettings # Show all build settings
Before (trial-and-error with dependencies):
After (systematic dependency management):
Key insight Lock down dependency versions early. Flexibility causes more problems than it solves.
Docs : swift.org/package-manager, /xcode/build-system
GitHub : Carthage/Carthage
Skills : axiom-xcode-debugging
History: See git log for changes
Weekly Installs
102
Repository
GitHub Stars
610
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
opencode86
codex80
gemini-cli79
claude-code79
cursor76
github-copilot73
Next.js服务端与客户端组件选择指南:TypeScript最佳实践与性能优化
135 周安装
项目会话管理器 (PSM) - 使用 Git Worktrees 和 Tmux 自动化隔离开发环境
135 周安装
Memory技能:统一知识图谱记忆管理工具 - 搜索、加载、可视化决策历史
135 周安装
AI会议纪要生成器 - 自动转录稿转结构化纪要,支持发言人识别与多轮审查
135 周安装
Flutter 表单验证教程:使用 Form、TextFormField 和 GlobalKey 实现高效验证
135 周安装
游戏安全逆向工程工具大全:调试、反编译、内存分析与反作弊绕过
135 周安装