mojo-syntax

Generates Mojo code using current syntax, conventions, and removed-construct replacements.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/shakfu/mdsp --skill mojo-syntax-shakfu
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mojo-syntax
Source: https://github.com/shakfu/mdsp/tree/main/.claude/skills/mojo-syntax
Command: npx skills add https://github.com/shakfu/mdsp --skill mojo-syntax-shakfu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Pretrained models generate obsolete Mojo syntax because the language evolves rapidly, producing code that fails to compile. This Skill acts as a correction layer that replaces outdated constructs (like fn, alias, inout, @parameter) with current Mojo syntax so generated code compiles against the latest toolchain. ## Core Features & Use Cases - Removed-syntax corrections: Maps deprecated constructs (fn, let, borrowed, inout, owned, DynamicVector, UnsafePointer APIs) to their modern replacements (def, var, imm, mut, List, Pointer). - Current language rules: Covers comptime constants and assertions, argument conventions (out, mut, deinit, ref), lifecycle methods, Writable/Writer, origins, closures, SIMD, strings, and error handling. - Use Case: When translating a Python DSP kernel to Mojo, use this Skill to write struct definitions with @fieldwise_init, explicit trait conformance, std.-prefixed imports, and raises annotations that compile on the first build. ## Quick Start Write a Mojo struct with copy and move constructors plus a test suite using current Mojo syntax.

Frequently Asked Questions about mojo-syntax

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

FAQPage Schema
How do I write functions in current Mojo syntax?▼

Use `def` for every function, method, and nested function; the `fn` keyword was removed and is now a hard parse error. Functions that can raise must be explicitly marked with `raises` before the return arrow, or compilation fails.

How do I migrate old Mojo code to the latest version?▼

Replace `alias` with `comptime`, `let` with `var`, `inout` with `mut`, `owned` with `var`, and `@parameter if`/`for` with `comptime if`/`for`. Imports also move to the `std.` prefix, such as `from std.collections import ...`.

Does Mojo still support the fn keyword?▼

No, `fn` was fully removed and is a hard parse error with no valid remaining use. Every function, method, and nested function must be written with `def`, and raising functions need an explicit `raises` marker.

Why does my Mojo code fail with implicit copy errors?▼

Types not conforming to `ImplicitlyCopyable`, such as `Dict`, `List`, and structs with only `Copyable, Movable`, require explicit `.copy()` or ownership transfer with `^`. Returning or passing such values without transfer is a compile error.

What replaced Stringable and __str__ in Mojo?▼

The `Writable` trait with a `write_to` method replaces `Stringable` and `__str__`. Both `write_to` and `write_repr_to` have default implementations via reflection when all fields are `Writable`, and values convert to text with `String(value)`.