swift-mlx

swift-mlx is a skill for Claude Code, Codex from PicoMLX/mlx-swift-lm-skill. It costs 25 tokens per session (3,118 once invoked), scanned A, a copy of swift-mlx, MIT.

A Swift machine-learning framework for Apple Silicon Macs and devices, including array operations, neural-network components, automatic differentiation, and shared CPU/GPU memory.

In plain words
What is it for?
Use it for ML arrays, neural networks, model training, optimization, performance tuning, and custom Metal GPU operations in Swift.
Why use it?
It provides building blocks for running or training machine-learning models on Apple hardware with Swift.

Skill for Claude CodeCodex

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

Good fit Use it for ML arrays, neural networks, model training, optimization, performance tuning, and custom Metal GPU operations in Swift.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/picomlx/mlx-swift-lm-skill/mlx-swift
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 PicoMLX/mlx-swift-lm-skill --skill mlx-swift
Clone the repo
git clone --depth 1 https://github.com/PicoMLX/mlx-swift-lm-skill

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 swift-mlx

README.md
[![agentmods](https://agentmods.dev/badge/skills/picomlx/mlx-swift-lm-skill/mlx-swift/github.svg)](https://agentmods.dev/skills/picomlx/mlx-swift-lm-skill/mlx-swift)
Your own site
<a href="https://agentmods.dev/skills/picomlx/mlx-swift-lm-skill/mlx-swift"><img src="https://agentmods.dev/badge/skills/picomlx/mlx-swift-lm-skill/mlx-swift/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 swift-mlx

Your own site · 80×15
<a href="https://agentmods.dev/skills/picomlx/mlx-swift-lm-skill/mlx-swift"><img src="https://agentmods.dev/badge/skills/picomlx/mlx-swift-lm-skill/mlx-swift.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,118 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 100% copy Near-identical to another mod 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.00025 $0.03118
Opus 5 $0.00013 $0.01559
Sonnet 5 $0.00005 $0.00624
Haiku 4.5 $0.00003 $0.00312

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

Security

Grade A, and why

swift-mlx 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 12d 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.

Origin

This is a copy

100% identical to swift-mlx — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

mlx-swift/SKILL.md · 395 lines

How it starts

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

MLX Swift Framework

MLX Swift is Apple's high-performance machine learning framework designed specifically for Apple Silicon. It provides NumPy-like array operations with lazy evaluation, automatic differentiation, and unified CPU/GPU memory.

When to Use This Skill

  • Array operations on Apple Silicon (MLXArray)
  • Building neural networks (MLXNN)
  • Training models with automatic differentiation
  • Custom Metal kernels via MLXFast
  • Performance optimization with JIT compilation

Architecture Overview

MLXOptimizers (Adam, AdamW, SGD, etc.)
       ↓
MLXNN (Layers, Modules, Losses)
       ↓
MLX (Arrays, Ops, Transforms, FFT, Linalg, Random)
       ↓
Cmlx (C/C++ bindings, Metal GPU)

Key File Reference

Purpose File Path
Core array Source/MLX/MLXArray.swift
Operations Source/MLX/Ops.swift
Transforms Source/MLX/Transforms.swift
Factory methods Source/MLX/Factory.swift
Neural layers Source/MLXNN/*.swift
Optimizers Source/MLXOptimizers/Optimizers.swift
Fast ops Source/MLX/MLXFast.swift
Custom kernels Source/MLX/MLXFastKernel.swift
Wired memory coordinator Source/MLX/WiredMemory.swift
GPU working-set helper Source/MLX/GPU+Metal.swift

Quick Start

Basic Array Creation

import MLX

// Create arrays
let a = MLXArray([1, 2, 3, 4])
let b = MLXArray(0 ..< 12, [3, 4])  // Shape [3, 4]
let c = MLXArray.zeros([2, 3])
let d = MLXArray.ones([4, 4], dtype: .float32)

// Random arrays (use MLXRandom namespace or free functions)
let uniform = MLXRandom.uniform(0.0 ..< 1.0, [3, 3])
let normal = MLXRandom.normal([100])

Array Properties

let array = MLXArray(0 ..< 12, [3, 4])
array.shape    // [3, 4]
array.ndim     // 2
array.size     // 12
array.dtype    // .int64
array.count    // 3 (first dimension)

Basic Operations

let a = MLXArray([1.0, 2.0, 3.0])
let b = MLXArray([4.0, 5.0, 6.0])

// Arithmetic (lazy - not computed until eval)
let sum = a + b
let product = a * b
let matmul = a.matmul(b.T)

// Force evaluation
eval(sum, product)
// or
sum.eval()

Read the full file on GitHub · 395 lines

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. 12d ago First seen · 395 lines · 25 tokens per session scan A 06192f2638e4

Subscribe to this mod's changes

swift-mlx is a skill published in the GitHub repository PicoMLX/mlx-swift-lm-skill (24 stars, last pushed 6mo ago), licensed MIT. It adds 25 tokens to every session and 3,118 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to swift-mlx, differing in 0 lines, and is treated as a copy.