coreml-optimizer

coreml-optimizer is a skill for Claude Code from ckorhonen/claude-skills. It costs 66 tokens per session (4,739 once invoked), scanned A, original, MIT.

Guidance for making Core ML machine-learning models smaller and faster on iPhone, iPad, and Mac devices.

In plain words
What is it for?
Use it when converting models to Core ML, applying quantization, palettization, or pruning, choosing processing hardware, profiling performance, or debugging inference.
Why use it?
It helps address slow on-device predictions, excessive model size, Neural Engine problems, and accuracy loss after compression.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the claude-skills plugin — 62 skills, 4 commands, 7 agents shipped together

Good fit Use it when converting models to Core ML, applying quantization, palettization, or pruning, choosing processing hardware, profiling performance, or debugging inference.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ckorhonen/claude-skills/coreml-optimizer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ckorhonen/claude-skills --skill coreml-optimizer
Clone the repo
git clone --depth 1 https://github.com/ckorhonen/claude-skills

Made for: Claude Code.

Or install claude-skills, the plugin that ships this one along with the rest of its 62 skills, 4 commands, 7 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for coreml-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/ckorhonen/claude-skills/coreml-optimizer/github.svg)](https://agentmods.dev/skills/ckorhonen/claude-skills/coreml-optimizer)
Your own site
<a href="https://agentmods.dev/skills/ckorhonen/claude-skills/coreml-optimizer"><img src="https://agentmods.dev/badge/skills/ckorhonen/claude-skills/coreml-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for coreml-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/ckorhonen/claude-skills/coreml-optimizer"><img src="https://agentmods.dev/badge/skills/ckorhonen/claude-skills/coreml-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,739 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00066 $0.04739
Opus 5 $0.00033 $0.02370
Sonnet 5 $0.00013 $0.00948
Haiku 4.5 $0.00007 $0.00474

Measured 9d ago against content hash 9387e7ea79de, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

coreml-optimizer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/coreml-optimizer/SKILL.md · 662 lines

How it starts

The opening of the file, as written. The whole thing — 662 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CoreML Optimizer

Expert guidance for optimizing machine learning models for Apple's CoreML framework on iOS and macOS devices.

When to Use This Skill

Use this skill when:

  • Converting PyTorch/TensorFlow models to CoreML format
  • Optimizing CoreML model size and inference latency
  • Targeting the Neural Engine for maximum performance
  • Debugging slow model inference or compute unit issues
  • Applying quantization, palettization, or pruning
  • Profiling model performance with Instruments
  • Troubleshooting accuracy degradation after compression

Speed Optimization Checklist

The critical path to fast CoreML inference:

1. Verify Compute Unit Configuration

Many "slow" models are accidentally CPU-bound. Configure via MLModelConfiguration.computeUnits:

Option Description
.all Uses all available compute units including Neural Engine (default, recommended)
.cpuAndNeuralEngine CPU + Neural Engine, excludes GPU
.cpuAndGPU CPU + GPU, excludes Neural Engine
.cpuOnly Forces CPU-only execution (for debugging/consistency)

In Swift:

let config = MLModelConfiguration()
config.computeUnits = .all  // .cpuAndNeuralEngine, .cpuAndGPU, .cpuOnly
let model = try MLModel(contentsOf: modelURL, configuration: config)

Benchmark each configuration - if .all isn't faster than .cpuAndGPU, your model may not be hitting the Neural Engine.

2. Apply Weight Compression with coremltools

CoreML execution commonly uses float16 where possible. Use coremltools.optimize for further compression:

import coremltools as ct
import coremltools.optimize as cto

# 8-bit quantization (2-4x speedup for memory-bound models)
config = cto.coreml.OptimizationConfig(
    global_config=cto.coreml.OpLinearQuantizerConfig(
        mode="linear_symmetric",
        dtype="int8",
        granularity="per_channel"
    )
)

model = ct.models.MLModel("Model.mlpackage")
quantized = cto.coreml.linear_quantize_weights(model, config=config)
quantized.save("Model_int8.mlpackage")

Read the full file on GitHub · 662 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 662 lines · 66 tokens per session scan A 9387e7ea79de

Subscribe to this mod's changes

coreml-optimizer is a skill published in the GitHub repository ckorhonen/claude-skills (14 stars, last pushed 2mo ago), licensed MIT. It adds 66 tokens to every session and 4,739 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

ml-kit-genai-prompt-api

Analyzes Android codebases to implement ML Kit GenAI Prompt API. Use this skill to send natural language requests on-device to Gemini Nano, use structured output with Prompt API, implement prefix caching, optimize the current prompt, or apply best practices.".

android/skills · 57 tokens

wiki-export

Export the Obsidian wiki's knowledge graph to structured formats for use in external tools. Use this skill when the user says "export wiki", "export graph", "export to JSON", "export to Gephi", "export to Neo4j", "export to Postgres", "export to SQL", "graphml", "visualize wiki", "knowledge graph export", "export to…

Ar9av/obsidian-wiki · 172 tokens

model-authoring

Empirical rules for authoring PyTorch models for on-device execution on Apple platforms, covering energy-efficient inference, scalable compute, and correctness testing. Use this skill whenever the user is writing, debugging, or reviewing PyTorch model code intended for on-device execution — even if they don't…

apple/coreai-models · 95 tokens

working-with-coreai

Use this skill whenever the user mentions coreai-torch, TorchConverter, coreai-build, AIModel, AIProgram, .aimodel, or wants to export/compile/run a PyTorch model on Apple silicon (iPhone, iPad, Mac). Also triggers for "deploy on device", "optimize for on-device performance", onboarding new models to Core AI, or…

apple/coreai-models · 91 tokens

llm-as-judge-evaluation

Evaluate LLM outputs using frontier models as judges. Use for pairwise model comparison, quality scoring with custom rubrics, and automated evaluation pipelines. Covers position bias mitigation, statistical significance, and generating preference data for DPO/RLHF.

synthetic-sciences/openscience · 56 tokens

transformers

This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning…

synthetic-sciences/openscience · 63 tokens