0xmiden/agent-tools/masm-constants

Claude Code and agent skill by 0xmiden/agent-tools

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Enforce constant definition and organization conventions for Miden Assembly (.masm) files. Use when editing, reviewing, or creating .masm files that define or use constants.

Install

npx vskill@latest install 0xmiden/agent-tools/masm-constants

SKILL.md

MASM Constant Conventions

Placement

Constants must be defined at the top of the file, before any procedure definitions, but after imports or type aliases.

Organization

Constants Section (first)

Group non-error constants by topic. Use blank lines between sections. Common topics:

  • Slot names – use word("path::to::slot") for slot identifiers
  • Memory pointer offsets – offsets into memory regions
  • Magic numbers / values – domain-specific literals
  • Event identifiers – for emit / trace

Order sections by dependency or by usage frequency. Put the most widely used first.

Errors Section (after constants)

Errors (panic/assert error codes, e.g. ERR_*) go in a dedicated "errors" section, placed after the constants section. Define them with string values describing the error.

Naming

Memory Pointers

Memory pointer constants describe offsets into memory regions that are shared or global (e.g. layout of a memory region, input/output structure offsets). They are not scoped to a single procedure and do not use the procedure prefix.

masm
# Good: descriptive, shared usage
const ASSET_OFF = 0
const AMOUNT_OFF = 1
const NOTE_DATA_LEN = 16
# Or grouped by memory region if applicable
const INPUT_PTR_OFF = 0
const INPUT_LEN_OFF = 1
Memory Locals Offsets

Memory locals offsets are procedure-scoped: they describe offsets within a procedure's local memory. They must be prefixed with the procedure name they belong to:

masm
# Good: procedure-prefixed
const validate_note_NOTE_IDX_LOC = 0
const validate_note_ASSET_LOC = 1
const process_input_INPUT_PTR_OFF = 0
# Bad: generic, ambiguous
const NOTE_IDX_LOC = 0
const ASSET_LOC = 1
const INPUT_PTR_OFF = 0

This keeps offsets scoped and avoids collisions when multiple procedures use local memory.

Formatting

Put spaces around the equals sign.

Errors – string value describing the error:

masm
const ERR_BRIDGE_NOT_MAINNET = "bridge not mainnet"
const ERR_UNAUTHORIZED = "unauthorized"

Slots – use word() with the slot path:

masm
const BRIDGE_ID_SLOT = word("miden::agglayer::faucet")
const SLOT_ACCOUNT_ID = word("account::id")

Offsets / numeric values – plain numbers:

masm
const validate_note_NOTE_IDX_LOC = 0
const validate_note_ASSET_LOC = 1

Example Layout

masm
# CONSTANTS
# =================================================================================================
# Slots
const BRIDGE_ID_SLOT = word("miden::agglayer::faucet")
const SLOT_ACCOUNT_ID = word("account::id")
# Memory pointers
const ASSET_OFF = 0
const AMOUNT_OFF = 1
# validate_note locals
const validate_note_NOTE_IDX_LOC = 0
const validate_note_ASSET_LOC = 1
# process_input locals
const process_input_INPUT_PTR_OFF = 0
const process_input_LEN_OFF = 1
# ERRORS
# =================================================================================================
const ERR_BRIDGE_NOT_MAINNET = "bridge not mainnet"
const ERR_UNAUTHORIZED = "unauthorized"
const ERR_NOTE_NOT_FOUND = "note not found"
# PUBLIC INTERFACE
# =================================================================================================
pub proc validate_note
...
end

Validation Checklist

  • [ ] Errors in dedicated section, placed after constants
  • [ ] All constants defined at top of file
  • [ ] Non-error constants grouped by topic with blank lines between sections
  • [ ] Memory pointers (shared/global) use descriptive names without procedure prefix
  • [ ] Memory locals offsets prefixed with procedure name
  • [ ] Spaces around = in all constant definitions
  • [ ] Section comments used to label topic groups

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/0xmiden/agent-tools/masm-constants/badge)](https://verified-skill.com/skills/0xmiden/agent-tools/masm-constants)

Something wrong with this skill or its page? Tell us.