Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
johnrogers avatar

Foundation Models

  • 142 installs
  • 222 repo stars
  • Updated January 18, 2026
  • johnrogers/claude-swift-engineering

Integrate Apple Foundation Models on-device for summarization, classification, and guided generation inside Swift/iOS apps with privacy-preserving AI features.

About

Foundation-models skill documents Swift patterns for Apple’s on-device LLM stack: checking model availability, structuring prompts and sessions, streaming responses in UI, combining generative tools with app state, and shipping features that stay on-device without cloud inference.

  • Apple Foundation Models API
  • On-device inference flows
  • Prompt and session design
  • Tool-use with SwiftUI
  • Privacy-first AI features

Foundation Models by the numbers

  • 142 all-time installs (skills.sh)
  • +2 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #3,485 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/johnrogers/claude-swift-engineering --skill foundation-models

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs142
repo stars222
Last updatedJanuary 18, 2026
Repositoryjohnrogers/claude-swift-engineering

What it does

Integrate Apple Foundation Models on-device for summarization, classification, and guided generation inside Swift/iOS apps with privacy-preserving AI features.

Files

SKILL.mdMarkdownGitHub ↗

Foundation Models

Apple's on-device AI framework providing access to a 3B parameter language model for summarization, extraction, classification, and content generation. Runs entirely on-device with no network required.

Overview

Foundation Models enable intelligent text processing directly on device without server round-trips, user data sharing, or network dependencies. The core principle: leverage on-device AI for specific, contained tasks (not for general knowledge).

Reference Loading Guide

ALWAYS load reference files if there is even a small chance the content may be required. It's better to have the context than to miss a pattern or make a mistake.

ReferenceLoad When
[Getting Started](references/getting-started.md)Setting up LanguageModelSession, checking availability, basic prompts
[Structured Output](references/structured-output.md)Using @Generable for type-safe responses, @Guide constraints
[Tool Calling](references/tool-calling.md)Integrating external data (weather, contacts, MapKit) via Tool protocol
[Streaming](references/streaming.md)AsyncSequence for progressive UI updates, PartiallyGenerated types
[Troubleshooting](references/troubleshooting.md)Context overflow, guardrails, errors, anti-patterns

Core Workflow

1. Check availability with SystemLanguageModel.default.availability 2. Create LanguageModelSession with optional instructions 3. Choose output type: plain String or @Generable struct 4. Use streaming for long generations (>1 second) 5. Handle errors: context overflow, guardrails, unsupported language

Model Capabilities

Use CaseFoundation Models?Alternative
SummarizationYes-
Extraction (key info)Yes-
ClassificationYes-
Content taggingYes (built-in adapter)-
World knowledgeNoChatGPT, Claude, Gemini
Complex reasoningNoServer LLMs

Platform Requirements

  • iOS 26+, macOS 26+, iPadOS 26+, visionOS 26+
  • Apple Intelligence-enabled device (iPhone 15 Pro+, M1+ iPad/Mac)
  • User opted into Apple Intelligence

Common Mistakes

1. Using Foundation Models for world knowledge — The 3B model is trained for on-device tasks only. It won't know current events, specific facts, or "who is X". Use ChatGPT/Claude for that. Keep prompts to: summarizing user's own content, extracting info, classifying text.

2. Blocking the main thread — LanguageModelSession calls must run on a background thread or async context. Blocking the main thread locks UI. Always use Task { } or background queue.

3. Ignoring context overflow — The model has finite context. If the user pastes a 50KB document, it will fail silently or truncate. Check input length and trim/truncate proactively.

4. Forgetting to check availability — Not all devices support Foundation Models. Check SystemLanguageModel.default.availability before using. Graceful degradation is required.

5. Ignoring guardrails — The model won't answer harmful queries. Instead of fighting it, design prompts that respect safety guidelines. Rephrasing requests usually works.

Related skills

AI & Agent Buildingagentsllmautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.