mlx-dev

Guide developers to write idiomatic MLX code on Apple Silicon.

Updated Feb 2, 2026
One-click install
npx skills add https://github.com/luqmannurhakimbazman/kapitan-marketplace --skill mlx-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mlx-dev
Source: https://github.com/luqmannurhakimbazman/kapitan-marketplace/tree/main/kapitan-claude-plugin/skills/mlx-dev
Command: npx skills add https://github.com/luqmannurhakimbazman/kapitan-marketplace --skill mlx-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

MLX development on Apple Silicon often requires bridging API gaps and platform-specific rules. This guide helps developers write correct, idiomatic MLX code by surfacing these rules and common pitfalls with MLX arrays, memory management, and performance considerations.

Core Features & Use Cases

  • Clear guidance for environment setup, runtime patterns, and best practices for MLX on Apple Silicon.
  • Explanations of mlx.eval, mlx.compile, Metal GPU usage, memory management, and mlx-lm integration.
  • Real-world scenarios and debugging patterns with references to array indexing, NHWC conventions, and dtype behavior.

Quick Start

Install MLX tooling and start experimenting with sample MLX scripts on Apple Silicon.

Frequently Asked Questions about mlx-dev

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up the MLX environment and start writing code on Apple Silicon?

To set up the MLX environment on Apple Silicon, install the core MLX tooling and run the provided sample scripts. This ensures correct runtime patterns and proper Metal GPU access for your arrays and neural networks.

How does MLX handle memory management and array evaluation differently from PyTorch?

MLX uses lazy evaluation, requiring explicit mlx.eval calls to trigger computation, unlike PyTorch's eager execution. Memory management relies on unified memory architecture across CPU and GPU, differing from PyTorch's separate memory pools.

What are the NHWC conventions and how do I apply them in MLX neural networks?

NHWC conventions in MLX dictate that array shapes follow the batch, height, width, and channel order. Apply this layout when constructing neural network layers to ensure proper data flow and avoid shape mismatches on Apple Silicon.

Why does mlx.compile change my code's behavior and how do I debug it?

mlx.compile optimizes and fuses operations for faster Metal GPU execution, which can hide intermediate values. Debug by isolating the compiled function, checking dtype behavior, and temporarily removing the compile decorator to trace array outputs.

Can I use MLX for large language model inference with mlx-lm integration?

Yes, MLX supports large language model inference through mlx-lm integration on Apple Silicon. This allows you to load, run, and fine-tune models efficiently using the framework's memory management and GPU acceleration.

What are common pitfalls with array indexing and dtype behavior in MLX?

Common MLX pitfalls include unexpected dtype promotions during operations and non-intuitive array indexing results. Follow idiomatic patterns by explicitly casting dtypes and validating array indexing logic against the framework's specific rules.