mojo-syntax

Correct Mojo source code to current syntax and conventions.

7|1|Updated Apr 9, 2026
One-click install
npx skills add https://github.com/Hundo1018/wgpu-mojo --skill mojo-syntax-hundo1018
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mojo-syntax
Source: https://github.com/Hundo1018/wgpu-mojo/tree/main/.agents/skills/mojo-syntax
Command: npx skills add https://github.com/Hundo1018/wgpu-mojo --skill mojo-syntax-hundo1018

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates incorrect or outdated Mojo code generation by providing concise, up-to-date syntax corrections and conventions so generated or human-written Mojo is compilation-ready and idiomatic.

Core Features & Use Cases

  • Syntax modernization: Replace removed constructs (alias, fn, let, etc.) with current equivalents (comptime, def, var) and enforce explicit raises and ownership conventions.
  • Practical conventions: Enforce std-prefixed imports, string byte-indexing rules, origin annotations, iterator and memory idioms, and common decorator usage.
  • Use Cases: Translating projects to Mojo, reviewing AI-generated Mojo code, writing Mojo GPU or runtime code, and preparing examples that must compile with recent Mojo toolchains.

Quick Start

Use the mojo-syntax skill to convert deprecated Mojo constructs in the provided code into modern, compilation-ready 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 fix outdated Mojo syntax like alias and let to compile with recent toolchains?

To fix outdated Mojo syntax, replace removed constructs like alias, fn, and let with modern equivalents such as comptime, def, and var. This ensures your code conforms to current conventions and is compilation-ready for recent Mojo releases.

Why do my string indexing operations fail during Mojo code migration?

String indexing operations fail during Mojo migration when byte-indexing conventions are not properly applied. Correcting Mojo syntax requires enforcing explicit string byte-indexing rules and standard std-prefixed imports to ensure accurate runtime code compilation.

How do I use comptime and ownership annotations when writing Mojo GPU code?

Writing Mojo GPU code requires explicit comptime usage and proper ownership and origin annotations. Applying these modern syntax conventions ensures your runtime code is compatible with recent Mojo toolchains and ready for compilation.

What is the best way to review AI-generated Mojo code for syntax errors?

Reviewing AI-generated Mojo code for syntax errors involves checking for explicit use of def and raises, proper origin annotations, and std-prefixed imports. Correcting these constructs modernizes code and ensures it is compilation-ready.

Do I need explicit raises and var declarations for all Mojo projects?

Yes, modern Mojo conventions require explicit use of def and raises, along with var declarations instead of let. Enforcing these syntax rules, alongside proper ownership and iterator idioms, makes your projects compilation-ready and idiomatic.