원클릭으로
preserve-error-source
Use when defining a new error variant or wrapping a lower-level error — keep the underlying error's source chain intact.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when defining a new error variant or wrapping a lower-level error — keep the underlying error's source chain intact.
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 | preserve-error-source |
| description | Use when defining a new error variant or wrapping a lower-level error — keep the underlying error's source chain intact. |
When a new error wraps a lower-level error, preserve the source so the chain remains traversable:
thiserror's #[source] attribute (or #[from]) to attach the underlying error.Box<dyn Error + Send + Sync + 'static>..to_string() on the source and embed it into the wrapper's message — that breaks Error::source() traversal and destroys structured information.Tools like anyhow, tracing, and logging walk Error::source() to render full chains and group by root cause. Stringifying the source into the message flattens it to one opaque string — the chain can't be walked and the inner error's fields are gone.
// Good
#[derive(Debug, thiserror::Error)]
pub enum AccountError {
#[error("failed to deserialize account storage")]
StorageDeser(#[source] DeserializationError),
#[error("failed to load account from {path}")]
Load { path: PathBuf, #[source] io: io::Error },
}
// Bad: source is stringified, chain is lost
#[derive(Debug, thiserror::Error)]
pub enum AccountError {
#[error("failed to deserialize account storage: {0}")]
StorageDeser(String),
}
// Bad: source baked into the message via format!
return Err(AccountError::StorageDeser(format!("{e}")));