Comprehensive support for Mojo programming, GPU kernels, and AI deployment using the MAX framework.

Install

mkdir -p .claude/skills/mojo-max && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/9734" && unzip -o skill.zip -d .claude/skills/mojo-max && rm skill.zip

Installs to .claude/skills/mojo-max

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Comprehensive Mojo programming language and MAX framework development skill. Use when: (1) Writing Mojo code - systems programming with Python-like syntax (2) Translating Python code to high-performance Mojo (3) GPU kernel development - NVIDIA, AMD, Apple silicon (4) Using MAX for AI model deployment and inference (5) Working with SIMD, parallelism, or low-level memory management (6) Questions about Mojo ownership, structs, traits, or pointers Triggers: .mojo files, "mojo", "MAX framework", "GPU kernel", "SIMD", "LayoutTensor", mentions of Modular
553 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • Translate Python code to Mojo
  • Develop GPU kernels for AI inference
  • Write SIMD-optimized systems code
  • Manage memory with ownership and borrowing
  • Deploy AI models using the MAX framework

How it works

The skill guides the translation of Python syntax into Mojo's strict, performant systems language features and provides patterns for GPU and SIMD optimization.

Inputs & outputs

You give it
Python source code or AI model definition
You get back
High-performance Mojo implementation

When to use mojo-max

  • Translating Python to Mojo
  • Developing GPU kernels
  • Writing SIMD-optimized code
  • Using MAX framework for AI

About this skill

Mojo & MAX Development Skill

Mojo is a systems programming language combining Python syntax with C-level performance. MAX is Modular's AI deployment framework. This skill helps translate Python expertise into idiomatic, high-performance Mojo code.

Important: Searching the Modular Repository

When the user asks to search through Modular source code, documentation, or examples, or when you need to find specific implementation details, API usage patterns, or real-world examples not covered in these references: Repo path: repos/modular

  1. Ask the user for the repository path if not already provided
  2. Search the repository using view, search, file_search and bash tools to explore:
    • stdlib/ - Mojo standard library source code
    • examples/ - Official code examples
    • docs/ - Documentation source
    • max/ - MAX framework implementation
    • mojo/ - Mojo compiler and language features
  3. Use grep/find to locate specific functions, structs, or patterns:
    # Find all uses of a function
    grep -r "vectorize" /path/to/repo --include="*.mojo"
    
    # Find struct definitions
    grep -r "struct DeviceContext" /path/to/repo --include="*.mojo"
    
    # Find examples
    find /path/to/repo/examples -name "*.mojo" | xargs grep "pattern"
    
  4. Examine test files for usage patterns - they often show correct API usage
  5. Check proposals/ for upcoming features and design rationale

Always prefer real source code examples over generated code when available.

If user asks specifically to search internet, or if even after searching the repository, unable to find the answer then you can search internet for the answer.

Quick Reference: Python → Mojo

PythonMojoNotes
def func():fn func():fn = strict, def = flexible
x = 5var x: Int = 5Static typing required in fn
class Foo:struct Foo:Value semantics, no inheritance
def __init__(self):fn __init__(out self):out modifier required
list[int]List[Int]Capitalized types
GC manages memoryOwnership + ^ transferManual control
ValueErrorErrorDifferent error types
Dynamic typingProgressive static typingTypes enforced at compile

Core Workflow

1. Choose Function Style

# def - Python-like, flexible, implicit raises
def greet(name):
    return "Hello, " + name

# fn - strict, performant, explicit types required
fn greet(name: String) -> String:
    return "Hello, " + name

Use fn for performance-critical code. Use def for prototyping or Python interop.

2. Understand Argument Conventions

ConventionSyntaxBehavior
readfn f(x: Int)Immutable reference (default for fn)
mutfn f(mut x: Int)Mutable reference, changes visible to caller
ownedfn f(owned x: String)Takes ownership, use ^ to transfer
outfn __init__(out self)Uninitialized, must be initialized

3. Define Structs with Proper Lifecycle

@fieldwise_init  # Auto-generates field-wise constructor
struct Point(Copyable, Stringable):
    var x: Float64
    var y: Float64
    
    fn __str__(self) -> String:
        return "(" + str(self.x) + ", " + str(self.y) + ")"

4. Transfer Ownership with ^

fn consume(owned s: String):
    print(s)

fn main():
    var msg = "Hello"
    consume(msg^)  # Transfer ownership
    # msg is now uninitialized - cannot use

When to Read Reference Files

