0xMiden / 0xMiden/protocol

Fix outdated MASM guidance in agent skills

Open
#3,847 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
132
Forks
167
Avg merge
1d 23h
Merged PRs (30d)
110

Description

Several [Protocol-owned agent skills](https://github.com/0xMiden/protocol/tree/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills) contain incorrect guidance. Following it can produce invalid MASM or misleading Rust.

- [`advice-provider-hygiene`](https://github.com/0xMiden/protocol/blob/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills/advice-provider-hygiene/SKILL.md#L93-L98) asserts the operand stack after `adv.has_mapkey` and says a missing lookup supplies a default. The flag is on the advice stack and a missing `adv.push_mapval` key errors; add `adv_push` before the assertion and remove the default-value claim.
- [`cheap-masm-equivalents`](https://github.com/0xMiden/protocol/blob/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills/cheap-masm-equivalents/SKILL.md#L37-L47) reverses `cdrop`'s stack order and selected value. Use `[c, b, a]`, selecting `b` when `c = 1` and `a` when `c = 0`.
- [`decouple-component-from-storage`](https://github.com/0xMiden/protocol/blob/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills/decouple-component-from-storage/SKILL.md#L10-L19) says every reusable component must receive its slot. Component-owned named slots are deterministic; limit this rule to generic utilities operating on caller-selected slots.
- [`felt-construction`](https://github.com/0xMiden/protocol/blob/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills/felt-construction/SKILL.md#L10-L17) says `Felt::new` truncates and uses `Felt::MODULUS`. `Felt::new` is checked and returns `Result`; use `Felt::ORDER` when proving the bound for `new_unchecked`.
- [`masm-inline-comments`](https://github.com/0xMiden/protocol/blob/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills/masm-inline-comments/SKILL.md#L138-L148) treats an `Asset` as one word and shows the wrong remove/add flow. Track its `ASSET_ID` and `ASSET_VALUE` words separately and preserve the original asset before removal.
- [`masm-locals-over-globals`](https://github.com/0xMiden/protocol/blob/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills/masm-locals-over-globals/SKILL.md#L7-L31) uses removed word-local mnemonics without declaring locals. Use the `_be` or `_le` forms and add `@locals`.
- [`masm-padding`](https://github.com/0xMiden/protocol/blob/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills/masm-padding/SKILL.md#L124-L149) documents removed `debug.*` instructions and a nonexistent `--debug` mode, while its [note script example](https://github.com/0xMiden/protocol/blob/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills/masm-padding/SKILL.md#L44-L52) is a `begin` program. Use `miden::core::debug` event procedures, account for their cycles, and represent note scripts as `@note_script` public procedures.
- [`u32-assert-before-u32-ops`](https://github.com/0xMiden/protocol/blob/07608d5bb9c50bdf27c14126d50c5a61322f4984/.claude/skills/u32-assert-before-u32-ops/SKILL.md#L10-L38) uses nonexistent `u32assert4` and `u32add` names and overstates which instructions require valid-u32 inputs. Use `u32assertw` and an explicit add mode such as `u32wrapping_add`; do not require prior assertions for `u32test`, `u32testw`, `u32cast`, or `u32split`.

The fix should update only these eight skill docs. No Protocol runtime behavior needs to change.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.