원클릭으로
check-memory-safety
Check Mojo code for memory safety issues (ownership violations, use-after-free, etc.). Use to catch memory bugs.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Check Mojo code for memory safety issues (ownership violations, use-after-free, etc.). Use to catch memory bugs.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Run section orchestrators to coordinate multi-component workflows. Use when starting work on a section.
Validate agent YAML frontmatter and configuration. Use before committing agent changes or in CI.
Reply to PR review comments using the correct GitHub API endpoint. Use when responding to inline code review feedback (not gh pr comment).
Run Mojo tests using mojo test command. Use when executing tests or verifying test coverage.
Track implementation progress against plan. Use to monitor component delivery and identify blockers.
Check agent configuration coverage across hierarchy levels and phases. Use to ensure complete agent system coverage.
| name | check-memory-safety |
| description | Check Mojo code for memory safety issues (ownership violations, use-after-free, etc.). Use to catch memory bugs. |
| category | mojo |
| mcp_fallback | none |
Validate Mojo code for memory safety violations and ownership issues.
# Find potential use-after-free patterns
grep -n "var .* = .*\^" *.mojo | head -20
# Check for uninitialized access
grep -n "List\[.*\]()" *.mojo | grep -A 2 "\..*\["
# Verify ownership transfer
grep -n "owned\|var.*=" *.mojo | sort
# Check pointer operations
grep -n "DTypePointer\|alloc\|free\|__del__" *.mojo
# Find scope issues
grep -n "{" *.mojo | wc -l # Check nesting depth
Safe Ownership Transfer:
fn take(var data: List[Int]) - Caller loses accessreturn self.data^ - Transfer from struct fieldvar copy = data^ - Move to new variablefn take(data: List[Int]) - Ambiguous, use varreturn self.data - Missing transfer operatorSafe Initialization:
var shape = List[Int]() then shape.append(dim)var data = DTypePointer[DType.float32].alloc(size)size > 0 before allocationvar list = List[Int]() then list[0] = value (uninitialized)alloc(0) or alloc(negative) (invalid size)Safe Pointer Usage:
alloc(size)Safe Scope Management:
Report memory safety issues with:
Uninitialized List Access:
var list = List[Int](); list[0] = 5list.append(5) insteadUse After Move:
var a = list^; print(list) (list moved, now invalid)Missing Bounds Check:
tensor._data[index] without size checkassert index < size or check in loopPointer Without Size:
var ptr = alloc(size) but size not trackedDouble-Free:
free() called twice on same pointer| Problem | Solution |
|---|---|
| Compiler not available | Build with mojo build to get errors |
| Complex ownership | Trace step-by-step through ownership chain |
| Generic code | Check all type instantiations |
| External code | Verify contract assumptions |
| False positives | Verify with test execution |
Before committing Mojo code:
^