Skip to content
Back to skills

Foundation Models On Device

ASecurity

Use when building on-device Apple Intelligence features with text generation, structured output, or tool calling. Triggers on \"foundation-models-on-device\", \"foundation models on device\", \"device\".

  • 2 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 19, 2026
ai-agentsswift

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add majinmagros/magros.ai-skills --skill foundation-models-on-device --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Foundation Models On Device?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Foundation Models On Device
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majinmagros-foundation-models-on-device/badge)](https://www.skillsdirectory.com/skills/majinmagros-foundation-models-on-device)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: foundation-models-on-device
description: "Use when building on-device Apple Intelligence features with text generation, structured output, or tool calling. Triggers on \"foundation-models-on-device\", \"foundation models on device\", \"device\"."
metadata:
  origin: ECC
---

# FoundationModels: On-Device LLM (iOS 26)

Privacy-preserving on-device LLM via Apple's FoundationModels framework. Detalhes em `references/`.

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

1. **Availability first** — check `model.availability` before any session
2. **Structured over strings** — prefer `@Generable` + `@Guide` types
3. **One request per session** — check `isResponding`, fan out sessions
4. **Chunk to 4,096 tokens** — instructions + prompt + output combined
5. **Read `.content`** — never `.output`; snapshot-stream partials to UI

## Example

```swift
let session = LanguageModelSession()
let response = try await session.respond(
  to: "Generate a cute rescue cat", generating: CatProfile.self)
print(response.content.name)
```

## References

- `references/availability-sessions.md` — availability switch, single/multi-turn, instructions, session rules
- `references/guided-generation.md` — @Generable type, structured request, @Guide constraints
- `references/tool-calling.md` — Tool definition, session with tools, ToolCallError handling
- `references/streaming-practices.md` — snapshot streaming, SwiftUI, decisions, practices, anti-patterns

## Checklist

- [ ] `model.availability` handled for all unavailability cases
- [ ] Structured output via `@Generable`, not string parsing
- [ ] `isResponding` checked; inputs fit 4,096 tokens
- [ ] Results read via `response.content`
- [ ] Offline/privacy path verified on-device

Files in this skill

  • SKILL.md2.1 KB
  • references/availability-sessions.md2 KB
  • references/guided-generation.md1.2 KB
  • references/streaming-practices.md2.7 KB
  • references/tool-calling.md1.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.