Agent skill

Optimizer Debug

by wado-lang in wado-lang/wado

Debug the Wado optimizer with the WADOTRACE, WADODUMPPASSBEFORE/AFTER, WADOLISTPASSES, and WADOSKIPPASS env vars.

MITAuto-check passedDevelopment

Install Optimizer Debug

skills CLI
$ npx skills add wado-lang/wado --skill optimizer-debug -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install wado-lang/wado optimizer-debug --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/wado-lang/wado.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/optimizer-debug .claude/skills/optimizer-debug && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
optimizer-debug
GitHub stars
116
Token cost
~2.5k tokens
SKILL.md length
1,245 words
Files
1
Skills in repo
14
Repo updated
First seen
Licence
MIT

At a glance

Debug the Wado optimizer with the WADOTRACE, WADODUMPPASSBEFORE/AFTER, WADOLISTPASSES, and WADOSKIPPASS env vars.

  • Works in 3 steps: WADO_TRACE=opt_loop lists, per… → WADO_TRACE=const_fold names each… → WADO_DUMP_PASS_BEFORE/_AFTER= around a…
  • A NIR/WIR pass is in question — wrong code
  • SKILL.md covers Quick recipes, Workflow for a fixed-point…, Workflow for output that is… and Workflow for an optimization…, plus 4 more sections
  • Calls cargo

What it does

Optimizer Debug is an agent skill from wado-lang/wado. Debug the Wado optimizer with the WADOTRACE, WADODUMPPASSBEFORE/AFTER, WADOLISTPASSES, and WADOSKIPPASS env vars. Use whenever a NIR/WIR pass is in question — wrong code, a WIR pipeline ICE, or just to see what a pass did to the IR. For guest-side slowness see wado-performance.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Debugging. It works with WebAssembly. The repository describes itself as: The Wado Programming Language. The licence is MIT.

When your agent uses it

  • A NIR/WIR pass is in question — wrong code
  • A WIR pipeline ICE
  • Just to see what a pass did to the IR

Example prompts

  • “/optimizer-debug”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. WADO_TRACE=opt_loop lists, per iteration, every pass that reported a
  2. WADO_TRACE=const_fold names each function const_fold changed, so a
  3. WADO_DUMP_PASS_BEFORE/_AFTER= around a late round, diffed, says

What it can do on your machine

Read from SKILL.md and the folder at commit 827e44b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • cargo

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Optimizer Debug loads about 2.5k tokens when it runs. Until then it costs about 76 tokens; SKILL.md has 1,245 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~76
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from wado-lang/wado at commit 827e44b, republished under its MIT licence (© wado-lang). 1,245 words, ~2,514 tokens.

