foundation-models-on-device

Integrates Apple's FoundationModels framework for on-device LLM text generation in iOS apps.

1|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/aleonsa/claude-config --skill foundation-models-on-device-aleonsa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: foundation-models-on-device
Source: https://github.com/aleonsa/claude-config/tree/main/claude/skills/foundation-models-on-device
Command: npx skills add https://github.com/aleonsa/claude-config --skill foundation-models-on-device-aleonsa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables developers to integrate powerful on-device Large Language Models (LLMs) into their iOS applications, ensuring privacy and offline functionality.

Core Features & Use Cases

  • On-Device Text Generation: Generate and summarize text directly on the user's device.
  • Structured Data Output: Use @Generable to get structured Swift types instead of raw strings.
  • Tool Calling: Allow the model to invoke custom code for domain-specific actions.
  • Snapshot Streaming: Stream partially generated structured responses for real-time UI updates.
  • Use Case: Build an AI-powered note-taking app that can summarize user input and extract action items, all while keeping the data private and functional without an internet connection.

Quick Start

Check if the FoundationModels are available on the device before attempting to create a language model session.

Frequently Asked Questions about foundation-models-on-device

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use Apple's FoundationModels framework for on-device text generation in iOS?

On-device text generation in iOS uses Apple's FoundationModels framework to create a language model session directly on the device. You must check model availability before session creation to ensure offline, privacy-preserving AI features.

What is guided generation in Swift and how does it structure LLM output?

Guided generation uses the @Generable attribute in Swift to produce structured data types instead of raw strings. This ensures the on-device LLM returns parsed Swift types, enabling reliable integration of generated content into iOS applications.

Can I use Apple Intelligence models for custom tool calling in my iOS app?

Custom tool calling allows the on-device LLM to invoke your domain-specific Swift code during generation. This enables the model to execute app functions dynamically, extending Apple Intelligence capabilities beyond standard text generation.

What's the best way to stream partially generated structured responses for real-time UI updates?

Snapshot streaming provides real-time UI updates by streaming partially generated structured responses from the on-device LLM. This mechanism allows iOS applications to render text and structured data progressively as the model generates it.

Do I need iOS 26 to use the FoundationModels framework?

Yes, the FoundationModels framework requires iOS 26 or later. Developers must implement availability checks before attempting to create a language model session to prevent runtime errors on unsupported devices.

Why does my on-device LLM session fail to initialize on older iPhones?

On-device LLM session initialization fails when the device does not meet the iOS 26+ requirement or lacks Apple Intelligence support. Always perform availability checks before session creation to handle unsupported hardware gracefully.