Agent skill · software engineering · affaan-m
foundation-models-on-device
デバイス上基盤モデルの実装パターン、量子化、最適化、およびプライバシーを考慮した推論。
Why this skill is useful
Provides specific implementation patterns and code examples for integrating on-device language models in iOS apps, which the AI wouldn't reliably generate on its own.
What it needs
Requires xcode installed locally. About 4k tokens when loaded. Last updated 2026-08-06. 238,342 stars on the source repository.
What this skill does
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: Core Pattern — Basic Session Key points for instructions: Define the model's role ("You are a mentor") Specify what to do ("Help extract calendar events") Set style preferences ("Respond as briefly as possible") Add safety measures ("Respond with 'I can't help with that' for dangerous requests") Core Pattern — Guided Generation with @Generable Generate structured Swift types instead of raw strings: 1. Define a Generable Type 2. Request Structured Output Supported @Guide Constraints .range(0...20) — numeric range .count(3) — array element count description: — semantic guidance for generation Core Pattern — Tool Calling Let the model invoke custom code for domain-specific tasks: 1. Define a Tool 2. Create Session with Tools 3. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills affaan-m/foundation-models-on-device