本文へ移動
cccskills
無料GitHub で公開

coding-mojo

Develop and run Mojo code in Claude.ai containers. Handles installation, compilation, and execution. Use when writing Mojo code, benchmarking Mojo vs Python, or when user mentions Mojo, Modular, or MAX. Routes to Modular's official skills (mojo-syntax, mojo-python-interop, mojo-gpu-fundamentals) for language-specific correction layers.

インストール方法を見る

含まれるファイル(3)

  • SKILL.md6.1 KB
  • CHANGELOG.md339 B
  • README.md353 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Mojo Development in Claude.ai Containers

Mojo is a systems programming language from Modular that combines Python-like syntax with C-level performance. This skill handles container setup and execution. For language syntax and semantics, defer to Modular's official skills at github.com/modular/skills — they are authoritative correction layers for pretrained knowledge.

Installation

Install once per session (~20s via uv, ~500MB). Skip if already installed.

if mojo --version 2>/dev/null; then
  echo "Mojo already installed"
else
  # Compiler binary without ML extras (~350MB saved)
  uv pip install --system --break-system-packages modular --no-deps 2>&1 | tail -5
  # Entry points + base deps (numpy, pyyaml, rich)
  uv pip install --system --break-system-packages mojo max 2>&1 | tail -5
  mojo --version
fi

Verify:

echo 'def main(): print("Mojo ready")' > /tmp/_verify.mojo && mojo /tmp/_verify.mojo

Running Mojo Code

Quick tests (write to temp file):

cat > /tmp/test.mojo << 'EOF'
def main():
    print("hello")
EOF
mojo /tmp/test.mojo

File execution (JIT compile + run, ~1.4s overhead):

cat > /home/claude/example.mojo << 'EOF'
def main():
    print("Hello from Mojo")
EOF
mojo /home/claude/example.mojo

Build binary (for benchmarking — ~6s cold compile, but binary runs at native speed):

mojo build /home/claude/example.mojo -o /home/claude/example
/home/claude/example

Use mojo build for benchmarks — mojo (JIT) includes ~1.4s compilation overhead per run. There is no mojo -e flag; always write to a file.

Critical Syntax Corrections (v26.2)

Pretrained models generate outdated Mojo. These corrections are current as of Mojo 26.2:

Wrong (pretrained)Correct (26.2)Notes
fn main():def main():fn is deprecated; def is the only function keyword
let x = 5var x = 5let removed; var for all bindings
inout selfmut self / out selfmut for mutation, out for __init__
@parameter forcomptime forCompile-time loops
List[Int](1, 2, 3)[1, 2, 3]Collection literals
from math import sqrtfrom std.math import sqrtstd. prefix required for all stdlib modules
from time import Xfrom std.time import XIncludes perf_counter_ns, sleep, etc.
__str__ / Stringablewrite_to / WritableString conversion protocol
String(self.x) for int→strString(self.x)This one is actually correct, but str() is not
list.append(item)list.append(item^)Non-copyable types require ^ transfer operator
var x: Int = perf_counter_ns()var x: UInt = perf_counter_ns()Time functions return UInt, not Int
Implicit copy of List[T].copy() or ^ transferList is not implicitly copyable; use explicit copy or move

Companion Skills (Modular Official)

These skills from github.com/modular/skills provide deep syntax correction layers. If they are installed in the user's skill set, read them before writing Mojo code:

  • mojo-syntax — Comprehensive syntax corrections, type system, ownership model. Always use when writing any Mojo code.
  • mojo-python-interop — Calling Python from Mojo, type conversion, extension modules. Use when mixing Mojo and Python.
  • mojo-gpu-fundamentals — GPU programming (no CUDA syntax — Mojo has its own model). Reference only in Claude.ai containers (no GPU available).
  • new-modular-project — Project scaffolding with Pixi or uv. Use when starting a new Mojo/MAX project locally.

If companion skills are not installed, the correction table above covers the most common pretrained errors. For deeper work, fetch the skill content directly:

curl -sL -H "Authorization: token $GH_TOKEN" \
  -H "Accept: application/vnd.github.v3.raw" \
  "https://api.github.com/repos/modular/skills/contents/mojo-syntax/SKILL.md?ref=main"

Container Constraints

  • No GPU: Claude.ai containers are CPU-only. GPU skills are reference material for generating code the user will run locally.
  • Session-ephemeral: Mojo installation doesn't persist across conversations. Reinstall each session.
  • Build artifacts: Store in /home/claude/. Copy final outputs to /mnt/user-data/outputs/.
  • Timeout: Long compilations or benchmarks may hit the ~200s bash timeout. Break work into smaller units.

Benchmarking Pattern

Compare Mojo vs Python on the same algorithm:

