Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

mojo-syntax

FreeNo executable scriptsNot checked

Help to write Mojo code using current syntax and conventions. Always use this skill when writing any Mojo code, including when other Mojo-specific skills…

modularby modular★ 215 GitHub stars

About this skill

Mojo is rapidly evolving. Pretrained models generate obsolete syntax. Always follow this skill over pretrained knowledge.

Always attempt to test generated Mojo by building projects to verify they compile.

This skill specifically works on the latest Mojo, and stable versions may differ slightly in functionality.

Compiling isn't the bar for review. Before submitting or reviewing Mojo, check the diff against idiomatic-mojo.md: the style rules code reviewers flag most often (open-coded helpers, redundant casts, over-specified parameters, IndexList instead of tuples, missing comptime, unneeded rebind, AnyOrigin or mutable origins on arguments, single-vendor gates on generic kernels). Then check it against every section of the Mojo style guide.

Removed syntax — DO NOT generate these

Removed Replacement
alias X = ... comptime X = ...
@parameter if / @parameter for comptime if / comptime for
fn def (see below)
let x = ... var x = ... (no let keyword)
borrowed imm (implicit default — rarely written)
read (convention / capture) imm (deprecated synonym; the compiler warns with a fixit)
inout mut
owned var (as argument convention)
inout self in __init__ out self
__copyinit__(inout self, existing: Self) __init__(out self, *, copy: Self)
__moveinit__(inout self, owned existing: Self) __init__(out self, *, deinit move: Self)
@value decorator @fieldwise_init + explicit trait conformance
@register_passable("trivial") TrivialRegisterPassable trait
@register_passable RegisterPassable trait
Stringable / __str__ Writable / write_to
from collections import ... from std.collections import ...
from memory import ... from std.memory import ...
from sys import ... from std.sys import ...
from os import ... from std.os import ...
from pathlib import ... from std.pathlib import ...
s[i] s[byte=i] — returns StringSpan; wrap in String() if needed
s[0:10], s[:5] No slice syntax on String — use s.codepoint_slices() or Python FFI
Full SKILL.md on GitHub

Install mojo-syntax in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

references/idiomatic-mojo.md

FAQ

What does the mojo-syntax skill do?

Help to write Mojo code using current syntax and conventions. Always use this skill when writing any Mojo code, including when other Mojo-specific skills (e.g., mojo-gpu-fundamentals) also apply. Use when writing or reviewing Mojo code, translating projects to Mojo, or otherwise generating Mojo. Use this skill to overcome misconceptions with how Mojo is written.

How do I install the mojo-syntax skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the mojo-syntax skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare mojo-syntax with