一键导入
use-test-fixtures
Use when a Rust or MASM test needs to construct an account, note, transaction, or other domain object — build it with the existing test fixtures.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when a Rust or MASM test needs to construct an account, note, transaction, or other domain object — build it with the existing test fixtures.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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 inline commenting conventions for Miden Assembly (.masm) files. Use when editing, reviewing, or creating .masm files.
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.
| name | use-test-fixtures |
| description | Use when a Rust or MASM test needs to construct an account, note, transaction, or other domain object — build it with the existing test fixtures. |
When a test needs a domain object, reach for the existing fixture infrastructure:
NoteBuilder.ScriptBuilder.AccountIdBuilder (or the existing ACCOUNT_ID_* constants).rand_value() (deterministic seed-driven RNG).AccountBuilder with the testing feature.Don't write a new AccountId::dummy(...), Note::test_only(...), or one-off random helper. If the existing fixtures can't express what you need, extend them — don't fork.
Shared fixtures encode the domain's validation rules, so a fixture-built object has the right bits and survives serialization; a hand-rolled dummy() usually doesn't, letting tests pass against invariants the real code never enforces. Reusing fixtures also lets one upgrade propagate to every test.
// Good
let note = NoteBuilder::new()
.recipient(test_recipient())
.with_asset(rand_value())
.build()?;
let account_id = AccountIdBuilder::new().build();
// Bad
let note = Note {
metadata: NoteMetadata::default(),
inputs: NoteInputs::default(),
assets: NoteAssets::default(),
recipient: NoteRecipient::dummy(),
};
let account_id = AccountId::try_from(Word::default()).unwrap();