Download SKILL.mdSave it as .claude/skills/optimizer-debug/SKILL.md (or your agent's skills folder).
name
optimizer-debug
description
Debug the Wado optimizer with the WADO_TRACE, WADO_DUMP_PASS_BEFORE/AFTER, WADO_LIST_PASSES, and WADO_SKIP_PASS env vars. Use whenever a NIR/WIR pass is in question — wrong code, a WIR pipeline ICE, or just to see what a pass did to the IR. For guest-side slowness see wado-performance.

Optimizer pass debugging

The optimize.rs and wir_optimize.rs pipelines are big — many passes, each rewriting the IR in place. When a pass is wrong, the symptom usually shows up two passes later as "the WIR validates but produces the wrong behaviour" or as "the codegen finds an invalid Wasm module" deep in the final emitter. The debug hooks below let you diff the IR around any single pass without sprinkling eprintln! through pass internals.

All three are env-var-driven so they work uniformly across wado compile, wado test, wado run, and Kiln invocations from package-gale.

Quick recipes

Which pass changed the IR?
sh
WADO_LIST_PASSES=1 cargo run --bin wado --quiet -- compile -O1 file.wado -o scratchpad/out.wasm 2>&1 | grep '\[pass\]'

Prints every pass name in execution order. Lets you correlate the order in source (optimize.rs and wir_optimize.rs) with what actually fires under your -Ox choice.

What does pass X produce?
sh
WADO_DUMP_PASS_AFTER=wir/sroa_multi_value_returns \
  cargo run --bin wado --quiet -- compile -O1 file.wado -o scratchpad/out.wasm 2>scratchpad/after.log

scratchpad/after.log holds the full WIR (or NIR, depending on the pass) right after the named pass, framed by === WIR after <name> === / === end WIR after <name> === (NIR passes use === NIR after <name> ===).

What does pass X consume?
sh
WADO_DUMP_PASS_BEFORE=wir/sroa_multi_value_returns \
  cargo run --bin wado --quiet -- compile -O1 file.wado -o scratchpad/out.wasm 2>scratchpad/before.log

Same framing, before the pass runs. diff the two logs to see exactly what the pass rewrote.

Multiple passes at once

The variables accept a comma-separated list:

sh
WADO_DUMP_PASS_AFTER=nir/inline,wir/sroa_multi_value_returns \
  cargo run --bin wado --quiet -- compile -O1 file.wado -o scratchpad/out.wasm 2>scratchpad/dump.log
Bisect by skipping a pass
sh
WADO_SKIP_PASS=nir/cse cargo run --bin wado --quiet -- compile -O3 file.wado -o scratchpad/out.wasm

Same comma-separated list as WADO_DUMP_PASS_*, with one extra convenience: a @N suffix targets the Nth invocation of a pass within the fixed-point loop (1-based). WADO_SKIP_PASS=nir/cse@2 skips cse only on the second iteration — invaluable for iteration-dependent bugs whose failing test passes on the first iteration and only diverges once the inliner expands an additional function on a later one.

Only standalone run_pass spans are skippable; confirm a name with WADO_LIST_PASSES=1 first. Local rules folded into the peephole session (ref_elim, elide_box_local, match_to_switch, value_copy_elide, array_literal, …) are not individually addressable — target nir/peephole to skip the whole session.

When a pass is the only one whose skipping makes the bug go away that just narrows the participants in the buggy interaction — it does not prove the pass is itself buggy. Pair the skip-bisection result with WADO_DUMP_PASS_AFTER on the same pass to compare its output across the working vs. broken configuration before concluding.

Trace pass-internal decisions

For developer-only messages from inside a pass. The crate denies eprintln!, so use compiler_trace!, which writes to the sink the host installed:

sh
WADO_TRACE=sroa_return cargo run --bin wado --quiet -- compile -O1 file.wado -o scratchpad/out.wasm 2>&1 | grep '\[sroa_return\]'

Output is framed [target] message. Targets are passed verbatim to compiler_trace!(target, ...) calls inside the compiler. Use WADO_TRACE='*' to enable every target at once.

To add a new tracing call inside a pass:

rust
use crate::compiler_trace;
// ...
compiler_trace!("sroa_return", "candidates = {}", candidates.len());
compiler_trace!("sroa_return", "rewriting return at {span:?}");

The cost when the target is disabled is one OnceLock get + a linear scan of the configured target list — fine for any rate that makes sense in a compiler pass.

Workflow for a fixed-point loop that never converges

--log-level debug ends the NIR loop with either "converged after N iteration(s)" or "hit the N-iteration cap without converging", the latter naming the passes still reporting changes. From there:

  1. WADO_TRACE=opt_loop lists, per iteration, every pass that reported a change. The tail of that list is the culprit set.
  2. WADO_TRACE=const_fold names each function const_fold changed, so a pass that keeps reporting a change points at the body it keeps rewriting. WADO_TRACE=inline_sites names, per round, the callees spliced into each caller: a late round splicing small helpers is a callee that only shrank under the threshold once its own callees were spliced.
  3. WADO_DUMP_PASS_BEFORE/_AFTER=<pass> around a late round, diffed, says which of three it is: nothing rewritten at all (the pass reports a change it did not make), a rewrite a later pass deletes (two passes fighting), or real work that tapers (the pass takes one step per round where its own fixed point is one sweep away).

Workflow for output that is far larger than the level below it

-O3 emitting several times -O2's wasm is the inliner, not the loop — check the iteration count first (WADO_TRACE=opt_loop) and stop suspecting convergence once it is small.

  1. Sweep --optimize-inline-threshold. A cliff rather than a curve means one callee crossed the budget and is now copied at every call site.
  2. WADO_TRACE=inline reports, per round, the unit size and how many candidates the threshold admitted only because the cold discount put them under it — with what those are worth in growth. A handful of callees accounting for most of a round's growth is that pattern.
  3. WADO_TRACE=cold_outline says why such a callee was not split: control leaving the region, or a local the call cannot hand over.
  4. --optimize-inline-growth <pct> caps unit growth, and --log-level debug then names what the cap turned down, with both of the callee's prices.
Show full SKILL.md (512 more words)Show less

Workflow for an optimization that stopped firing

A wir_expect that disappears when an unrelated knob moves is a precision hole somewhere else: one pass reshaped the IR into a form the second pass does not recognise, and the second pass is the one to fix.

  1. Bisect on the knob, not the source — --optimize-inline-threshold one step at a time until the expectation flips. One step is one callee, so the before/after dump --nir diff is small enough to read.
  2. WADO_TRACE=<pass> for the pass that stopped firing. const_object_globalization names each function it walks and, per let, either the hoist or the check that declined it.
  3. Read the declined shape in the NIR. A shape that is accepted in one syntactic position and rejected in another — &x as a call argument versus &x bound by a let — is the hole; the inliner just moved it from the first to the second.

Workflow for a "WIR pipeline generated invalid core Wasm module" ICE

The codegen-time validator catches type mismatches the optimizer introduced. The error always points at codegen, but the bug is upstream. Walk the pass pipeline like this:

  1. Get the failing fixture compiling at -O0 first to confirm it is an optimization-introduced bug (not a lower/codegen bug).

  2. List the passes that run at the failing -Ox level:

    sh
    WADO_LIST_PASSES=1 cargo run --bin wado --quiet -- compile -O1 fixture.wado -o scratchpad/out.wasm 2>&1 | grep '\[pass\]'
  3. Bisect: pick a pass roughly mid-pipeline, dump after it, and check whether the IR is already broken. If it is, the bug is at or before that pass; otherwise it is later.

  4. Once you have the suspect pass, dump before AND after it and read the diff. The mismatch will be visible — usually a function whose signature was rewritten but whose return sites weren't (the canonical shape of the SROA / signature-rewrite class of bugs), or a struct layout that changed in one place but not at consumers.

  5. Add compiler_trace!("<pass_name>", ...) calls at the suspect rewrite site to confirm which subtrees the pass visits. The *_mut walkers in wir_visitor.rs and WirInstr::for_each_boxed_child_mut cover most rewrite needs.

Pass-name conventions

PrefixPhase
nir/<name>NIR-level pass (optimize.rs)
wir/<name>WIR-level pass (wir_optimize.rs)

A #![wasm_module] core module (the allocator, mem) runs the WIR list as a package of its own, under wir/<module>:<name> — so wir/run_peephole stays the main module's and wir/mem:run_peephole targets the allocator.

WADO_LIST_PASSES=1 is the source of truth — names there match exactly the strings the env vars want.

When to NOT reach for these

  • For runtime bugs (program compiles cleanly but produces wrong output), use the debugger skill (rust-gdb) or read the WIR/Wasm directly.
  • For LSP / annotate-time issues, these hooks fire only during the optimization phase. Add tracing calls in annotate.rs directly.
  • For monomorphization or lowering issues, dump the pre-optimize IR with wado dump --tir-resolved / --tir-monomorphized (TIR, before lowering) or --nir-lowered (NIR, right after lowering) instead; those are exposed as proper CLI flags.

See also

  • wado-compiler/src/trace.rs — compiler_trace! macro and filter parsing (with unit tests).
  • wado-compiler/src/optimize.rs — run_pass for NIR passes; defines the env-var hook implementation in mod pass_dump.
  • wado-compiler/src/wir_optimize.rs — wir_pass for WIR passes.

© wado-lang, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/optimizer-debug of wado-lang/wado.

Open the folder on GitHubat commit 827e44b

Compare with similar skills

Optimizer Debug next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Optimizer Debug compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Optimizer Debug this skillwado-lang/wado116—~2.5kAutomated safety check: PassMIT
Ssh Connection ImportfeigeCode/navop1.8k—~1.2kAutomated safety check: WarnCustom licence
Debugging Geometryandymai/brepjs114—~3.8kAutomated safety check: PassApache-2.0
Chrome Devtools MCPmanagedcode/dotnet-skills486—~2.2kAutomated safety check: PassMIT
Wasm Emscriptenmohitmishra786/low-level-dev-skills253—~1.7kAutomated safety check: PassMIT
Create Featurezacharyfmarion/openscad-studio238—~1.5kAutomated safety check: PassGPL-2.0

Similar skills

  • Ssh Connection Import

    feigeCode/navop

    A skill your agent uses when implementing or debugging onetcli SSH connection importers, including OpenSSH config, knownhosts, candidate file manifests, local composite installs, SSH authmethod JSON…

    1.8k GitHub stars~1.2k tokensUpdated today
    DevelopmentAuto-check: warnings
  • Debugging Geometry

    andymai/brepjs

    This skill should be used when debugging a geometry failure in brepjs — when a task says "boolean returned an invalid shape", "fuse/cut/intersect returned Err", "the result is empty", "measureVolume…

    114 GitHub stars~3.8k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Chrome Devtools MCP

    managedcode/dotnet-skills

    Use Chrome DevTools MCP from .NET agents and .NET-focused repos to inspect, debug, and automate Chrome through an MCP client.

    486 GitHub stars~2.2k tokensUpdated today
    DevelopmentAuto-check passed
  • Wasm Emscripten

    mohitmishra786/low-level-dev-skills

    WebAssembly with Emscripten skill for C/C++ to WASM compilation.

    253 GitHub stars~1.7k tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • Create Feature

    zacharyfmarion/openscad-studio

    A skill your agent uses when the user asks to take a feature or bug fix from prompt to implementation, especially prompts like "/create a new feature", "build this feature end-to-end", "take this…

    238 GitHub stars~1.5k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • Flowfile Node Development

    Edwardvaneechoud/Flowfile

    End-to-end runbook for adding or modifying a Flowfile node type across all four layers (flowfilecore settings/graph/template, flowfilefrontend UI registry, flowfileframe Python API, flowfilewasm…

    370 GitHub stars~9.3k tokensUpdated yesterday
    DevOps & CloudAuto-check passed

More from wado-lang/wado

All 14 skills in this repo
  • Profile the native Rust wado binary (compile/serve/run) for host-side bottlenecks — CPU with a sampling profiler, memory with the span trace's RSS and valgrind DHAT.

    116 GitHub stars~2.9k tokensUpdated today
    Auto-check: notes
  • Wado Performance

    wado-lang/wado

    Analyze and improve the runtime speed of a Wado program's compiled guest Wasm — profile hot functions, read the generated WIR for allocations and copies, reason about the WasmGC cost model, and…

    116 GitHub stars~7.5k tokensUpdated today
    Auto-check passed
  • Investigate and improve code coverage for the wado-compiler crate.

    116 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Git Upstream Sync

    wado-lang/wado

    The only way to merge origin/main into a branch, conflicts or not.

    116 GitHub stars~855 tokensUpdated today
    Auto-check passed
  • Jco

    wado-lang/wado

    Transpile Wado Wasm components to JS with jco, then run, debug, and benchmark them on Node.

    116 GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • On Task Done

    wado-lang/wado

    Task-completion flow: /cr (a /code-review answered with /code-review-response, which ends with /distill), update docs (spec/cheatsheet/compiler/optimizer), then run mise run on-task-done (build…

    116 GitHub stars~611 tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Optimizer Debug

What does Optimizer Debug do?

Debug the Wado optimizer with the WADOTRACE, WADODUMPPASSBEFORE/AFTER, WADOLISTPASSES, and WADOSKIPPASS env vars. Optimizer Debug is an agent skill from wado-lang/wado. Debug the Wado optimizer with the WADOTRACE, WADODUMPPASSBEFORE/AFTER, WADOLISTPASSES, and WADOSKIPPASS env vars.

When should I use Optimizer Debug?

Optimizer Debug fits situations like: A NIR/WIR pass is in question — wrong code; A WIR pipeline ICE; just to see what a pass did to the IR.

How do I install Optimizer Debug in Claude Code?

Run `npx skills add wado-lang/wado --skill optimizer-debug -a claude-code`. Or copy the skill folder (.claude/skills/optimizer-debug in wado-lang/wado) into .claude/skills/optimizer-debug in your project. Claude Code loads it when a task matches its description.

How do I install Optimizer Debug in Codex?

Run `npx skills add wado-lang/wado --skill optimizer-debug -a codex`. Or copy the skill folder (.claude/skills/optimizer-debug in wado-lang/wado) into .agents/skills/optimizer-debug in your project. Codex loads it when a task matches its description.

Can I use Optimizer Debug in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wado-lang/wado --skill optimizer-debug -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/optimizer-debug, .gemini/skills/optimizer-debug, .github/skills/optimizer-debug and .opencode/skills/optimizer-debug in your project.

What does Optimizer Debug need to run?

Going by SKILL.md and its folder, Optimizer Debug needs the command-line tools its instructions call (cargo).

Does Optimizer Debug access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Optimizer Debug safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Optimizer Debug use?

Optimizer Debug is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Optimizer Debug use?

About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Optimizer Debug?

Skills that share tags, products or a category with Optimizer Debug: Ssh Connection Import (feigeCode/navop, 1.8k stars), Debugging Geometry (andymai/brepjs, 114 stars), Chrome Devtools MCP (managedcode/dotnet-skills, 486 stars) and Wasm Emscripten (mohitmishra786/low-level-dev-skills, 253 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Optimizer Debug?

wado-lang (a GitHub organization) maintains it in wado-lang/wado, which has 116 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on October 7, 2026.

Source: wado-lang/wado on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.