TaskReference File
Learning fn/def, var, types, structs, traitslanguage-basics.md
Understanding ownership, borrowing, lifetimesownership-memory.md
Working with pointers (Pointer, UnsafePointer, etc.)pointers.md
SIMD, vectorize, parallelize, compile-timeperformance-cpu.md
GPU kernels, DeviceContext, grids/blocksgpu-programming.md
LayoutTensor, TensorCores, shared memorygpu-advanced.md
Calling Python from Mojo or vice versapython-interop.md
MAX Serve, inference, model deploymentmax-framework.md
Common pitfalls, translation patternstranslation-patterns.md

Essential Patterns

SIMD Vectorization

from algorithm.functional import vectorize
alias simd_width = simdwidthof[DType.float32]()

fn process(data: UnsafePointer[Float32], size: Int):
    @parameter
    fn op[width: Int](i: Int):
        var v = data.load[width=width](i)
        data.store[width=width](i, v * 2.0)
    vectorize[op, simd_width](size)

Parallel Execution

from algorithm.functional import parallelize

fn parallel_work():
    @parameter
    fn task(i: Int):
        compute(i)
    parallelize[task](num_tasks)

Basic GPU Kernel

from gpu.host import DeviceContext
from gpu import block_idx, thread_idx, global_idx

fn vector_add(out: UnsafePointer[Float32, MutAnyOrigin],
              a: UnsafePointer[Float32, MutAnyOrigin],
              b: UnsafePointer[Float32, MutAnyOrigin],
              size: Int):
    var idx = global_idx.x
    if idx < size:
        out[idx] = a[idx] + b[idx]

def main():
    ctx = DeviceContext()
    # ... allocate buffers, copy data ...
    ctx.enqueue_function[vector_add, vector_add](
        out_buf, a_buf, b_buf, size,
        grid_dim=((size + 255) // 256,),
        block_dim=(256,)
    )
    ctx.synchronize()

Python Interop

from python import Python

def use_numpy():
    np = Python.import_module("numpy")
    arr = np.array([1, 2, 3, 4, 5])
    print(arr.mean())

Common Pitfalls

  1. No top-level code - wrap in def main():
  2. Constructor needs out self - fn __init__(out self):
  3. let removed - use only var
  4. Types are capitalized - Int, String, Float64
  5. No list comprehensions - use explicit loops
  6. Error not ValueError - raise Error("msg")
  7. Struct not class - value semantics, no inheritance

File Organization

project/
├── main.mojo          # Entry point with def main()
├── utils.mojo         # Helper functions/structs
└── pixi.toml          # Package management (recommended)

Build & Run

# Using pixi (recommended)
pixi init
pixi add max
pixi run mojo main.mojo

# Direct execution
mojo main.mojo

# Compile to binary
mojo build main.mojo -o app
./app

When not to use it

  • When top-level code is required without a main function
  • When inheritance-based class structures are needed

Prerequisites

Mojo compilerMAX framework

Limitations

  • No support for class inheritance
  • No support for list comprehensions

How it compares

It focuses on performance-critical systems programming and hardware-specific optimizations rather than general-purpose Python development.

Compared to similar skills

mojo-max side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
mojo-max (this skill)06moReviewAdvanced
unsloth158moNo flagsIntermediate
llm-application-dev34moReviewIntermediate
book-sft-pipeline32moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

unsloth

zechenzhangAGI

Expert guidance for fast fine-tuning with Unsloth - 2-5x faster training, 50-80% less memory, LoRA/QLoRA optimization

15117

llm-application-dev

skillcreatorai

Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration. Use for AI-powered features, chatbots, or LLM-based automation.

323

book-sft-pipeline

muratcankoylan

This skill should be used when the user asks to "fine-tune on books", "create SFT dataset", "train style model", "extract ePub text", or mentions style transfer, LoRA training, book segmentation, or author voice replication.

320

fine-tuning-with-trl

davila7

Fine-tune LLMs using reinforcement learning with TRL - SFT for instruction tuning, DPO for preference alignment, PPO/GRPO for reward optimization, and reward model training. Use when need RLHF, align model with preferences, or train from human feedback. Works with HuggingFace Transformers.

14

huggingface-tokenizers

davila7

Fast tokenizers optimized for research and production. Rust-based implementation tokenizes 1GB in <20 seconds. Supports BPE, WordPiece, and Unigram algorithms. Train custom vocabularies, track alignments, handle padding/truncation. Integrates seamlessly with transformers. Use when you need high-performance tokenization or custom tokenizer training.

14

massgen-develops-massgen

massgen

Guide for using MassGen to develop and improve itself. This skill should be used when agents need to run MassGen experiments programmatically (using automation mode) OR analyze terminal UI/UX quality (using visual evaluation tools). These are mutually exclusive workflows for different improvement goals.

13

Search skills

Search the agent skills registry