Back to Skills

foundation-models-on-device

Apple FoundationModels framework for on-device LLM — text generation, guided generation with @Generable, tool calling, and snapshot streaming in iOS 26+.

179,595stars27,697forksUpdated 5/12/2026

Security Assessment

Safe(100/100)
Security Score100/100

About foundation-models-on-device

The foundation-models-on-device skill enables developers to integrate Apple's on-device language models into iOS applications using the FoundationModels framework. It allows apps to perform text generation, structured output generation, tool calling, and snapshot streaming directly on the device. By leveraging on-device processing, this skill ensures privacy and offline functionality, removing the need for cloud connectivity while still providing advanced AI capabilities. This approach solves the challenge of creating responsive and secure AI features within apps while keeping sensitive data entirely on the user's device.

This skill supports multiple core patterns. Developers can create single-turn or multi-turn language model sessions, specify detailed instructions for the model, and define its role and style preferences. The guided generation feature with @Generable enables producing structured Swift types instead of raw text, supporting constraints like numeric ranges, array counts, and semantic guidance. Additionally, developers can implement custom tool calling, allowing the model to trigger domain-specific code or actions. Snapshot streaming facilitates real-time UI updates with structured responses. These capabilities provide a flexible and developer-friendly approach to building sophisticated AI-powered features on iOS.

Typical use cases include generating and summarizing text offline, extracting structured data from natural language input, implementing AI-driven tools for specific tasks, and maintaining user privacy. Target users are iOS developers building AI-enhanced apps, especially those who need privacy-preserving solutions or want to offer AI features without relying on cloud services. It is particularly suitable for applications in domains such as productivity, content generation, education, and personalized assistant experiences.

FAQ

Which iOS version is required to use this skill?

This skill requires iOS 26 or later to support on-device FoundationModels features.

Can the model run offline?

Yes, all processing runs on-device, so the model can generate text and structured outputs without an internet connection.

How do I check if a device supports the model?

You should perform an availability check using the model's availability property before creating a session, handling cases like device not eligible, Apple Intelligence not enabled, or model not ready.

What kinds of structured output can I generate?

You can use the @Generable annotation to define Swift types with constraints such as numeric ranges, array counts, and descriptive guidance to produce structured responses instead of raw strings.

Can the model call custom tools?

Yes, developers can define custom Tool structs that the model can invoke with structured arguments, enabling domain-specific AI actions.

Install foundation-models-on-device

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill