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+.
npx skills add mturac/everything-openai-codex --skill foundation-models-on-device --agent codex
Same command for any agent — swap --agent for claude-code, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# FoundationModels: On-Device LLM (iOS 26) Patterns for integrating Apple's on-device language model into apps using the FoundationModels framework. Covers text generation, structured output with `@Generable`, custom tool calling, and snapshot streaming — all running on-device for privacy and offline support. ## When to Activate - Building AI-powered features using Apple Intelligence on-device - Generating or summarizing text without cloud dependency - Extracting structured data from natural language input - Implementing custom tool calling for domain-specific AI actions - Streaming structured responses for real-time UI updates - Need privacy-preserving AI (no data leaves the device) ## Core Pattern — Availability Check Always check model availability before creating a session: ```swift struct GenerativeView: View { private var model = SystemLanguageModel.default var body: some View { switch model.availability { case .available: ContentView() case .unavailable(.deviceNotEligible): Text("Device not eligible for Apple Intelligence") case .unavailable(.appleIntelligenceNotEnabled): Text("Please enable Apple Intelligence in Settings") case .unavailable(.modelNotReady): Text("Model is d
- When to Activate
- Core Pattern — Availability Check
- Core Pattern — Basic Session
- Core Pattern — Guided Generation with @Generable
- 1. Define a Generable Type
- 2. Request Structured Output
- Supported @Guide Constraints
- Core Pattern — Tool Calling
- 1. Define a Tool
- 2. Create Session with Tools
- 3. Handle Tool Errors
- Core Pattern — Snapshot Streaming
- SwiftUI Integration
- Key Design Decisions
What does the foundation-models-on-device skill do?
Apple FoundationModels framework for on-device LLM — text generation, guided generation with @Generable, tool calling, and snapshot streaming in iOS 26+.
How do I install it?
Run `npx skills add mturac/everything-openai-codex --skill foundation-models-on-device --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 mturac/everything-openai-codex, a repository with 84 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.
