Agent skill · AI & Agents

foundation-models

On-device LLM integration using Apple's Foundation Models framework. Use when implementing AI text generation, structured output, or tool calling.

rshankrasgithub.com/rshankrasGitHub ↗
claude-codecan modify filesMIT
Install
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.

Facts
Files in the skill folder: 4
SKILL.md size: 26 KB
Bundled scripts: none
Allowed tools: ReadWriteEditGlobGrepBashAskUserQuestion
Path: skills/apple-intelligence/foundation-models/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 589
Language: Swift

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

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.
From the SKILL.md

# 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,

What's inside
Steps it walks through
  1. When This Skill Activates
  2. Model Fit — Check Before Building
  3. Quick Start
  4. 1. Check Availability
  5. 2. Create a Session
  6. 3. Generate Response
  7. Prompt Engineering Best Practices
  8. The Instruction Formula
  9. Instruction Components
  10. Effective Prompts
  11. Prompt Patterns
  12. Structured Output with @Generable
  13. Define Generable Types
  14. @Guide Constraints
Ships with 3 files
  • models-and-agents.md
  • safety-and-guardrails.md
  • utilities-package.md
More from claude-code-apple-skills
All skills →
About this skill
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.

Keep going