一键导入
masm-inline-comments
Enforce inline commenting conventions for Miden Assembly (.masm) files. Use when editing, reviewing, or creating .masm files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Enforce inline commenting conventions for Miden Assembly (.masm) files. Use when editing, reviewing, or creating .masm files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | masm-inline-comments |
| description | Enforce inline commenting conventions for Miden Assembly (.masm) files. Use when editing, reviewing, or creating .masm files. |
Inline comments (single #) should begin with a lowercase letter.
# good: lowercase start
exec.native_account::remove_asset
# => [ASSET, note_idx, pad(11)]
# Bad: uppercase start (avoid)
# Remove the asset from the account
Only add comments that provide value. Skip comments for self-explanatory operations. Only apply this rule to new code you write. Do not remove comments that are present in the code.
Skip comments for:
add, sub, mul, divdrop, swap, dupif.true, while.true, endDo comment:
# => [ptr, ASSET, end_ptr]# compute the pointer at which we should stop iterating# => [...] trackersInsert a blank line after a # => [...] stack-state tracker, except when the next non-blank line is one of:
end (proc / while.true / if.true / repeat.N closing).else, else.true, or else.false.# => line that continues the same multi-line stack state.# continuation comment that explains the tracker.This pairs each stack state visually with the operation that produced it and lets the eye skim from one labeled state to the next.
Good:
exec.native_account::remove_asset
# => [ASSET, note_idx, pad(11)]
dupw dup.8 movdn.4
# => [ASSET, note_idx, ASSET, note_idx, pad(11)]
Also OK (no blank line before end or control flow):
# => [pad(16)]
end
An inline # => [...] tracker uses the same item names, capitalization, and (N) span notation as the #! doc block for the enclosing procedure (see masm-doc-comments skill):
note_idx, final_nonce.ASSET, RECIPIENT.(N) spans stay lowercase: pad(12), foreign_procedure_inputs(15).Composite names like account_id_{suffix,prefix} are a doc-block shorthand for a group of felts. In inline trackers they decompose into their individual felts since each felt occupies one stack slot:
#! Inputs: [account_id_{suffix,prefix}, amount]
pub proc transfer
# => [account_id_suffix, account_id_prefix, amount]
...
end
Use the vocabulary already established in the surrounding code and doc comments. Do not coin new terms or colloquialisms for a concept that already has a name — a value written to a local is "stored", not "stashed". This applies to inline comments and to constant-header comments.
Inline comments explain what the code does for a future reader, not why a particular PR made a change. Avoid PR narrative and framing such as "this is the X that prevents Y"; describe the operation and its purpose as the code stands.
When accessing individual elements of a word, show the word destructured into elements, grouped with brackets, e.g.:
# => [ASSET_ID, ASSET_VALUE]
# => [[asset_class_suffix, asset_class_prefix, faucet_id_suffix_and_metadata, faucet_id_prefix], ASSET_VALUE]
dup
# => [asset_class_suffix, ASSET_ID, ASSET_VALUE]
Good:
# remove the asset from the account
exec.native_account::remove_asset
# => [ASSET, note_idx, pad(11)]
dupw dup.8 movdn.4
# => [ASSET, note_idx, ASSET, note_idx, pad(11)]
exec.output_note::add_asset
# => [ASSET, note_idx, pad(11)]
Avoid:
# Swap the top two elements
swap # swap
# Drop the word
dropw # drops 4 elements
Enforce type-signature conventions for public Miden Assembly (.masm) procedures. Use when adding, editing, or reviewing a `pub proc` signature — parameter and return types, semantic type aliases, struct/array/tuple types, and how the signature maps onto the operand stack and the doc-comment Inputs/Outputs.
Enforce doc comment conventions for Miden Assembly (.masm) procedures. Use when editing, reviewing, or creating .masm procedures, especially when documenting inputs, outputs, panic conditions, or invocation types.
Use when writing kernel, account, or note MASM code that reads from or writes to the advice provider (advice stack / advice map) — validate advice data.
Use when writing a Rust test that exercises a failure path or a MASM test that expects a `panic` / `assert` — assert on the specific expected error variant or error code.
Use when writing or reviewing MASM hot paths — prefer the cheaper equivalent instruction: `neq.0` over `gt.0` for non-zero checks, `cdrop` over an `if/else` selecting between two values, `dup.N` over `loc_load` for a value still on the stack, `eqw` over element-wise word comparison, `u32gt`/`u32lt` over generic `gt`/`lt` on known-u32 operands.
Use when writing Rust arithmetic on amounts or other quantities derived from external/user input — guard against silent overflow.