Apple Foundation Models

Use this skill when working with Apple's Foundation Models framework for on-device AI and LLM capabilities in iOS/macOS apps

16 stars

Best use case

Apple Foundation Models is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use this skill when working with Apple's Foundation Models framework for on-device AI and LLM capabilities in iOS/macOS apps

Teams using Apple Foundation Models should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/apple-foundation-models/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/machine-learning/apple-foundation-models/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/apple-foundation-models/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Apple Foundation Models Compares

Feature / AgentApple Foundation ModelsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use this skill when working with Apple's Foundation Models framework for on-device AI and LLM capabilities in iOS/macOS apps

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Apple Foundation Models Skill

## When to Use This Skill

Use this skill when you need help with:

- **On-device AI**: Building iOS/macOS apps with on-device language models
- **SystemLanguageModel**: Working with Apple's on-device LLM API
- **Guided Generation**: Generating structured Swift types from prompts
- **Tool Calling**: Extending model capabilities with custom tools
- **Prompting**: Crafting effective prompts for on-device models
- **Safety**: Implementing guardrails and handling sensitive content
- **Localization**: Supporting multilingual AI features

This skill covers iOS 26.0+, iPadOS 26.0+, macOS 26.0+, and visionOS 26.0+.

## Description
Use this skill when working with Apple's Foundation Models framework for on-device AI and LLM capabilities in iOS/macOS apps. Covers SystemLanguageModel, LanguageModelSession, guided generation, tool calling, and prompting patterns.

## Quick Reference

### Core Components

### Advanced
- `Transcript`
- `Transcript.Entry`
- `Transcript.Response`
- `Transcript.ResponseFormat`
- `Transcript.Segment`
- `Transcript.StructuredSegment`

### Api Reference
- `FoundationModels`
- `GenerationID`
- `SystemLanguageModel`
- `SystemLanguageModel.Adapter`
- `SystemLanguageModel.Guardrails`
- `SystemLanguageModel.UseCase`

### Getting Started
- `SystemLanguageModel.Availability`

### Guided Generation
- `DynamicGenerationSchema`
- `Generable`
- `GenerationGuide`
- `GenerationSchema`
- `Guide`

### Localization
- `LanguageModelFeedback`

### Prompting
- `Instructions`
- `InstructionsBuilder`
- `InstructionsRepresentable`
- `LanguageModelSession`
- `LanguageModelSession.GenerationError`
- `LanguageModelSession.ToolCallError`
- `Prompt`
- `PromptBuilder`
- `PromptRepresentable`
- `Transcript.Instructions`
- `Transcript.Prompt`

### Tool Calling
- `Tool`


## Key Concepts

### Platform Support
- iOS 26.0+
- iPadOS 26.0+
- macOS 26.0+
- Mac Catalyst 26.0+
- visionOS 26.0+

### On-Device AI
All models run entirely on-device, ensuring privacy and offline capability.

## Usage Guidelines

1. Check model availability before use
2. Define clear instructions for the model's behavior
3. Use guided generation for structured outputs
4. Implement tool calling for dynamic capabilities
5. Handle errors appropriately

## Navigation

See the `references/` directory for detailed API documentation organized by category:
- `references/advanced.md` - Advanced
- `references/api_reference.md` - Api Reference
- `references/getting_started.md` - Getting Started
- `references/guided_generation.md` - Guided Generation
- `references/localization.md` - Localization
- `references/prompting.md` - Prompting
- `references/tool_calling.md` - Tool Calling


## Best Practices

- **Prompting**: Be specific and clear in your prompts
- **Instructions**: Define the model's behavior upfront
- **Safety**: Enable guardrails for sensitive content
- **Localization**: Check supported languages for your use case
- **Performance**: Use prewarm() for better response times
- **Streaming**: Use streamResponse() for real-time user feedback

## Common Patterns

### Basic Session
```swift
let model = SystemLanguageModel(useCase: .general)
let session = LanguageModelSession(model: model)
let response = try await session.respond(to: Prompt("Your question"))
```