# Python baseline
python3 -c "
import time
def fib(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b, a + b
    return a
# Warmup + timed runs
fib(90)
times = []
for _ in range(100):
    start = time.perf_counter()
    fib(90)
    times.append((time.perf_counter() - start) * 1e6)
import statistics
print(f'Python: median={statistics.median(times):.1f} µs, min={min(times):.1f} µs')
"

# Mojo version
cat > /home/claude/fib.mojo << 'EOF'
from std.time import perf_counter_ns

def fib(n: Int) -> Int:
    var a = 0
    var b = 1
    for _ in range(n):
        var tmp = a
        a = b
        b = tmp + b
    return a

def main():
    # Warmup
    _ = fib(90)
    
    # Timed runs
    var total_ns: UInt = 0
    var min_ns: UInt = 999999999
    for _ in range(100):
        var start = perf_counter_ns()
        _ = fib(90)
        var elapsed = perf_counter_ns() - start
        total_ns += elapsed
        if elapsed < min_ns:
            min_ns = elapsed
    print("Mojo: mean =", total_ns // 100, "ns, min =", min_ns, "ns")
EOF
mojo build /home/claude/fib.mojo -o /home/claude/fib
/home/claude/fib

Expected: Mojo is ~50x faster than CPython on tight numeric loops. SIMD and parallelism widen the gap further but require mojo-syntax and mojo-gpu-fundamentals skills for correct usage.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

GitHub repository access in containerized environments using REST API and credential detection. Use when git clone fails, or when accessing private repos/writing files via API.

日本語の概要は準備中です。原文の説明を表示しています。

oaustegard/claude-skills1502026年10月10日 更新

Decide which model, effort level, and cascade shape each subagent gets, and how to keep improvement loops safe (evaluator-as-selector, stop on regression). Routes on measured cost-per-completed-task rather than per-token price, because a tier's token count varies more by task shape than price varies across tiers. Covers per-model effort semantics, the concision lever, cascade preconditions, context handoff, and watching a subagent fan-out live. Use when spawning subagents via the Agent or Workflow tools, when choosing how to escalate a failed attempt, when fanning out more than a handful of agents, or when asked which model or effort a task should get. Grounded in a 2026-07 calibration, a 2026-08 coding-cost study, a 2026-09 seeded-bug repair battery, a 2026-10 Haiku 5.5 ladder priced per spawn, and a 2026-10 retry-versus-escalation ladder on 295 SWE-bench Verified tasks; Managed Agents API specifics are operational, not calibrated.

日本語の概要は準備中です。原文の説明を表示しています。

oaustegard/claude-skills1502026年10月10日 更新

Securely manages API credentials for multiple providers (Anthropic Claude, Google Gemini, GitHub). Use when skills need to access stored API keys for external service invocations.

日本語の概要は準備中です。原文の説明を表示しています。

oaustegard/claude-skills1502026年10月10日 更新

Guidance for asking clarifying questions when user requests are ambiguous, have multiple valid approaches, or require critical decisions. Use when implementation choices exist that could significantly affect outcomes.

日本語の概要は準備中です。原文の説明を表示しています。

oaustegard/claude-skills1502026年10月10日 更新

Pre-change blast-radius report for a symbol or file. Walks tree-sitting references, augments with a plain-text scan over non-parsed files (configs, plain docs), and clusters affected sites by feature (`_FEATURES.md`) or top-level package. Use when about to refactor, rename, or delete something in a repo you don't own — "what breaks if I change `validateUser`", "who calls this", "is this safe to remove", "where is this used", "blast radius", "impact analysis". This is the CONVERGENT pre-change risk skill — for "what is this repo?" use exploring-codebases; for "where is X?" use searching-codebases.

日本語の概要は準備中です。原文の説明を表示しています。

oaustegard/claude-skills1502026年10月10日 更新

Read Bluesky/ATProto without depending on Bluesky's AppView — interactions on a user's posts, thread replies, any repo's records, network-wide backlinks across every lexicon, an account's handle and PDS history, which collections are active network-wide, and layer-by-layer outage diagnosis. Use when bsky.app or the AppView is down or slow, when a Bluesky read returns timeouts or 5xx, when asked who liked/replied/quoted/reposted something, when pulling live Bluesky context cheaply, when reading records straight from a PDS, when asked who references a record or account anywhere on the network, whether an account has changed handle or migrated servers, or which lexicons and non-Bluesky apps are active on atproto. Complements browsing-bluesky, which routes everything through the AppView and fails when it does.

日本語の概要は準備中です。原文の説明を表示しています。

oaustegard/claude-skills1502026年10月10日 更新

oaustegard のスキルをすべて見る

このスキルの問題を報告する