| name | mojo-expert | ||||
|---|---|---|---|---|---|
| description | Use this skill for Mojo-specific authoring, review, migration, packaging, testing, ownership, or Python interop tasks that need current Mojo syntax and idioms. Do not use it by default for generic Python work, MAX architecture planning, or GPU optimization unless the task includes concrete Mojo code or APIs. | ||||
| license | Apache-2.0 | ||||
| compatibility | Portable Agent Skills skill for Codex- and Claude Code-style clients. Typical use is offline; a sibling Modular checkout improves freshness for repo-grounded answers. | ||||
| metadata |
|
Independent community-created skill. Not affiliated with or endorsed by Modular, Inc. Mojo is a trademark of Modular, Inc.
Use this skill when the user needs current, Mojo-specific help:
- writing or reviewing
.mojocode - fixing ownership, origin, or mutability issues
- migrating older Mojo syntax to current forms
- setting up packages, imports, or tests
- calling Python from Mojo or exposing Mojo to Python
This skill is intentionally narrow. It should not trigger by default for:
- generic Python coding
- MAX architecture or product questions without Mojo code authoring
- deep GPU/kernel tuning unless the task includes Mojo code to write or debug
This skill incorporates the same correction intent as Modular's official skill set:
mojo-syntaxbaseline for modern language syntax and removed formsmojo-python-interoprules when Python and Mojo interactmojo-gpu-fundamentalspatterns when authoring accelerator-targeted Mojo
Apply this baseline before relying on model priors.
Critical defaults from that baseline:
- Use
deffor new functions. Treatfnas legacy and avoid generating it in fresh code. - Use
varbindings (nolet). - Use
comptimeforms instead of removedalias/@parameter if/@parameter for. - Use modern conventions (
mut,out,deinit,ref) rather thaninout/borrowed/owned. - Prefer explicit
std.imports in examples. - Treat proposal docs as migration context, not authoritative current syntax.
Agent Skills does not define true nested subskills, so this skill uses a companion pattern:
- Keep
mojo-expertas the primary Mojo authoring/debugging skill. - For review/audit/migration-heavy requests, switch behavior to the
mojo-reviewercompanion skill if it is available in the workspace. - Preserve
mojo-expertsafety and source-priority guardrails while using that review mode.
This skill is designed to be standalone for common Mojo tasks.
- Bundled
references/files are enough for common authoring, review, migration, package, and interop answers. - If a sibling Modular checkout exists, prefer it as the freshest source of truth before answering.
- Assume the
mojoCLI may or may not be installed. If the user asks for build, test, or package commands, say when those commands require a local Mojo toolchain. - Pixi and Bazel examples are advisory patterns, not required prerequisites.
- Python interop guidance assumes the active environment provides CPython and the needed Python packages at runtime.
- Python extension-module APIs are evolving. Mark behavior as early/beta where stability is uncertain.
- Default to a chat answer unless the user explicitly asks you to create or edit files. Do not write sample files just to demonstrate a solution.
- Do not claim code was compiled, tested, packaged, or run unless you actually executed the relevant command in the current environment.
- Prefer commands, imports, and APIs that are confirmed by the sibling Modular checkout or bundled references. If a detail is not confirmed, label it as an inference instead of presenting it as settled Mojo behavior.
- Avoid inventing environment variables, build flags, or repo workflows that do not appear in the local checkout or bundled references.
- Avoid network, package-install, or global-environment steps unless the user explicitly asks for setup help.
- If asked to "review", prioritize concrete findings first: syntax drift, ownership mistakes, package/import breakage, and interop hazards.
When available, use sources in this order:
- local Modular manual docs and current examples
- local stdlib source and tests
- bundled
references/*.mdin this skill (aligned to official patterns) - local proposal docs only for migration or historical context
If the local Modular repo is missing, rely on the bundled references and be clear that the answer is based on the skill's packaged guidance rather than a fresh repo check.
- Authoring: new files, modules, APIs, examples
- Review/debugging: syntax, ownership, imports, package layout, tests
- Migration: older Mojo syntax or stale recommendations
- Interop: Python-from-Mojo or Mojo-from-Python
- GPU: accelerator code that should follow the official GPU fundamentals
- Advanced: performance-sensitive or repo-specific behavior that may need a live Modular checkout
Start with the smallest relevant file:
references/core-language.mdreferences/ownership-and-lifecycles.mdreferences/packages-testing-and-interop.mdreferences/style-and-repo-idioms.mdreferences/migrations-and-outdated-patterns.md
Avoid loading every reference unless the task truly spans them.
Before drafting code, enforce these checks:
- no removed syntax (
let,inout,borrowed,owned,alias,@parameter if,@parameter for) deffor newly generated functions- ownership conventions are explicit when mutation or transfer occurs
- interop code uses
std.pythonand current module-init patterns - package examples include
__init__.mojowhen showing package imports
- Prefer documented current syntax and real examples over memory.
- Treat proposal docs as migration context, not final authority.
- If a live repo example disagrees with an older pattern, follow the current example and explain the drift briefly.
Check for:
- explicit
std.imports when names come from the standard library - intentional ownership conventions such as
read,mut,out, or owned args - no generated legacy syntax in new code snippets
- package layouts that include
__init__.mojo - realistic test layout and run commands
- Python interop caveats about environment coupling and beta surfaces
- no claims of execution or file edits that did not actually happen
- no unverified environment variables or hidden setup steps presented as facts
Say what is confirmed and what is inferred when:
- the task depends on a repo feature not covered by bundled references
- the user asks about beta Python extension behavior
- the only support is proposal-era or historical material
Load for syntax modernization, removed-form replacements, ownership signatures, struct patterns, and explicit stdlib import behavior.
Load for read vs mut, ownership transfer, constructor/destructor patterns,
and review/debugging of mutation-heavy APIs.
Load for package layout, __init__.mojo, test organization, mojo package,
Python-from-Mojo (std.python) and Mojo-from-Python (PyInit_<name>,
PythonModuleBuilder, mojo.importer) caveats.
Load for naming, formatting, file organization, and Modular-style repo idioms.
Load when modernizing old code or correcting stale advice. Use it to explain drift, then return to current syntax and examples for the final answer.
When producing code or review feedback:
- keep the answer Mojo-specific and current
- prefer small concrete examples over broad theory
- distinguish standalone guidance from repo-verified guidance when it matters
- call out stale syntax, ownership bugs, package mistakes, and interop caveats
- avoid presenting proposal text or generic Python intuition as current Mojo truth
- prefer inline snippets over creating files unless the user asked for files
- for review tasks, list findings before summary
Refresh this skill when any of these change in the upstream Mojo docs or source:
- removed syntax and migration rules tracked by official Modular skills
- ownership or lifecycle rules
- package or import behavior
- Python interop APIs
- GPU authoring patterns used in official examples
- testing or repo idioms used in official examples
Re-run the evals and validation checks after those updates.
- Treat this folder as the portable skill root for any Agent Skills-compatible client.
- Keep provider-specific files optional and additive. A Codex-style UI metadata
file may be present under an
agents/directory, but the skill must remain usable without it. - Do not move core instructions into provider-specific config files. Keep the
shared behavior in this
SKILL.mdand the bundledreferences/andscripts/directories.