Agent skill

Masm Padding

by 0xMiden in 0xMiden/protocol

Enforce stack padding conventions for Miden Assembly (.masm) procedures based on invocation type (call vs exec).

MITAuto-check passedDevelopment

Install Masm Padding

skills CLI
$ npx skills add 0xMiden/protocol --skill masm-padding -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install 0xMiden/protocol masm-padding --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/0xMiden/protocol.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/masm-padding .claude/skills/masm-padding && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
masm-padding
GitHub stars
133
Token cost
~1.2k tokens
SKILL.md length
484 words
Files
1
Skills in repo
35
Repo updated
First seen
Licence
MIT

At a glance

Enforce stack padding conventions for Miden Assembly (.masm) procedures based on invocation type (call vs exec).

  • Works in 2 steps: Doc comments (#!) for Inputs/Outputs → Inline comments (#) showing stack state
  • Creating .masm procedures
  • SKILL.md covers Overview, Stack Depth Floor: 16, Call Procedures and Exec Procedures, plus 3 more sections
  • Needs PUB_KEY

What it does

Masm Padding is an agent skill from 0xMiden/protocol. Enforce stack padding conventions for Miden Assembly (.masm) procedures based on invocation type (call vs exec). Use when editing, reviewing, or creating .masm procedures, especially those with Invocation annotations.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Technical documentation. The repository describes itself as: Core components of the Miden protocol. The licence is MIT.

When your agent uses it

  • Creating .masm procedures
  • Especially those with Invocation annotations

Example prompts

  • “/masm-padding”

Requirements

  • A credential in PUB_KEY

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. Doc comments (#!) for Inputs/Outputs
  2. Inline comments (#) showing stack state

What it can do on your machine

Read from SKILL.md and the folder at commit 474c88e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are masm).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • PUB_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Masm Padding loads about 1.2k tokens when it runs. Until then it costs about 58 tokens; SKILL.md has 484 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~58
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from 0xMiden/protocol at commit 474c88e, republished under its MIT licence (© 0xMiden). 484 words, ~1,223 tokens.

Download SKILL.mdSave it as .claude/skills/masm-padding/SKILL.md (or your agent's skills folder).
name
masm-padding
description
Enforce stack padding conventions for Miden Assembly (.masm) procedures based on invocation type (call vs exec). Use when editing, reviewing, or creating .masm procedures, especially those with Invocation annotations.

MASM Padding Conventions

Overview

Padding requirements differ based on procedure invocation type:

InvocationPadding RequiredInput/Output Elements
callExplicit padding in commentsExactly 16
execNo explicit paddingNo requirement

Stack Depth Floor: 16

Miden VM enforces a minimum operand-stack depth of 16 elements (MIN_STACK_DEPTH = 16 in the VM core). When an operation would naively shrink the stack below 16, the VM auto-fills the missing positions with zeros via the overflow-table mechanism. The actual depth stays exactly 16; only the visible content shrinks.

This invariant applies at the entry boundary of:

  • call procedures,
  • note scripts and transaction scripts (entered via dyncall at depth 16).

It does NOT apply to mid-chain exec procedures, which share the caller's stack and can drop the visible count below 16 by consuming caller elements (see Danger Zone).

Tracking the floor in inline comments

When the naive math would put the stack below 16, the # => tracker must reflect the actual auto-padded depth, not the naive count.

masm
# entry at depth 16: [VALUE, pad(12)]
dropw
# => [pad(16)]   # correct: VALUE replaced with zeros, depth still 16

Not:

masm
# => [pad(12)]   # wrong: depth is still 16, only the visible content shrank

This shows up most often at the start of note scripts that don't use their input arguments:

masm
@note_script
pub proc main(args: NoteArgs)
    dropw
    # => [pad(16)]
    ...
end

Call Procedures

Procedures invoked with call must have explicit padding in:

  1. Doc comments (#!) for Inputs/Outputs
  2. Inline comments (#) showing stack state
Doc Comment Format

Use pad(N) notation where N + other elements = 16:

masm
#! Inputs:  [ASSET, pad(12)]
#! Outputs: [pad(16)]
#!
#! Invocation: call
pub proc receive_asset
Inline Comment Format

Track padding through the procedure:

masm
exec.native_account::set_item
# => [OLD_VALUE, pad(12)]

dropw
# => [pad(16)] auto-padded to 16 elements    

Exec Procedures

Procedures invoked with exec should NOT have explicit padding:

masm
#! Inputs:  [PUB_KEY]
#! Outputs: []
#!
#! Invocation: exec
pub proc authenticate_transaction
Why No Padding for Exec

exec procedures share the caller's stack directly. Explicit padding would be misleading because:

  • The actual stack may have additional elements from the caller
  • The procedure may consume caller's stack elements
Danger Zone

If an exec procedure's stack falls below the specified stack elements, it will consume stack items from its caller, potentially leading to unexpected behavior. This is a bug and should be fixed by ensuring the procedure maintains sufficient stack depth and avoiding dropping more stack elements than available.

Show full SKILL.md (169 more words)Show less
Example of Dangerous Behavior
masm
# => [num_approvers, threshold]
dropw # dropw drops 4 elements, which will result in "negative" stack consumption (consuming 2 elements from the caller's stack)

Intermediate States

Inside a procedure, the stack may temporarily exceed 16 elements:

masm
# => [num_approvers, threshold, MULTISIG_CONFIG, pad(12)]
#     ^--- 18 elements total, must be reduced before return

These extra elements must be explicitly dropped before the procedure returns (directly or via called procedures).

Debugging Stack Depth

Use the event-based procedures in miden::core::debug to inspect VM state. These are ordinary procedure calls: they emit print events whenever invoked, affect the program being executed, and consume cycles (print_stack costs 3 cycles). Remove them from production programs.

masm
use miden::core::debug

begin
    exec.debug::print_stack
    sdepth push.16 eq assert.err="depth must be 16 here"
end

Validation Checklist

For all invocation types:

  • Inline # => trackers reflect the post-auto-pad depth (never below 16) at boundaries that enforce the floor (call, note scripts, tx scripts)
  • No miden::core::debug procedure call is left in production MASM

For call procedures:

  • Inputs doc comment shows exactly 16 elements with pad(N)
  • Outputs doc comment shows exactly 16 elements with pad(N)
  • Inline comments use # => format with pad(N) notation
  • All intermediate states track the full stack including padding

For exec procedures:

  • No pad(N) in Inputs/Outputs doc comments
  • No explicit padding in inline stack state comments
  • Verify stack never drops below safe depth

© 0xMiden, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/masm-padding of 0xMiden/protocol.

Open the folder on GitHubat commit 474c88e

Compare with similar skills

Masm Padding next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Masm Padding compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Masm Padding this skill0xMiden/protocol133—~1.2kAutomated safety check: PassMIT
Diagram Designcathrynlavery/diagram-design45k1 repos~7.5kAutomated safety check: PassMIT
Simple Englishmoeru-ai/airi50k2 repos~4.6kAutomated safety check: PassMIT
Get API Docs with chubandrewyng/context-hub14k2 repos~775Automated safety check: PassMIT
Doc SyncJetBrains/ideavim10k2 repos~2.6kAutomated safety check: PassMIT
Mailspring App ScreenshotsFoundry376/Mailspring18k—~1.5kAutomated safety check: PassGPL-3.0

Similar skills

  • Diagram Design

    cathrynlavery/diagram-design

    Creates branded diagrams, from architecture, flowchart and sequence to charts and maps, as self-contained HTML with inline SVG, with import from draw.io, Mermaid and Excalidraw.

    45k GitHub starsUsed in 1 repo~7.5k tokens
    DevelopmentAuto-check passed
  • Simple English

    moeru-ai/airi

    Write or rewrite technical text with the rules of ASD-STE100 Simplified Technical English so it is clear, unambiguous, and free of AI slop.

    50k GitHub starsUsed in 2 repos~4.6k tokens
    DevelopmentAuto-check passed
  • Get API Docs with chub

    andrewyng/context-hub

    Fetches current documentation for third-party APIs and SDKs with the chub CLI before the agent writes code against them, instead of relying on remembered API shapes.

    14k GitHub starsUsed in 2 repos~775 tokens
    DevelopmentAuto-check passed
  • Doc Sync

    JetBrains/ideavim

    Official

    Keeps IdeaVim documentation in sync with code changes. An agent skill from JetBrains/ideavim.

    10k GitHub starsUsed in 2 repos~2.6k tokens
    DevelopmentAuto-check passed
  • Mailspring App Screenshots

    Foundry376/Mailspring

    Captures screenshots of the running Mailspring dev app for docs, PRs or visual checks by launching it with a debugging port, driving the UI and clipping to an element.

    18k GitHub stars~1.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Draw.io Diagram Studio

    Agents365-ai/drawio-skill

    Creates and edits editable draw.io diagrams from descriptions, code, infrastructure files, SQL and API schemas, with sync, review, test and export tools.

    10k GitHub stars~2.4k tokensUpdated 6 days ago
    DevelopmentAuto-check: notes

More from 0xMiden/protocol

All 35 skills in this repo
  • Advice Provider Hygiene

    0xMiden/protocol

    A skill your agent uses when writing kernel, account, or note MASM code that reads from or writes to the advice provider (advice stack / advice map) — validate advice data.

    133 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Cheap Masm Equivalents

    0xMiden/protocol

    A skill your agent uses when writing or reviewing MASM hot paths or loops — prefer the cheaper equivalent: loop counters and pointers on the operand stack instead of procedure locals, neq.0 over…

    133 GitHub stars~804 tokensUpdated yesterday
    Auto-check passed
  • Keep CHANGELOG.md entries to a single concise sentence. An agent skill from 0xMiden/protocol.

    133 GitHub stars~805 tokensUpdated yesterday
    Auto-check passed
  • Keep PR and issue descriptions short and decision-focused. An agent skill from 0xMiden/protocol.

    133 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Conversion Method Naming

    0xMiden/protocol

    A skill your agent uses when naming a conversion or accessor method in Rust — follow the Rust API naming conventions for the method's cost and ownership.

    133 GitHub stars~450 tokensUpdated yesterday
    Auto-check passed
  • A skill your agent uses when writing a generic MASM utility that accesses a caller-selected account storage slot — receive the slot as a parameter so the utility is portable across storage layouts.

    133 GitHub stars~529 tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Masm Padding

What does Masm Padding do?

Enforce stack padding conventions for Miden Assembly (.masm) procedures based on invocation type (call vs exec). Masm Padding is an agent skill from 0xMiden/protocol.masm) procedures based on invocation type (call vs exec).

When should I use Masm Padding?

Masm Padding fits situations like: creating .masm procedures; especially those with Invocation annotations.

How do I install Masm Padding in Claude Code?

Run `npx skills add 0xMiden/protocol --skill masm-padding -a claude-code`. Or copy the skill folder (.claude/skills/masm-padding in 0xMiden/protocol) into .claude/skills/masm-padding in your project. Claude Code loads it when a task matches its description.

How do I install Masm Padding in Codex?

Run `npx skills add 0xMiden/protocol --skill masm-padding -a codex`. Or copy the skill folder (.claude/skills/masm-padding in 0xMiden/protocol) into .agents/skills/masm-padding in your project. Codex loads it when a task matches its description.

Can I use Masm Padding in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add 0xMiden/protocol --skill masm-padding -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/masm-padding, .gemini/skills/masm-padding, .github/skills/masm-padding and .opencode/skills/masm-padding in your project.

What does Masm Padding need to run?

Going by SKILL.md and its folder, Masm Padding needs credentials named PUB_KEY. Our summary lists: A credential in PUB_KEY.

Does Masm Padding access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Masm Padding safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Masm Padding use?

Masm Padding is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Masm Padding use?

About 1.2k tokens (SKILL.md is roughly 4.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Masm Padding?

Skills that share tags, products or a category with Masm Padding: Diagram Design (cathrynlavery/diagram-design, 45k stars), Simple English (moeru-ai/airi, 50k stars), Get API Docs with chub (andrewyng/context-hub, 14k stars) and Doc Sync (JetBrains/ideavim, 10k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Masm Padding?

0xMiden (a GitHub organization) maintains it in 0xMiden/protocol, which has 133 GitHub stars. The repository holds 35 skills in this directory. The repository was last updated on October 7, 2026.

Source: 0xMiden/protocol on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.