foundation-models
CommunityBuild on-device AI, avoid common LLM pitfalls.
System Documentation
What problem does it solve?
This Skill helps developers implement on-device AI with Apple's Foundation Models framework while avoiding common pitfalls like context overflow, blocking the UI, manual JSON parsing, and using the model for inappropriate tasks (e.g., world knowledge).
Core Features & Use Cases
- Anti-Pattern Prevention: Identifies and corrects common mistakes such as using the model for world knowledge, blocking the main thread, or ignoring availability checks.
- Structured Output with @Generable: Guides on using the
@Generablemacro for type-safe, guaranteed structured output, eliminating manual JSON parsing and runtime errors. - Context & Tool Management: Strategies for handling context window limits, implementing tool calling for external data, and optimizing performance with streaming and prewarming.
- Use Case: When you need to extract structured data from an invoice using the on-device model, use this skill to define an
@Generablestruct for the invoice fields, ensuring type-safe and error-free data extraction.
Quick Start
Before writing any Foundation Models code, check availability with switch SystemLanguageModel.default.availability { case .available: print("✅ Foundation Models available") case .unavailable(let reason): print("❌ Unavailable: \(reason)") } to ensure the feature can run on the user's device.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: foundation-models Download link: https://github.com/CharlesWiltgen/Axiom/archive/main.zip#foundation-models Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.