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.
npx skills add https://github.com/rshankras/claude-code-apple-skills --skill core-ml
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.
Use this skill when the user:
Before generating code, determine which framework is appropriate.
@Generable structured output from natural languageapple-intelligence/foundation-models/ skill for implementationVNRecognizeTextRequestSearch 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:
Ask user via AskUserQuestion:
.mlmodel or .mlpackage into Xcode project navigator.mlmodelc at build time (optimized for device)// 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)
// 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)
| Capability | Request Class | Custom Model Needed? |
|---|---|---|
| Image classification | VNClassifyImageRequest | No (built-in) |
| Object detection | VNDetectObjectsRequest (custom model) | Yes |
| Face detection | VNDetectFaceRectanglesRequest | No |
| Face landmarks | VNDetectFaceLandmarksRequest | No |
| Text recognition (OCR) | VNRecognizeTextRequest | No |
| Body pose | VNDetectHumanBodyPoseRequest | No |
| Hand pose | VNDetectHumanHandPoseRequest | No |
| Barcode detection | VNDetectBarcodesRequest | No |
| Image saliency | VNGenerateAttentionBasedSaliencyImageRequest | No |
| Horizon detection | VNDetectHorizonRequest | No |
| Rectangle detection | VNDetectRectanglesRequest | No |
| Image similarity | VNGenerateImageFeaturePrintRequest | No |
// Multiple requests on the same image
let handler = VNImageRequestHandler(cgImage: cgImage, options: [:])
try handler.perform([
textRequest, // OCR
faceRequest, // Face detection
barcodeRequest // Barcode scanning
])
// Each request's results are populated independently
let tagger = NLTagger(tagSchemes: [.sentimentScore])
tagger.string = "This app is amazing!"
let (tag, _) = tagger.tag(at: text.startIndex, unit: .paragraph, scheme: .sentimentScore)
// tag?.rawValue == "0.9" (positive)
let language = NLLanguageRecognizer.dominantLanguage(for: "Bonjour le monde")
// language == .french
let tokenizer = NLTokenizer(unit: .word)
tokenizer.string = "Hello, world!"
tokenizer.enumerateTokens(in: text.startIndex..<text.endIndex) { range, _ in
print(text[range]) // "Hello" then "world"
return true
}
let tagger = NLTagger(tagSchemes: [.nameType])
tagger.string = "Tim Cook visited Apple Park in Cupertino."
tagger.enumerateTags(in: text.startIndex..<text.endIndex, unit: .word, scheme: .nameType) { tag, range in
if let tag, tag != .other {
print("\(text[range]): \(tag.rawValue)")
// "Tim": PersonalName, "Cook": PersonalName
// "Apple Park": OrganizationName, "Cupertino": PlaceName
}
return true
}
Reduces model size by lowering numerical precision:
import coremltools as ct
from coremltools.models.neural_network import quantization_utils
model = ct.models.MLModel("MyModel.mlmodel")
# Float16 quantization (safe default)
model_fp16 = quantization_utils.quantize_weights(model, nbits=16)
model_fp16.save("MyModel_fp16.mlmodel")
# Int8 quantization (aggressive, test accuracy)
model_int8 = quantization_utils.quantize_weights(model, nbits=8)
model_int8.save("MyModel_int8.mlmodel")
Reduces unique weight values using k-means clustering:
from coremltools.optimize.coreml import palettize_weights, OpPalettizerConfig
config = OpPalettizerConfig(nbits=4)
model_palettized = palettize_weights(model, config)
Removes near-zero weights (sparse model):
from coremltools.optimize.torch.pruning import MagnitudePruner, MagnitudePrunerConfig
config = MagnitudePrunerConfig(target_sparsity=0.75)
pruner = MagnitudePruner(model, config)
let config = MLModelConfiguration()
// Best performance — let system choose CPU, GPU, or Neural Engine
config.computeUnits = .all
// CPU only — predictable latency, no GPU/NE contention
config.computeUnits = .cpuOnly
// CPU + Neural Engine — good balance, avoids GPU contention with UI
config.computeUnits = .cpuAndNeuralEngine
// CPU + GPU — when Neural Engine unavailable
config.computeUnits = .cpuAndGPU
func classify(_ image: UIImage) async throws -> String {
let model = try await MLModelManager.shared.model(named: "Classifier")
// Prediction runs off main thread via structured concurrency
let input = try MLDictionaryFeatureProvider(dictionary: ["image": image.pixelBuffer!])
let result = try await Task.detached {
try model.prediction(from: input)
}.value
return result.featureValue(for: "classLabel")?.stringValue ?? "unknown"
}
// Process multiple images efficiently
let inputs = images.map { MyModelInput(image: $0.pixelBuffer!) }
let batch = MLArrayBatchProvider(array: inputs)
let results = try model.predictions(from: batch)
for i in 0..<results.count {
let output = results.features(at: i)
print(output.featureValue(for: "classLabel")?.stringValue ?? "")
}
// Compile .mlmodel to .mlmodelc at install (not runtime)
// This is done automatically when you add .mlmodel to Xcode target
// For downloaded models, compile once and cache:
let compiledURL = try MLModel.compileModel(at: downloadedModelURL)
let permanentURL = appSupportDir.appendingPathComponent("MyModel.mlmodelc")
try FileManager.default.copyItem(at: compiledURL, to: permanentURL)
Based on user's answer to configuration questions, select the appropriate template(s) from templates.md.
| Capability | Files Generated |
|---|---|
| Any Core ML | MLModelManager.swift |
| Image classification | ImageClassifier.swift |
| Text analysis | TextAnalyzer.swift |
| Vision requests | VisionService.swift |
| Custom model | ModelConfig.swift + model-specific predictor |
| Camera + ML | CameraMLPipeline.swift |
Check project structure:
Sources/ exists -> Sources/ML/App/Services/ exists -> App/Services/ML/App/ exists -> App/ML/ML/After generation, provide:
ML/
├── MLModelManager.swift # Central model lifecycle management
├── ImageClassifier.swift # Vision-based image classification (if needed)
├── TextAnalyzer.swift # NaturalLanguage wrapper (if needed)
├── ModelConfig.swift # Compute unit configuration
└── VisionService.swift # Vision request pipeline (if needed)
.mlmodel file to Xcode project (if using custom model)Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use `hyperframes-animation`.
Brainstorm and write high-retention short-form video and carousel content for TikTok, Reels, and YouTube Shorts. Use whenever someone wants viral hook ideas, a video script or outline, content concepts for a product or topic, or wants to critique and improve a draft hook or script. Works for any storytime, listicle, carousel, or meme. Produces several diverse hook options from proven patterns, structures scripts for retention (hook, escalation, payoff, CTA), and adapts to each platform. Pattern-based guidance grounded in how short-form tends to perform; it improves the odds, it does not guarantee virality."
Generate short-form video ideas at volume and stop the blank-page problem for good. Use whenever someone says they're stuck for ideas, asks for 20 TikTok ideas or Reels ideas or YouTube Shorts ideas for their niche, wants a content brainstorm, needs help building a content pillar system or content matrix, wants to turn one idea into 5 angles, asks what to post this week, or wants a real idea generator workflow instead of staring at a notes app. Runs the systems prolific creators actually use: pillars, mining (comments, Reddit, search autocomplete, competitor outliers), repurposing, evergreen vs trend balance. Pattern-based guidance grounded in how short-form ideation tends to work; never run out of ideas is the goal, virality is not promised.
| This skill encodes Emil Kowalski's philosophy on UI polish, component design, animation decisions, and the invisible details that make software feel great.
Create and publish concise Rivet launch or changelog posts through an approval-gated workflow, including release research, a required user-selected hero variation, local HTML-rendered social and technical images, an R2 hero upload, MDX authoring, a reviewed draft GitHub PR for manual merge, and a scheduled and verified Buffer thread for @rivet_dev. Use when asked to launch, announce, ship, or prepare and schedule a Rivet feature or release announcement.
This skill encodes Emil Kowalski's philosophy on UI polish, component design, animation decisions, and the invisible details that make software feel great.
Generate a daily digest of today's policy-authorized meetings and voice memos — key decisions, action items, and themes across available recordings. Use when the user asks "recap my day", "what happened in my meetings today", "daily summary", "what did I discuss today", "any action items from today", or wants a consolidated view of the day's conversations.
Generate a daily digest of today's policy-authorized meetings and voice memos — key decisions, action items, and themes across available recordings. Use when the user asks "recap my day", "what happened in my meetings today", "daily summary", "what did I discuss today", "any action items from today", or wants a consolidated view of the day's conversations.
Take rshankras/core-ml from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.