← スキル一覧に戻る

mojo-lint-syntax
by mvillmow
Training framework written in Mojo
⭐ 11🍴 4📅 2026年1月24日
SKILL.md
name: mojo-lint-syntax description: "Validate Mojo syntax against current v0.26.1+ standards. Use to catch syntax errors before compilation." category: mojo mcp_fallback: none agent: test-engineer user-invocable: false
Lint Mojo Syntax
Validate Mojo code against v0.26.1+ syntax standards.
When to Use
- Writing new Mojo code before testing
- Reviewing Mojo code for syntax issues
- Migrating code from older Mojo versions
- Checking for deprecated patterns
- Pre-commit validation of Mojo files
Quick Reference
# Validate single executable file (with main())
mojo build -I . file.mojo
# Build entire package (for library files)
mojo package shared
# Format code (fixes many syntax issues)
pixi run mojo format .
# Check for deprecated patterns
grep -r "inout self\|@value\|DynamicVector\|->" *.mojo | grep -v "result\|fn"
IMPORTANT: Library files with relative imports CANNOT be validated using mojo build - use mojo package instead.
Common Syntax Issues
Deprecated Patterns:
- ❌
inout self→ ✅out selfin__init__, ✅mut selfin methods - ❌
@value→ ✅@fieldwise_initwith trait list - ❌
DynamicVector→ ✅List - ❌
-> (T1, T2)→ ✅-> Tuple[T1, T2]
Constructor Issues:
- Wrong parameter type in
__init__(must beout self) - Missing trait conformances (
Copyable,Movable) - Incorrect initialization order
Type Issues:
- Missing type annotations (required in fn declarations)
- Mismatched types in assignments
- Invalid type parameters
Ownership Issues:
- Missing transfer operator
^for non-copyable types - Using
varparameter incorrectly - Copy/move semantics violations
Validation Workflow
- Identify file type: Determine if file is library (has relative imports) or executable (has main())
- Check syntax: Run appropriate command:
- Executable files:
mojo build -I . file.mojo - Library files: Skip standalone compilation (part of package)
- Executable files:
- Fix format: Run
pixi run mojo formatto auto-fix style - Verify patterns: Check for deprecated patterns
- Type check: Ensure all types are correct
- Ownership check: Verify ownership semantics
- Package validation: Use
mojo package sharedfor library files - Report issues: List all problems found
Output Format
Report syntax issues with:
- File - Which file has the issue
- Line - Line number of error
- Error - Syntax error message
- Pattern - What deprecated/wrong pattern was used
- Fix - How to correct it
- Severity - Critical (won't compile) or warning
Error Handling
| Problem | Solution |
|---|---|
| Compiler not found | Verify mojo is installed and in PATH |
| Module not found | Add -I . flag to include current directory |
| Encoding issues | Convert file to UTF-8 |
| Version mismatch | Check mojo version against v0.26.1+ |
| Large files | Process one file at a time |
Validation Checklist
Before committing Mojo code:
- File compiles with
mojo build - No syntax errors in compiler output
- No deprecated patterns (inout, @value, DynamicVector)
- All
__init__useout self(notmut self) - All non-copyable returns use
^operator - All type annotations present in fn declarations
- Zero compiler warnings
References
- See CLAUDE.md for v0.26.1+ syntax standards
- See validate-mojo-patterns for pattern validation
- See mojo-format skill for code formatting
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です