### Guided Generation
```swift
struct Recipe: Generable {
    let title: String
    let ingredients: [String]
}

let recipe = try await session.respond(
    generating: Recipe.self,
    prompt: Prompt("Create a pasta recipe")
)
```

### Tool Calling
```swift
struct WeatherTool: Tool {
    func call(arguments: String) async throws -> String {
        // Fetch weather data
    }
}

let session = LanguageModelSession(
    model: model,
    tools: [WeatherTool()]
)
```

## Reference Documentation

For complete API details, see the categorized documentation in the `references/` directory.

Related Skills

ios-foundation-models

16
from diegosouzapw/awesome-omni-skill

Use when implementing on-device AI with Apple's Foundation Models framework — prevents context overflow, blocking UI, wrong model use cases, and manual JSON parsing when @Generable should be used. iOS 26+, macOS 26+, iPadOS 26+, ios-visionOS 26+

Creating Models

16
from diegosouzapw/awesome-omni-skill

Step-by-step guide to create a new Odoo model with fields, constraints, and methods.

analyzing-business-models

16
from diegosouzapw/awesome-omni-skill

Analyzes business models including revenue models, unit economics, competitive moats, scalability, and value creation/capture mechanisms using frameworks like Business Model Canvas and strategic analysis. Use when the user requests business model analysis, unit economics review, moat assessment, or wants to understand how a company creates and captures value.

apple-tv-troubleshooter

16
from diegosouzapw/awesome-omni-skill

Expert troubleshooting for Apple TV (tvOS) React Native development. Use when users have issues with Siri Remote, focus management, TVEventHandler, TVFocusGuideView, ScrollView not scrolling, tvOS-specific problems, parallax animations, or tvOS vs Android TV differences.

apple-reminders

16
from diegosouzapw/awesome-omni-skill

Manage Apple Reminders via the `remindctl` CLI on macOS (list, add, edit, complete, delete). Supports lists, date filters, and JSON/plain output.

apple-productivity

16
from diegosouzapw/awesome-omni-skill

Access macOS productivity apps (Calendar, Contacts, Mail, Messages, Reminders, Voice Memos). Use when user asks about calendar events, contacts, emails, iMessages, reminders, or voice transcription.

apple-health-fitness

16
from diegosouzapw/awesome-omni-skill

Query Health and Fitness data from Apple Health app including activity, workouts, heart rate, sleep, and health metrics. Use when user asks about health stats, fitness activity, workouts, sleep data, or health metrics.

apple-app-store-agent

16
from diegosouzapw/awesome-omni-skill

Comprehensive agent for preparing and generating all assets needed for Apple App Store submission. Use when user needs to prepare an iOS/iPadOS/macOS app for App Store release, including generating app metadata (descriptions, promotional text, keywords), creating app icons, designing screenshots, preparing privacy policy URLs, and organizing fastlane-compatible folder structures. Triggers on requests like "prepare my app for App Store", "create App Store screenshots", "generate app description", "make app icon", or "set up fastlane metadata".

sqlmodel-task-models

16
from diegosouzapw/awesome-omni-skill

This skill should be used when defining a robust, type-safe, and async-compatible database schema for the Todo application using SQLModel, ensuring compatibility with Better Auth and optimized for PostgreSQL.

moai-foundation-memory

16
from diegosouzapw/awesome-omni-skill

Persistent memory across sessions using MCP Memory Server for user preferences, project context, and learned patterns

defining-typescript-models

16
from diegosouzapw/awesome-omni-skill

Defines standard TypeScript interfaces for Appwrite Collections. Use when creating new models for Tours, Users, or Bookings to ensure full type safety.

applesauce-core

16
from diegosouzapw/awesome-omni-skill

This skill should be used when working with applesauce-core library for Nostr client development, including event stores, queries, observables, and client utilities. Provides comprehensive knowledge of applesauce patterns for building reactive Nostr applications.