foundation-models
On-device LLM integration using Apple's Foundation Models framework. Use when implementing AI text generation, structured output, or tool calling.
npx skills add rshankras/claude-code-apple-skills --skill foundation-models --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Integrates Apple's on-device LLM into your apps to enable privacy-preserving AI features such as text generation, structured output, and tool calling.
How it works
- Provides a Quick Start with availability checks, creating a session (with optional instructions), and generating a response.
- Supports structured output via Generable types and defined schemas for recipe, itinerary, and other data structures.
- Includes a Tool Calling section that lets you define tools, specify arguments as Generable types, and call them within a session. Tool results are incorporated into the model transcript.
- Offers guidance on prompt engineering, including an Instruction Formula and components (Role, Task, Style, Safety).
- Demonstrates streaming and multi-turn conversations to maintain context across interactions.
- Includes error handling guidance for various LanguageModel and SystemLanguageModel errors across iOS 27+.
When to use it
- User wants AI text generation features
- User needs structured data from natural language
- User asks about prompting or LLM integration
- User wants to implement AI assistants or agentic features (tool loops, multi-profile sessions)
- User needs content summarization or extraction
- User asks about Private Cloud Compute, guardrails, or model safety
What it can touch
- Tools: Define and use tools in a LanguageModelSession, where tools are invoked as part of the session to fetch data or perform actions, and their outputs become part of the transcript.
Caveats
- Model is described as ~3B parameters (2-bit quantized) optimized for summarization, extraction, classification, tagging, revision, and short chat, not math, code generation, facts, or world knowledge.
- Requires reading safety-and-guardrails.md for prompts, limits, and safety stack details.
- Error handling and migration notes include deprecations and new error types introduced in iOS 27 and Xcode 27 projects (e.g., GenerationError changes).
- The content references WWDC25 and WWDC25 301 guidance for tool patterns and session lifecycle rules.
# Foundation Models Integrate Apple's on-device LLM into your apps for privacy-preserving AI features. Companion references: **safety-and-guardrails.md** (model limits, prompt design, the four-layer safety stack), **models-and-agents.md** (Private Cloud Compute, `LanguageModel` protocol, vision input, `DynamicProfile` agentic sessions — the iOS 27 wave), and **utilities-package.md** (Apple's open-source utilities package: OpenAI-compatible endpoints, just-in-time Skills, history compression). ## When This Skill Activates - User wants AI text generation features - User needs structured data from natural language - User asks about prompting or LLM integration - User wants to implement AI assistants or agentic features (tool loops, multi-profile sessions) - User needs content summarization or extraction - User asks about Private Cloud Compute, guardrails, or model safety ## Model Fit — Check Before Building The on-device model is ~3B parameters (2-bit quantized): built for **summarization, extraction, classification, tagging, revision, short chat** — not math, code generation, facts, or world knowledge (WWDC25 248). For capability boundaries, prompt-design rules, and the safety stack,
- When This Skill Activates
- Model Fit — Check Before Building
- Quick Start
- 1. Check Availability
- 2. Create a Session
- 3. Generate Response
- Prompt Engineering Best Practices
- The Instruction Formula
- Instruction Components
- Effective Prompts
- Prompt Patterns
- Structured Output with @Generable
- Define Generable Types
- @Guide Constraints
What does the foundation-models skill do?
On-device LLM integration using Apple's Foundation Models framework. Use when implementing AI text generation, structured output, or tool calling.
How do I install it?
Run `npx skills add rshankras/claude-code-apple-skills --skill foundation-models --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From rshankras/claude-code-apple-skills, a repository with 589 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
