axiom-ai

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Apple Intelligence & AI

Apple Intelligence与AI

You MUST use this skill for ANY Apple Intelligence or Foundation Models work.
任何涉及Apple Intelligence或Foundation Models的工作都必须使用此技能。

When to Use

使用场景

Use this router when:
  • Implementing Apple Intelligence features
  • Using Foundation Models
  • Working with LanguageModelSession
  • Generating structured output with @Generable
  • Debugging AI generation issues
  • iOS 26 on-device AI
在以下场景中使用此路由:
  • 实现Apple Intelligence功能
  • 使用Foundation Models
  • 开发LanguageModelSession相关功能
  • 通过@Generable生成结构化输出
  • 调试AI生成相关问题
  • iOS 26设备端AI开发

AI Approach Triage

AI方法分流

First, determine which kind of AI the developer needs:
Developer IntentRoute To
On-device text generation (Apple Intelligence)Stay here → Foundation Models skills
Custom ML model deployment (PyTorch, TensorFlow)See skills/ios-ml.md → CoreML conversion, compression
Computer vision (image analysis, OCR, segmentation)/skill axiom-vision → Vision framework
Cloud API integration (OpenAI, etc.)/skill axiom-networking → URLSession patterns
System AI features (Writing Tools, Genmoji)No custom code needed — these are system-provided
Key boundary: Foundation Models vs ML (custom models)
  • Foundation Models = Apple's on-device LLM framework (LanguageModelSession, @Generable)
  • ML = Custom model deployment (CoreML conversion, quantization, MLTensor, speech-to-text)
  • If developer says "run my own model" → skills/ios-ml.md. If "use Apple Intelligence" → stay here.
首先,确定开发者需要的AI类型:
开发者需求路由至
设备端文本生成(Apple Intelligence)留在此处 → Foundation Models技能
自定义ML模型部署(PyTorch、TensorFlow)查看skills/ios-ml.md → CoreML转换、压缩
计算机视觉(图像分析、OCR、分割)/skill axiom-vision → Vision框架
云API集成(OpenAI等)/skill axiom-networking → URLSession模式
系统AI功能(写作工具、Genmoji)无需自定义代码——这些是系统自带功能
关键边界:Foundation Models vs ML(自定义模型)
  • Foundation Models = 苹果的设备端LLM框架(LanguageModelSession、@Generable)
  • ML = 自定义模型部署(CoreML转换、量化、MLTensor、语音转文本)
  • 如果开发者提到“运行我自己的模型” → 查看skills/ios-ml.md。如果是“使用Apple Intelligence” → 留在此处。

Cross-Domain Routing

跨域路由

Foundation Models + concurrency (session blocking main thread, UI freezes):
  • Foundation Models sessions are async — blocking likely means missing
    await
    or running on @MainActor
  • Fix here first using async session patterns in foundation-models skill
  • If concurrency issue is broader than Foundation Models → also invoke axiom-concurrency
Foundation Models + data (@Generable decoding errors, structured output issues):
  • @Generable output problems are Foundation Models-specific, NOT generic Codable issues
  • Stay here → foundation-models-diag handles structured output debugging
  • If developer also has general Codable/serialization questions → also invoke axiom-data
Foundation Models + 并发(会话阻塞主线程、UI冻结):
  • Foundation Models会话是异步的——阻塞可能意味着缺少
    await
    或在@MainActor上运行
  • 首先在此修复,使用foundation-models技能中的异步会话模式
  • 如果并发问题超出Foundation Models范畴 → 同时调用axiom-concurrency
Foundation Models + 数据(@Generable解码错误、结构化输出问题):
  • @Generable输出问题是Foundation Models特有的,而非通用Codable问题
  • 留在此处 → foundation-models-diag处理结构化输出调试
  • 如果开发者同时有通用Codable/序列化问题 → 同时调用axiom-data

Routing Logic

路由逻辑

Foundation Models Work

Foundation Models开发

Implementation patterns
skills/foundation-models.md
  • LanguageModelSession basics
  • @Generable structured output
  • Tool protocol integration
  • Streaming with PartiallyGenerated
  • Dynamic schemas
  • 26 WWDC code examples
API reference
skills/foundation-models-ref.md
  • Complete API documentation
  • All @Generable examples
  • Tool protocol patterns
  • Streaming generation patterns
Diagnostics
skills/foundation-models-diag.md
  • AI response blocked
  • Generation slow
  • Guardrail violations
  • Context limits exceeded
  • Model unavailable
Automated scanning → Launch
foundation-models-auditor
agent or
/axiom:audit foundation-models
(missing availability checks, main thread blocking, manual JSON parsing, session lifecycle issues)
实现模式
skills/foundation-models.md
  • LanguageModelSession基础
  • @Generable结构化输出
  • Tool协议集成
  • 使用PartiallyGenerated进行流式处理
  • 动态 schema
  • 26届WWDC代码示例
API参考
skills/foundation-models-ref.md
  • 完整API文档
  • 所有@Generable示例
  • Tool协议模式
  • 流式生成模式
诊断
skills/foundation-models-diag.md
  • AI响应被拦截
  • 生成速度慢
  • 违反防护规则
  • 超出上下文限制
  • 模型不可用
自动化扫描 → 启动
foundation-models-auditor
代理或执行
/axiom:audit foundation-models
(检查缺失的可用性检测、主线程阻塞、手动JSON解析、会话生命周期问题)

Decision Tree

决策树

  1. Custom ML model / CoreML / PyTorch conversion? → See skills/ios-ml.md
  2. Computer vision / image analysis / OCR? → /skill axiom-vision
  3. Cloud AI API integration? → /skill axiom-networking
  4. Implementing Foundation Models / @Generable / Tool protocol? → foundation-models
  5. Need API reference / code examples? → foundation-models-ref
  6. Debugging AI issues (blocked, slow, guardrails)? → foundation-models-diag
  7. Foundation Models + UI freezing? → foundation-models (async patterns) + also invoke axiom-concurrency if needed
  8. Want automated Foundation Models code scan? → foundation-models-auditor (Agent)
  1. 自定义ML模型/CoreML/PyTorch转换? → 查看skills/ios-ml.md
  2. 计算机视觉/图像分析/OCR? → /skill axiom-vision
  3. 云AI API集成? → /skill axiom-networking
  4. 实现Foundation Models/@Generable/Tool协议? → foundation-models
  5. 需要API参考/代码示例? → foundation-models-ref
  6. 调试AI问题(拦截、缓慢、防护规则)? → foundation-models-diag
  7. Foundation Models + UI冻结? → foundation-models(异步模式)+ 必要时同时调用axiom-concurrency
  8. 想要自动化Foundation Models代码扫描? → foundation-models-auditor(Agent)

Anti-Rationalization

误区纠正

ThoughtReality
"Foundation Models is just LanguageModelSession"Foundation Models has @Generable, Tool protocol, streaming, and guardrails. foundation-models covers all.
"I'll figure out the AI patterns as I go"AI APIs have specific error handling and fallback requirements. foundation-models prevents runtime failures.
"I've used LLMs before, this is similar"Apple's on-device models have unique constraints (guardrails, context limits). foundation-models is Apple-specific.
错误想法实际情况
"Foundation Models只是LanguageModelSession"Foundation Models包含@Generable、Tool协议、流式处理和防护规则。foundation-models技能涵盖所有这些内容。
"我会边做边摸索AI模式"AI API有特定的错误处理和回退要求。foundation-models技能可防止运行时故障。
"我之前用过LLM,这个类似"苹果的设备端模型有独特的限制(防护规则、上下文限制)。foundation-models是苹果专属的技能。

Critical Patterns

关键模式

foundation-models:
  • LanguageModelSession setup
  • @Generable for structured output
  • Tool protocol for function calling
  • Streaming generation
  • Dynamic schema evolution
foundation-models-diag:
  • Blocked response handling
  • Performance optimization
  • Guardrail violations
  • Context management
foundation-models
  • LanguageModelSession设置
  • 使用@Generable实现结构化输出
  • Tool协议用于函数调用
  • 流式生成
  • 动态schema演进
foundation-models-diag
  • 拦截响应处理
  • 性能优化
  • 防护规则违规处理
  • 上下文管理

Example Invocations

调用示例

User: "How do I use Apple Intelligence to generate structured data?" → Read:
skills/foundation-models.md
User: "My AI generation is being blocked" → Read:
skills/foundation-models-diag.md
User: "Show me @Generable examples" → Read:
skills/foundation-models-ref.md
User: "Implement streaming AI generation" → Read:
skills/foundation-models.md
User: "I want to add AI to my app" → First ask: Apple Intelligence (Foundation Models) or custom ML model? Route accordingly.
User: "My Foundation Models session is blocking the UI" → Read:
skills/foundation-models.md
(async patterns) + also invoke
axiom-concurrency
if needed
User: "Review my Foundation Models code for issues" → Invoke:
foundation-models-auditor
agent
User: "I want to run my PyTorch model on device" → Read:
skills/ios-ml.md
(CoreML conversion, not Foundation Models)
用户:"如何使用Apple Intelligence生成结构化数据?" → 查阅:
skills/foundation-models.md
用户:"我的AI生成被拦截了" → 查阅:
skills/foundation-models-diag.md
用户:"展示@Generable示例" → 查阅:
skills/foundation-models-ref.md
用户:"实现流式AI生成" → 查阅:
skills/foundation-models.md
用户:"我想给我的应用添加AI功能" → 首先询问:是Apple Intelligence(Foundation Models)还是自定义ML模型?然后相应路由。
用户:"我的Foundation Models会话阻塞了UI" → 查阅:
skills/foundation-models.md
(异步模式)+ 必要时同时调用
axiom-concurrency
用户:"检查我的Foundation Models代码是否有问题" → 调用:
foundation-models-auditor
代理
用户:"我想在设备上运行我的PyTorch模型" → 查阅:
skills/ios-ml.md
(CoreML转换,不属于Foundation Models)