
from skills84
Guidelines and examples for calling Python from Mojo and building Python extension modules in Mojo, with patterns for conversion, error handling, and module exp
Provides authoritative, up-to-date guidance for writing Mojo code that interoperates with Python: importing modules, converting types, building Python extension modules, and common gotchas. It consolidates practical patterns (e.g., PythonObject usage, explicit py= conversions), example code for collections and exception handling, and instructions for exporting Mojo types and functions as Python extension modules.
Use this skill when authoring Mojo code that needs to call existing Python libraries, return Mojo types into Python, or expose Mojo functions/types as Python modules. Also valuable when building extension modules (.so) or when handling nuanced conversion rules between Mojo and Python during integration testing.
Agents that can interpret code and developer docs (Copilot-style/code assistants, Claude Code, Copilot, Cursor). This skill is primarily developer-facing and benefits agents that produce or review code.
Reference-only skill providing Mojo↔Python interop guidelines and code patterns. No scripts to execute — pure documentation. Well-structured with WRONG/CORRECT pairs that correct common pretrained model mistakes. Covers Python imports from Mojo, type conversions, PythonObject operations, exception handling, and building Python extension modules in Mojo. Clean and concise per editorial guidelines in comments.
Pure documentation skill with no executable code. Security is trivially perfect. Quality is good but not exceptional — extension module section could cover more edge cases. Architecture follows skill spec well for a reference-only skill. Usefulness is limited by Mojo's niche adoption.