Skip to content
Development
Skill

/core-ml

Core ML, Create ML, Vision framework, Natural Language framework, on-device ML integration. Use when user wants image classification, text analysis, object detection, sound classification, model optimization, or custom model integration. Covers Core ML vs Foundation Models

From plugin
rshankras-apple-skills
603183 skills
Install
$ npx -y skills add rshankras/claude-code-apple-skills --skill core-ml --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/core-ml

Context preview

The summary Claude sees to decide when to auto-load this skill.

Core ML, Create ML, Vision framework, Natural Language framework, on-device ML integration. Use when user wants image classification, text analysis, object detection, sound classification, model optimization, or custom model integration. Covers Core ML vs Foundation Models

SKILL.md

core-ml.SKILL.md
name: core-ml
description: Core ML, Create ML, Vision framework, Natural Language framework, on-device ML integration. Use when user wants image classification, text analysis, object detection, sound classification, model optimization, or custom model integration. Covers Core ML vs Foundation Models decision.
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion]
last_verified: 2026-07-16
review_by: 2027-06-22
os_version: iOS 27 / macOS 27

Core ML Skills

Combined advisory, generator, and workflow skill for integrating machine learning into Apple platform apps. Covers Core ML model integration, Vision framework image analysis, NaturalLanguage framework text processing, Create ML training, and on-device model optimization.

When This Skill Activates

Use this skill when the user:

  • Wants to add ML capabilities to their app
  • Needs to integrate a Core ML model (.mlmodel) into an Xcode project
  • Wants to use the Vision framework for image analysis (faces, text recognition, body pose, object detection)
  • Wants to use the NaturalLanguage framework for text processing (sentiment, entities, language detection)
  • Needs to train a custom model with Create ML
  • Wants to optimize a model for on-device use (quantization, pruning, palettization)
  • Needs to choose between Core ML and Foundation Models (Apple Intelligence)
  • Asks about image classification, object detection, sound classification, or tabular data prediction
  • Wants real-time camera + ML processing

Decision Guide: Core ML vs Foundation Models

Before generating code, determine which framework is appropriate.

Use Foundation Models (Apple Intelligence) When:

  • You need general-purpose text generation, summarization, or conversational AI
  • Target is iOS 26+ / macOS 26+ (Foundation Models requires Apple Silicon + latest OS)
  • The task is open-ended language understanding or generation
  • You want `@Generable` structured output from natural language
  • See `apple-intelligence/foundation-models/` skill for implementation

Use Core ML When:

  • You need specialized ML: image classification, object detection, sound classification, custom regression/classification
  • You have a trained model (.mlmodel, .mlpackage) or plan to train one
  • You need broad device support (iOS 14+ / macOS 11+)
  • The task requires domain-specific predictions (medical imaging, product recognition, custom NLP)
  • Performance-critical inference on Neural Engine or GPU

Use Vision Framework When (No Custom Model Needed):

  • Image classification using Apple's built-in models
  • Face detection and facial landmark analysis
  • Text recognition (OCR) with `VNRecognizeTextRequest`
  • Body and hand pose detection
  • Barcode and QR code scanning
  • Image similarity and saliency detection
  • Horizon detection, rectangle detection

Use NaturalLanguage Framework When (No Custom Model Needed):

  • Sentiment analysis on text
  • Language identification
  • Tokenization (word, sentence, paragraph boundaries)
  • Named entity recognition (people, places, organizations)
  • Word and sentence embeddings for similarity comparison
  • Lemmatization and part-of-speech tagging

Pre-Generation Checks

1. Project Context Detection

  • [ ] Check deployment target (Core ML requires iOS 11+ / macOS 10.13+; Vision requires iOS 11+; NaturalLanguage requires iOS 12+)
  • [ ] Check for existing ML code or models
  • [ ] Identify project structure and source file locations
  • [ ] Determine if SwiftUI or UIKit/AppKit

2. Conflict Detection

Search for existing ML integration:

Glob: **/*Model*.swift, **/*Classifier*.swift, **/*Predictor*.swift, **/*.mlmodel, **/*.mlmodelc, **/*.mlpackage
Grep: "import CoreML" or "import Vision" or "import NaturalLanguage"

If found, ask user:

  • Extend existing ML setup?
  • Replace with new implementation?
  • Add additional model/capability?

Configuration Questions

Ask user via AskUserQuestion:

1. **What ML capability do you need?**

  • Image classification (identify objects in photos)
  • Object detection (locate objects with bounding boxes)
  • Text analysis (sentiment, entities, language)
  • Custom Core ML model integration
  • Vision framework (OCR, faces, poses)
  • Sound classification
  • Tabular data prediction

2. **Do you have a trained model, or need to train one?**

  • I have a .mlmodel / .mlpackage file
  • I want to train with Create ML
  • I want to use Apple's built-in models (Vision / NaturalLanguage)

3. **Performance requirements?**

  • Real-time (camera feed, < 33ms per prediction)
  • Interactive (user-initiated, < 500ms acceptable)
  • Background processing (batch, latency not critical)

Core ML Model Integration

Adding a Model to Xcode

1. Drag `.mlmodel` or `.mlpackage` into Xcode project navigator 2. Xcode auto-generates a Swift class with the model name 3. The generated class provides type-safe input/output interfaces 4. Xcode compiles to `.mlmodelc` at build time (optimized for device)

Loading Models

// Option 1: Auto-generated class (simplest)
let model = try MyImageClassifier(configuration: MLModelConfiguration())

// Option 2: Generic MLModel loading (flexible)
let url = Bundle.main.url(forResource: "MyModel", withExtension: "mlmodelc")!
let config = MLModelConfiguration()
config.computeUnits = .all  // CPU + GPU + Neural Engine
let model = try MLModel(contentsOf: url, configuration: config)

// Option 3: Async loading (recommended for large models)
let model = try await MLModel.load(contentsOf: url, configuration: config)

Making Predictions

// Type-safe prediction with auto-generated class
let input = MyImageClassifierInput(image: pixelBuffer)
let output = try model.prediction(input: input)
print(output.classLabel)       // "cat"
print(output.classLabelProbs)  // ["cat": 0.95, "dog": 0.04, ...]

// Batch predictions
let batch = MLArrayBatchProvider(array: inputs)
let results = try model.predictions(from: batch)

Create ML Training Overview

##

Read more
Ships withrshankras-apple-skills

A collection of Claude Code skills for iOS, macOS, watchOS, visionOS, and Apple platform development. These skills help you plan and build apps, maintain code quality, ensure HIG compliance, and guide you from idea to App Store.

Get the whole plugin
Stats
603
Stars
51
Forks
Active
Maintenance
Swift
Language
MIT
License
16d ago
Last commit
9mo ago
Created

Repo: rshankras/claude-code-apple-skills

Other skills on rshankras-apple-skills.