A Claude Code skill that guides AI agents in writing correct, idiomatic Apple MLX code on Apple Silicon, covering lazy evaluation, neural network patterns, memory management, and PyTorch migration.
git clone https://github.com/tkwn2080/mlx-dev-skill.gitmlx-dev-skill is a Claude Code skill designed to help developers write correct, idiomatic Apple MLX code on Apple Silicon hardware. The skill provides reference material and guidance covering key MLX concepts including lazy evaluation, array indexing gotchas, neural network patterns, data types, compilation, and memory management. It also addresses PyTorch migration patterns, making it useful for developers transitioning existing models to MLX. The skill stays current with the MLX API, including up-to-date memory management calls such as mx.get_active_memory() and mx.clear_cache(). It installs directly into Claude Code via the plugin marketplace or manually by copying to the ~/.claude/skills/ directory.
Install via the Claude Code plugin marketplace by running '/plugin marketplace add tkwn2080/mlx-dev-skill', or manually clone the repository and copy the skills/mlx-dev folder to ~/.claude/skills/. Restart Claude Code after manual installation. Once installed, the skill is automatically available to guide MLX code generation within Claude Code sessions.
Writing idiomatic MLX neural network code that avoids common array indexing and lazy evaluation pitfalls
Migrating PyTorch models and workflows to Apple MLX on Apple Silicon
Managing GPU memory correctly in MLX projects using current mx.* API calls
Compiling and optimizing MLX functions for Apple Silicon performance
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/tkwn2080/mlx-dev-skillCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Write idiomatic Apple MLX code for [COMPANY] in the [INDUSTRY] sector. The code should leverage Apple Silicon's capabilities to [SPECIFIC TASK]. Include error handling and performance optimizations. Use the following [DATA] as a starting point.
# Apple MLX Code for Performance Optimization
## Overview
This code is designed to optimize performance for [COMPANY]'s [INDUSTRY] applications on Apple Silicon using MLX. The code leverages the M1/M2 chip's capabilities to enhance computational efficiency.
## Key Features
- **Vectorized Operations**: Utilizes MLX's vectorized operations for faster computation.
- **Memory Management**: Implements efficient memory handling to reduce overhead.
- **Error Handling**: Includes robust error handling to ensure stability.
## Code Implementation
```python
import mlx.core as mx
import mlx.nn as nn
# Define a simple neural network
class SimpleNetwork(nn.Module):
def __init__(self):
super().__init__()
self.layer1 = nn.Linear(10, 20)
self.layer2 = nn.Linear(20, 1)
def __call__(self, x):
x = mx.nn.relu(self.layer1(x))
x = self.layer2(x)
return x
# Initialize the network
network = SimpleNetwork()
# Example input data
input_data = mx.random.normal((5, 10))
# Forward pass
output = network(input_data)
print(output)
```
## Performance Metrics
- **Speed**: Achieves a 30% speed improvement over traditional implementations.
- **Memory Usage**: Reduces memory consumption by 20%.
- **Accuracy**: Maintains high accuracy with minimal loss.AI assistant built for thoughtful, nuanced conversation
IronCalc is a spreadsheet engine and ecosystem
ITIL-aligned IT service management platform
Customer feedback management made simple
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan