Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

local-ai-models

БесплатноБез исполняемых скриптовНе проверен

WHEN building iOS features on on-device models with Foundation Models or MLX Swift: local LLM inference, chat, Vision Language Models (VLMs), text embeddings…

mintuzот mintuz★ 38 звёзд на GitHub

Об этом скилле

iOS On-Device AI Models

On-device AI in iOS apps with Apple's Foundation Models framework and MLX Swift.

Core Principles

  1. Compatibility Gate - Foundation Models requires iOS 26, iPadOS 26, or macOS 26 or later, on an Apple Intelligence-capable device with Apple Intelligence enabled. Before you select a framework, compare this floor with the deployment target and with every device the feature must support. A runtime check reports one device's state; it cannot make the feature available below the OS or device floor. At runtime, check SystemLanguageModel.default.availability before you create a session, and show a fallback UI for each unavailable state: .modelNotReady (for example, a download in progress), .appleIntelligenceNotEnabled (disabled in Settings), and .deviceNotEligible (hardware cannot run the model).
  2. Single-Flight Streaming - Give one isolation boundary ownership of each conversation's session, transcript, and generation task. While isResponding is true, reject or queue the new send; never call the session, so GenerationError.concurrentRequests never occurs in normal use. Stop and teardown cancel the owned task and await it before a new send starts. Check Task.checkCancellation() while consuming the stream. Commit a transcript turn only when the response completes (principle-separate-before-serializing-shared-state).
  3. Session Persistence - Reuse LanguageModelSession across completed turns; keep partial streaming text separate from committed history.
  4. Memory Awareness - Use quantised models and monitor memory. iOS limits one app to a fraction of the device's total RAM, so reject any model whose weight files approach or exceed the total RAM of the lowest-memory required device: it cannot load. Pick the smallest model that meets quality on that device and measure peak memory there. Give one @Observable owner the load state, the loaded model, and generation. For a multi-gigabyte download: ask for consent, default to Wi-Fi, make it resumable, and keep the feature in an explicit "not downloaded" state until the files are complete.
  5. Async Everything - Load models asynchronously; never block the main thread.
  6. Device Proof - Before calling the design viable, exercise support boundaries and generation lifecycle in focused tests, then verify a Release build on the oldest or lowest-memory required physical device, including offline operation when the product promises on-device behaviour (principle-prove-it-works).
  7. Locale Support - Before you create a session, call supportsLocale(_:) for each user locale. Treat an unsupported locale as an unavailable state; never work around it with a prompt instruction such as "answer in ". For a supported locale, put the locale in the session instructions, not in each prompt. Test each locale branch on a physical device set to that locale.
  8. Typed Tools and Outputs - For structured output, define a @Generable type and call respond(to:generating:); never parse free text with regular expressions. For an app action the model needs, implement the Foundation Models Tool protocol with @Generable arguments and pass the tool when you create the session. The session invokes the tool; the view never calls the service on the model's behalf. A tool error surfaces from the session call as LanguageModelSession.ToolCallError: catch it and show the user a normal failure state, never a crash or an empty result.

Quick Reference

Framework Comparison

Topic Guide
Framework comparison and selection framework-selection.md

Foundation Models (Apple's Framework)

Topic Guide
Setup and configuration foundation-models/setup.md
Chat patterns and conversations foundation-models/chat-patterns.md

MLX Swift (Advanced Features)

Topic Guide
Setup and configuration mlx-swift/setup.md
Chat patterns with custom models mlx-swift/chat-patterns.md
Vision Language Models (VLMs) [mlx-swift/vision-patterns.md](references/mlx-swift/vis
Полный SKILL.md на GitHub

Установить local-ai-models в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/foundation-models/chat-patterns.mdreferences/foundation-models/setup.mdreferences/framework-selection.mdreferences/mlx-swift/advanced-patterns.mdreferences/mlx-swift/chat-patterns.mdreferences/mlx-swift/quantization.mdreferences/mlx-swift/setup.mdreferences/mlx-swift/vision-patterns.mdreferences/shared/best-practices.mdreferences/shared/error-handling.mdreferences/shared/testing.md

FAQ

Что делает скилл local-ai-models?

WHEN building iOS features on on-device models with Foundation Models or MLX Swift: local LLM inference, chat, Vision Language Models (VLMs), text embeddings, image generation, tool calling, multi-turn conversations, custom models, or structured generation; NOT for cloud-hosted model APIs, Core ML or coremltools model conversion, or Vision framework classifiers; returns framework selection, compatibility gates, session and streaming patterns, and device-proof verification plans.

Как установить скилл local-ai-models?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл local-ai-models запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить local-ai-models с