Skip to content
Back to skills

Emit

ASecurity

Use when working on the Miden compiler (`cargo miden`, `cargo-miden`) and its integration test suite, debugging compiler issues or failing tests, or implementing compiler changes and you need to inspect intermediate artifacts. Covers `MIDENC_EMIT` (the environment-variable equivalent of `--emit`) for emitting WAT/HIR/MASM (and related outputs), plus `MIDENC_EMIT_MACRO_EXPAND` for dumping macro-expanded Rust via `cargo expand` for integration-test fixtures.

  • 666 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added February 8, 2026
developmentrustgodebugging

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill emit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Emit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Emit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-emit/badge)](https://www.skillsdirectory.com/skills/majiayu000-emit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: emit
description: |
  Use when working on the Miden compiler (`cargo miden`, `cargo-miden`) and its integration test suite, debugging compiler issues or failing tests, or implementing compiler changes and you need to inspect intermediate artifacts. Covers `MIDENC_EMIT` (the environment-variable equivalent of `--emit`) for emitting WAT/HIR/MASM (and related outputs), plus `MIDENC_EMIT_MACRO_EXPAND` for dumping macro-expanded Rust via `cargo expand` for integration-test fixtures.
---

# MIDENC Emit (Intermediate Artifacts) + Macro Expand

## Quick start

- Emit all intermediate IRs (WAT + HIR + MASM) into a `ir_dump` directory:
  - `MIDENC_EMIT=ir=ir_dump`
- Emit HIR to stdout:
  - `MIDENC_EMIT=hir=-`
- Emit MASM to a specific file:
  - `MIDENC_EMIT=masm=out.masm`
- Dump macro-expanded Rust for integration tests into a `ir_dump` directory:
  - `MIDENC_EMIT_MACRO_EXPAND=ir_dump cargo make test`

## `MIDENC_EMIT` (same syntax as `--emit`)

### Syntax

- Set `MIDENC_EMIT` to a comma-delimited list of `KIND[=PATH]` specs, e.g.:
  - `MIDENC_EMIT=wat,hir,masm`
  - `MIDENC_EMIT=ir=ir_dump`

### Useful kinds for pipeline debugging

- `wat`: WebAssembly text format (`.wat`)
- `hir`: Miden High-level IR (`.hir`)
- `masm`: Miden Assembly text (`.masm`)
- Shorthands:
  - `ir`: emits `wat,hir,masm` together (WAT + HIR + MASM)

### PATH rules (practical)

- Omit `=PATH` to use the CWD.
- Use `=DIR` to emit `DIR/<stem>.<ext>` for each requested output type:
  - Example: `MIDENC_EMIT=ir=target/emit` writes `target/emit/<stem>.wat`, `target/emit/<stem>.hir`, `target/emit/<stem>.masm`.
- Use `=-` to write textual outputs to stdout (e.g. `hir=-`, `wat=-`, `masm=-`).
  - Note: `ir=-` is invalid; `ir` expects a directory (or no path).
- Use `=FILE` to write a single output to a specific file path:
  - Example: `MIDENC_EMIT=hir=my_dump.hir`.

## `MIDENC_EMIT_MACRO_EXPAND` (integration tests only)

When you need to see the actual Rust code after macros have expanded (helpful when debugging
fixtures that use proc-macros, attribute macros, derives, or cfg-gated code), enable macro expansion dumps.

### Behavior

- If `MIDENC_EMIT_MACRO_EXPAND` is unset: nothing happens.
- If set to an empty value or `1`: writes `*.expanded.rs` files into the current working directory.
- If set to any other non-empty value: treats it as an output directory (created if missing).
- The integration test harness runs `cargo expand` and writes one file per fixture/test:
  - `<test_name>.expanded.rs`

## Debugging workflow (recommended)

1. Reproduce on a single test case if possible.
2. Emit intermediate artifacts to a dedicated folder:
   - `MIDENC_EMIT=ir=target/emit/<case> ...`
3. If the failing test involves Rust fixtures/macros:
   - `MIDENC_EMIT_MACRO_EXPAND=target/expand/<case> ...`

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.