Agent skill · software engineering · dpearson2699
coreml
Integrate Core ML models in iOS apps for on-device machine learning inference. Covers model loading (.mlmodel, .mlpackage, .mlmodelc), predictions with auto-generated classes and MLFeatureProvider, compute unit configuration (CPU, GPU, Neural Engine), MLTensor, VNCoreMLRequest, MLComputePlan, multi-model pipelines, and deployment strategies. Use when loading Core ML models, making predictions, configuring compute units, or profiling model performance.
Why this skill is useful
Provides specific Swift integration patterns for Core ML that the AI wouldn't reliably generate on its own.
What it needs
About 8k tokens when loaded. Last updated 2026-07-31. 973 stars on the source repository.
What this skill does
Core ML Swift Integration Load, configure, and run Core ML models in iOS apps. This skill covers the Swift side: model loading, prediction, MLTensor, profiling, and deployment. Scope boundary: Python-side model conversion, optimization (quantization, palettization, pruning), and framework selection live in the apple-on-device-ai skill. This skill owns Swift integration only. See references/coreml-swift-integration.md for complete code patterns including actor-based caching, batch inference, image preprocessing, and testing. Contents Loading Models Model Configuration Making Predictions MLTensor (iOS 18+) Working with MLMultiArray Image Preprocessing Multi-Model Pipelines Vision Integration Performance Profiling Model Deployment Memory Management Common Mistakes Review Checklist References Loading Models Auto-Generated Classes When you add a .mlmodel or .mlpackage to an app target, Xcode generates a Swift class with typed input/output. Use this whenever possible. Manual Loading Load from a URL when the model is downloaded at runtime or stored outside the bundle. Async Loading (iOS 15+) Load models without blocking the main thread. Prefer this for large models. Compile at Runtime (iOS 16+) Compile a .mlpackage or .mlmodel to .mlmodelc on device. Useful for models downloaded from a server. Do this once per model version, not on every launch. Cache the compiled URL -- recompiling on every launch is a bug. Copy compiledURL to a persistent location (e.g., Application Support). When reviewing runtime-loaded models, call out both facts together: async MLModel.compileModel(at:) is iOS 16+, and compiled models must be cached so the app does not recompile on every launch. Model Configuration MLModelConfiguration controls compute units, GPU access, and model parameters. Compute Units Decision Table Value Uses When to Choose --- --- --- .all CPU + GPU + Neural Engine Default. Let the system decide. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills dpearson2699/coreml