foundation-models

Community

Build on-device AI, avoid common LLM pitfalls.

AuthorCharlesWiltgen
Version1.0.0
Installs0

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 @Generable macro 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 @Generable struct 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 required

Components

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.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.