mlx-model-porting

mlx-model-porting is a skill for Claude Code, Codex from Amal-David/mlx-porting-skill. It costs 244 tokens per session (3,124 once invoked), scanned A, original, Apache-2.0.

A guide for moving PyTorch or Hugging Face machine-learning models to Apple’s MLX framework, which is designed for Apple Silicon chips. It also inspects existing MLX projects and checks whether changes preserve correct results.

In plain words
What is it for?
Use it to port, run, inspect, quantize, package, benchmark, or fix language, vision, audio, diffusion, and state-space models in MLX on Apple Silicon.
Why use it?
It helps find conversion, output-matching, memory, speed, and other problems when adapting a model for Apple hardware. It also keeps performance claims tied to stated hardware, software, workload, and quality checks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 scripts/scaffold_port.py inspection.json --artifact-root MODEL --output mlx_port.

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/Amal-David/mlx-porting-skill
agentmods
npx agentmods add skills/amal-david/mlx-porting-skill/mlx-model-porting

Made for: Claude Code, Codex.

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 mlx-model-porting

README.md
[![agentmods](https://agentmods.dev/badge/skills/amal-david/mlx-porting-skill/mlx-model-porting.svg)](https://agentmods.dev/skills/amal-david/mlx-porting-skill/mlx-model-porting)
Your own site
<a href="https://agentmods.dev/skills/amal-david/mlx-porting-skill/mlx-model-porting"><img src="https://agentmods.dev/badge/skills/amal-david/mlx-porting-skill/mlx-model-porting.svg" alt="Measured on agentmods" height="20"></a>
Per session 244 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,124 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00244 $0.03124
Opus 5 $0.00122 $0.01562
Sonnet 5 $0.00049 $0.00625
Haiku 4.5 $0.00024 $0.00312

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

Security

Grade A, and why

mlx-model-porting 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 6d 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.

mlx-model-porting/SKILL.md · 147 lines

How it starts

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

MLX model porting and optimization

Mission

Produce or inspect a correct, reproducible, architecture-aware MLX implementation. Correctness before speed. Every speed or memory claim must name hardware, software versions, workload, baseline, and quality gate.

Six families have scaffolds (MoE/SSM synthetic, others runbook-guided); four have worked packets under examples/: Qwen2.5, BGE, t5-small, HuBERT. Exact output is the built-in metric.

When to use this skill

Port, convert, run, inspect, quantize, package, or publish a PyTorch/Hugging Face model or MLX project on Apple Silicon, or fix any parity, NaN/Inf, shape, tokenizer, preprocessing, output, performance, memory, cache, serving, benchmark, or provenance issue in a port. Not for CUDA/non-Apple targets, ML theory without an MLX target, or training from scratch.

Trigger map

Signal Load
Port/convert/run request, config.json, safetensors index, model directory, or Hub id. intake, then Workflow 1-6; worked chain for dense decoders, routed runbooks otherwise.
User points at an existing local MLX project, running MLX app, or completed MLX port. inspector mode plus inspect_mlx_project.py
User asks "what can I do with this model?", asks for capability fit, or wants model-specific advice. model advisor playbook
A known architecture family needs the right runbook. model support map, then the architecture table in Workflow step 4 below
Dense decoder, BERT encoder, T5 encoder-decoder, HuBERT/Wav2Vec2 acoustic encoder, sparse MoE, or selective SSM. Use scaffold_port.py; select capture/parity mode dense-decoder (default), encoder, encoder-decoder, asr, or ssm.
NaN, Inf, cosine-similarity drift, parity failure, or garbage output appears versus the source. failure atlas
Weight conversion, key mapping, tensor rename, transpose, reshape, split, merge, or shape transform is in scope. core porting method
The user says "make it faster" but no profile, workload, or baseline exists yet. benchmarking
Speedup plan, how techniques combine, or expected compound gains. compound stacks
KV cache, long context, recurrent state, attention memory, or prefill/decode memory is the bottleneck. attention and KV cache
Quantization or "4-bit". guide, quality gate
Structured local optimization sweep. loop
Decoding, serving, speculative decoding, batching, streaming, or API runtime behavior is requested. decoding and serving
Compile behavior, mx.compile, custom kernel, graph capture, Metal, or operation fusion comes up. compile and kernels
Publish, release, checkpoint conversion, model card, provenance, or license packaging is requested. packaging and publication
The user asks for "50-100 optimization ideas", a deep model-specific hunt, or research-backed candidates. hypothesis-led learning
Vision-language, multimodal, or image+text (VLM) input appears. multimodal/omni runbook
Diffusion, flow-matching, or image/video generation appears. diffusion/flow runbook
Text-to-speech, vocoder, or audio generation appears. flow-TTS, autoregressive audio
ASR, transcription, or streaming speech appears. ASR, streaming speech
Sparse mixture-of-experts or top-k expert routing appears. MoE runbook
Selective state-space, Mamba, or linear-attention hybrid appears. SSM/hybrid runbook
Graph, GNN, message passing, node/edge features, or sparse graph workload appears. graph message passing runbook
Classic CV detection, segmentation, keypoints, depth, OCR, or non-generative vision appears. non-generative CV runbook
Time-series, forecasting, tabular sequence, anomaly detection, or temporal model appears. time-series forecasting runbook

Read the full file on GitHub · 147 lines

Files

What ships with it

60 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. 6d ago First seen · 147 lines · 244 tokens per session scan A eeeca7c2efc3

Subscribe to this mod's changes

mlx-model-porting is a skill published in the GitHub repository Amal-David/mlx-porting-skill (5 stars, last pushed today), licensed Apache-2.0. It adds 244 tokens to every session and 3,124 once invoked, about $0.0012 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-31.

Related

Other skills, from other repositories

add-new-model

Use this skill when the user wants to add or port a new model architecture to MLX-VLM — mapping a Hugging Face modeltype to a new file under mlxvlm/models, writing the ModelConfig, matching layer/weight names, reusing a similar existing model, adding a test class, and validating the port. Covers vision-language…

Blaizzy/mlx-vlm · 83 tokens

convert-quantize

Use this skill when the user wants to convert a Hugging Face model to MLX or quantize/dequantize one with mlxvlm.convert, including bits and group size, quant modes (affine, mxfp4, nvfp4, mxfp8), RTN vs AWQ, mixed-bit recipes, dtype casts, calibration (text or multimodal), local vs Hub paths, revisions, uploading to…

Blaizzy/mlx-vlm · 99 tokens

cli-inference

Use this skill when the user wants to run or debug MLX-VLM inference from the command line, including uv run mlxvlm.generate, image/audio/video inputs, local model paths, Hugging Face model IDs, deterministic repro commands, and CLI errors around processors, prompts, model loading, or missing weights.

Blaizzy/mlx-vlm · 67 tokens

server-inference

Use this skill when the user wants to run or debug MLX-VLM server inference, including uv run mlxvlm.server, /v1/models, /v1/chat/completions, /v1/responses, streaming, OpenAI-compatible clients, health checks, metrics, model unload/reload, adapters, trust-remote-code, and server request/response failures.

Blaizzy/mlx-vlm · 80 tokens

hf-cache-models

Use this skill when the user wants to list, inspect, or report MLX-VLM model candidates available in the local Hugging Face cache directory, including the server's opt-in hf-cache discovery mode, cache-dir overrides, JSON output, or issue-ready cached model lists.

Blaizzy/mlx-vlm · 60 tokens

exporting-to-fhir

Convert OpenMed NER output (entities from openmed.analyzetext) into FHIR R4 resources — Condition, MedicationStatement, Observation — using OpenMed's built-in FHIR R4 export helpers in openmed.clinical.exporters. Covers the verified CodeableConcept builder (coding, codeableconcept, systemuri), deterministic fullUrl…

maziyarpanahi/openmed · 163 tokens