关于 axiom-apple-docs
axiom-apple-docs 指引开发者从 Xcode 中读取 Apple 提供的 Markdown 文档与 Swift 编译器诊断,适用于查询 API、框架行为和编译错误。它也提供文档缺失时的研究后备路径,并说明 axiom-mcp 的便捷读取方式。
主要功能
- 01路由至 Xcode 官方文档
- 02索引 Swift 编译器诊断
- 03按主题查找框架指南
- 04提供 Xcode 缺失时的后备方案
适用场景
- 01核对 Apple API 签名或行为
- 02解释 Swift 编译器诊断
- 03查找特定框架的官方指南
- 04在本地 Xcode 文档不可用时继续研究
MCP 相关
README 提及 axiom-mcp 可通过 axiom_read_skill 读取相同的 Xcode 文档,作为文件读取方式之外的便捷途径。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ charleswiltgen/ axiom --skill axiom-apple-docs安装后在 Claude Code 中输入/axiom-apple-docs确认已加载。
附带文件skills/apple-docs-research.md
详细介绍
Apple 文档路由器
Apple 在 Xcode 中附带了面向大模型的 Markdown 文档。这些是由 Apple 工程师编写的权威且最新的指南和诊断文档。直接将其作为文件读取(在 Claude Code 中使用 Read 工具)——无需 MCP 服务或特殊工具。
何时使用
- 你需要 Apple 提供的准确 API 签名或行为说明
- Axiom 技能引用了某个 Apple 框架,而你想查阅官方来源
- 你需要解释 Swift 编译器诊断
- 用户询问某项 Apple 框架功能
优先级:Axiom 技能提供带有明确倾向的指导(决策树、反模式、压力场景)。Apple 文档提供权威的 API 详情。两者应结合使用。
如何读取这些文档
Axiom 的会话上下文会注明用户切换到的 Xcode。在 Claude Code 中,它会列出实际的基础目录(“Apple for-LLM Documentation: Xcode detected at <path>”);其他宿主会注明应用(“Installed on this machine: Xcode … (<path>)”)——请用表格中的 /Applications/Xcode.app 替换为该 .app。将 <base>/<filename> 作为文件读取(在 Claude Code 中使用 Read 工具)。
默认 Xcode 位置(/Applications/Xcode.app)的基础目录:
| 内容 | 基础目录 |
|---|---|
| AdditionalDocumentation 指南 | /Applications/Xcode.app/Contents/PlugIns/IDEIntelligenceChat.framework/Versions/A/Resources/AdditionalDocumentation/ |
| Swift 编译器诊断 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/doc/swift/diagnostics/ |
Claude 应生成的调用示例:
Read /Applications/Xcode.app/Contents/PlugIns/IDEIntelligenceChat.framework/Versions/A/Resources/AdditionalDocumentation/SwiftUI-Implementing-Liquid-Glass-Design.md
这些路径假设使用默认安装位置;请改用会话上下文中的路径。没有会话上下文时:如果设置了 AXIOM_XCODE_PATH,则使用它;否则运行 xcode-select -p(它会遵循 DEVELOPER_DIR),该命令会打印 <Xcode>.app/Contents/Developer——去掉 /Contents/Developer,并将该 .app 放到上文 /Applications/Xcode.app 的位置。如果打印出 /Library/Developer/CommandLineTools,则表示未选定 Xcode;请尝试 /Applications/Xcode.app。
指南文件(AdditionalDocumentation)
共 20 个文件。使用路径模式 {guides base}/{filename} 读取。
UI 与设计
| 主题 | 文件名 |
|---|---|
| SwiftUI 中的 Liquid Glass | SwiftUI-Implementing-Liquid-Glass-Design.md |
| UIKit 中的 Liquid Glass | UIKit-Implementing-Liquid-Glass-Design.md |
| AppKit 中的 Liquid Glass | AppKit-Implementing-Liquid-Glass-Design.md |
| WidgetKit 中的 Liquid Glass | WidgetKit-Implementing-Liquid-Glass-Design.md |
| SwiftUI 新工具栏功能 | SwiftUI-New-Toolbar-Features.md |
| SwiftUI 样式化文本编辑 | SwiftUI-Styled-Text-Editing.md |
| SwiftUI WebKit 集成 | SwiftUI-WebKit-Integration.md |
| SwiftUI AlarmKit 集成 | SwiftUI-AlarmKit-Integration.md |
| Swift Charts 3D 可视化 | Swift-Charts-3D-Visualization.md |
| Foundation AttributedString 更新 | Foundation-AttributedString-Updates.md |
数据与持久化
| 主题 | 文件名 |
|---|---|
| SwiftData 类继承 | SwiftData-Class-Inheritance.md |
并发与性能
| 主题 | 文件名 |
|---|---|
| Swift 并发更新 | Swift-Concurrency-Updates.md |
| InlineArray 和 Span | Swift-InlineArray-Span.md |
Apple Intelligence
| 主题 | 文件名 |
|---|---|
| Foundation Models(设备端大模型) | FoundationModels-Using-on-device-LLM-in-your-app.md |
系统集成
| 主题 | 文件名 |
|---|---|
| App Intents 更新 | AppIntents-Updates.md |
| StoreKit 更新 | StoreKit-Updates.md |
| MapKit GeoToolbox PlaceDescriptors | MapKit-GeoToolbox-PlaceDescriptors.md |
| visionOS 小组件 | Widgets-for-visionOS.md |
辅助功能
| 主题 | 文件名 |
|---|---|
| iOS 中的辅助访问 | Implementing-Assistive-Access-in-iOS.md |
计算机视觉
| 主题 | 文件名 |
|---|---|
| iOS 中的视觉智能 | Implementing-Visual-Intelligence-in-iOS.md |
Swift 编译器诊断
诊断目录中有 46 个文件。请使用路径模式 {diagnostics base}/{filename} 阅读。
并发诊断
| 诊断 | 文件名 |
|---|---|
| 从非隔离上下文调用 Actor 隔离方法 | actor-isolated-call.md |
| 一致性隔离 | conformance-isolation.md |
| 隔离的一致性 | isolated-conformances.md |
| 默认情况下 nonisolated 不发送 | nonisolated-nonsending-by-default.md |
| Sendable 闭包捕获 | sendable-closure-captures.md |
| Sendable 元类型 | sendable-metatypes.md |
| 显式 Sendable 注解 | explicit-sendable-annotations.md |
| 发送闭包有数据竞争风险 | sending-closure-risks-data-race.md |
| 发送有数据竞争风险 | sending-risks-data-race.md |
| 可变全局变量 | mutable-global-variable.md |
| Preconcurrency 导入 | preconcurrency-import.md |
| 动态排他性 | dynamic-exclusivity.md |
| 排他性冲突 | exclusivity-violation.md |
类型系统诊断
| 诊断 | 文件名 |
|---|---|
| 存在类型 any | existential-any.md |
| 存在类型成员访问限制 | existential-member-access-limitations.md |
| 名义类型 | nominal-types.md |
| 多重继承 | multiple-inheritance.md |
| 协议类型不符合协议 | protocol-type-non-conformance.md |
| 不透明类型推断 | opaque-type-inference.md |
| 外部引用类型 | foreign-reference-type.md |
构建与迁移诊断
| 诊断 | 文件名 |
|---|---|
| 已弃用的声明 | deprecated-declaration.md |
| 未来 Swift 版本中的错误 | error-in-future-swift-version.md |
| 严格语言特性 | strict-language-features.md |
| 严格内存安全 | strict-memory-safety.md |
| 仅实现已弃用 | implementation-only-deprecated.md |
| 成员导入可见性 | member-import-visibility.md |
| 已知路径上缺少模块 | missing-module-on-known-paths.md |
| 模块不可测试 | module-not-testable.md |
| 缺少模块版本 | module-version-missing.md |
| Clang 声明导入 | clang-declaration-import.md |
| 可用性无法识别名称 | availability-unrecognized-name.md |
| 始终可用的域 | always-available-domain.md |
| 即将推出的语言特性 | upcoming-language-features.md |
| 未知警告组 | unknown-warning-group.md |
| 编译缓存 | compilation-caching.md |
| 嵌入式限制 | embedded-restrictions.md |
Swift 语言诊断
| 诊断 | 文件名 |
|---|---|
| 动态可调用要求 | dynamic-callable-requirements.md |
| 属性包装器要求 | property-wrapper-requirements.md |
| Result builder 方法 | result-builder-methods.md |
| 字符串插值一致性 | string-interpolation-conformance.md |
| 尾随闭包匹配 | trailing-closure-matching.md |
| 临时指针 | temporary-pointers.md |
| 语义复制 | semantic-copies.md |
| 性能提示 | performance-hints.md |
索引
| 诊断 | 文件名 |
|---|---|
| 诊断组(分类体系) | diagnostic-groups.md |
| 所有诊断索引 | diagnostics.md |
如果需要的诊断未列在上方,请先列出诊断目录:
ls "<Xcode>.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/doc/swift/diagnostics/"
<Xcode>.app 是应用会话上下文名称;如果没有会话上下文,请按上述方式推导。Command Line Tools 在 /Library/Developer/CommandLineTools/usr/share/doc/swift/diagnostics/ 中保留相同的文件。
文件名采用诊断的简称(小写,以连字符分隔)。
路由决策树
User question about Apple API/framework?
├── Specific compiler error/warning → Read {diagnostics base}/<diagnostic-name>.md
├── Liquid Glass implementation → Read {guides base}/<Framework>-Implementing-Liquid-Glass-Design.md
├── Swift concurrency patterns → Read {guides base}/Swift-Concurrency-Updates.md
├── Foundation Models / on-device AI → Read {guides base}/FoundationModels-Using-on-device-LLM-in-your-app.md
├── SwiftData features → Read {guides base}/SwiftData-Class-Inheritance.md
├── StoreKit / IAP → Read {guides base}/StoreKit-Updates.md
├── App Intents / Siri → Read {guides base}/AppIntents-Updates.md
├── Charts / visualization → Read {guides base}/Swift-Charts-3D-Visualization.md
├── Text editing / AttributedString → Read {guides base}/SwiftUI-Styled-Text-Editing.md or Foundation-AttributedString-Updates.md
├── WebKit in SwiftUI → Read {guides base}/SwiftUI-WebKit-Integration.md
├── Toolbar features → Read {guides base}/SwiftUI-New-Toolbar-Features.md
└── Other → ls the base directory to see what's available
Xcode 不可用时的备用方案
如果已解析的 Xcode 中没有 IDEIntelligenceChat.framework 文档目录(较旧的 Xcode,或仅安装了 Command Line Tools),请使用以下列表作为备用方案。对于 Swift 诊断,先尝试 Command Line Tools 中的副本:/Library/Developer/CommandLineTools/usr/share/doc/swift/diagnostics/。
- sosumi.ai(developer.apple.com 的 Markdown 镜像——参见
skills/apple-docs-research.md) - SDK 自带的声明——其 Swift 接口和 Objective-C 头文件(同样参见
skills/apple-docs-research.md);Command Line Tools 仅包含 macOS SDK - 建议安装最新版本的 Xcode,以完整查阅 Apple 文档
请勿悄无声息地失败——当本地没有 Xcode 文档时,告知用户,并说明你使用了哪种备用方案。
MCP 便捷路径
使用 axiom-mcp 的客户端也可以通过旧版 ID(例如 apple-guide-swiftui-implementing-liquid-glass-design)调用 axiom_read_skill。MCP 服务会读取相同的 Xcode 文件并返回相同的内容。两种路径均受支持——文件读取路径适用于所有场景;MCP 路径则便于目录搜索工作流。
研究方法
如果随附指南未涵盖相关内容——Apple 的完整 API 参考、SDK 自带的声明,或 WWDC 会议的文字稿和代码——请参见 skills/apple-docs-research.md。
资源
技能:axiom-swiftui、axiom-concurrency、axiom-data、axiom-ai、axiom-integration