Skip to content
Apple Foundation Models logo

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

SKILL.md

Full skill instructions

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

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

Guided Generation

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

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.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View