analyze-wast
Analyze WebAssembly test (WAST) files to debug compilation issues and create regression tests. Use when the user asks to debug or analyze WAST test failures, investigate compilation bugs in wasmoon, or when encountering test failures in spec/*.wast files. Triggers include "analyze wast", "debug wast", "wast bug", or references to specific .wast test files.
Best use case
analyze-wast is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Analyze WebAssembly test (WAST) files to debug compilation issues and create regression tests. Use when the user asks to debug or analyze WAST test failures, investigate compilation bugs in wasmoon, or when encountering test failures in spec/*.wast files. Triggers include "analyze wast", "debug wast", "wast bug", or references to specific .wast test files.
Teams using analyze-wast should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/analyze-wast/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How analyze-wast Compares
| Feature / Agent | analyze-wast | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Analyze WebAssembly test (WAST) files to debug compilation issues and create regression tests. Use when the user asks to debug or analyze WAST test failures, investigate compilation bugs in wasmoon, or when encountering test failures in spec/*.wast files. Triggers include "analyze wast", "debug wast", "wast bug", or references to specific .wast test files.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Analyze WAST
Debug WebAssembly test files by reproducing issues, analyzing compilation stages, and creating regression tests.
## Workflow
### 1. Reproduce the Issue
Run the test to observe failures:
```bash
./install.sh
./wasmoon test <wast_file_path>
```
If user provides only a filename (e.g., "elem.wast"), automatically prefix with `spec/`.
Record:
- Failed assertion line numbers
- Error messages
- Expected vs actual behavior
### 2. Analyze Compilation Stages
Use the explore command to examine IR, VCode, and machine code:
```bash
./wasmoon explore <wast_file_path> --stage ir vcode mc
```
**Available stages:**
- `ir` - Intermediate Representation (SSA form)
- `vcode` - Virtual code (platform-independent)
- `mc` - Machine code (ARM64 assembly)
**What to check:**
- IR: Verify WebAssembly instructions translate correctly
- VCode: Check instruction selection matches expected patterns
- MC: Verify generated assembly is correct
### 3. Isolate the Root Cause
Create a minimal test case:
1. Extract the failing WAST module to a standalone `.wat` file
2. Test with both JIT and interpreter:
```bash
./wasmoon test <file>.wast # JIT mode
./wasmoon test --no-jit <file>.wast # Interpreter mode
```
3. If only JIT fails, the bug is in compilation; if both fail, it's in the executor
Locate relevant code:
- Use Glob to find implementation files (e.g., `**/*lowering*.mbt`)
- Use Grep to search for instruction handlers
- Read source code in vcode/lower/, ir/translator/, executor/
### 4. Create Regression Test
Write a MoonBit test in `testsuite/` to prevent regressions:
```moonbit
test "descriptive_test_name" {
let source =
#|(module
#| (func (export "test") (result i32)
#| i32.const 42
#| )
#|)
let result = compare_jit_interp(source, "test", [])
inspect(result, content="matched")
}
```
**Key points:**
- Use `#|` for multiline WAT source
- `compare_jit_interp(source, func_name, args)` runs both JIT and interpreter
- `inspect(result, content="matched")` verifies they produce the same output
- For arguments, use `[I32(value)]`, `[I64(value)]`, `[F32(value)]`, `[F64(value)]`
**Test file naming:**
- Use descriptive names: `<feature>_test.mbt`
- Examples: `conversions_test.mbt`, `call_indirect_test.mbt`
Run the test:
```bash
moon test -p testsuite -f <test_file>.mbt
```
### 5. Debug with LLDB (if needed)
For segfaults or unexplained crashes:
```bash
lldb -- ./wasmoon test <file>.wast
(lldb) run
# After crash:
(lldb) bt # View backtrace
```
## Command Reference
```bash
# Build and install
moon build && ./install.sh
# Run WAST test
./wasmoon test spec/<file>.wast
# View compilation stages
./wasmoon explore <file>.wat --stage ir vcode mc
# Test with interpreter
./wasmoon test --no-jit <file>.wast
# Run single MoonBit test
moon test -p testsuite -f <test>.mbt
# Debug with LLDB
lldb -- ./wasmoon test <file>.wast
```
## Presentation
Explain findings to the user, including:
- Root cause of the bug
- Which component has the issue (translator, lowering, codegen, etc.)
- Suggested fix approach
- Impact assessmentRelated Skills
awareness-analyzer
Diagnose audience awareness level and market sophistication using Eugene Schwartz's Breakthrough Advertising framework
ast-analyzer
Deep Abstract Syntax Tree analysis for understanding code structure, dependencies, impact analysis, and pattern detection at the structural level across multiple programming languages
analyzer-architecture-review
analyzerアプリケーションのアーキテクチャレビュー。Port&Adapterアーキテクチャ(ヘキサゴナルアーキテクチャ)のルールに従っているかをチェックします。新しいPort/Adapter/Usecase/Model追加時、PRレビュー時、またはアーキテクチャ違反の検出が必要な時に使用します。Port層の関数型定義、依存関係の方向、New*関数パターン、レイヤー分離などを検証します。
analyze-code
外部ライブラリや他言語で書かれたコードの実装を分析して知見を得る
analyze-yii2-project
Use this when user provides a Yii2 codebase for analysis or migration planning. Provides 6-phase workflow: scan, capability extraction, dependency analysis, requirements extraction, semantic indexing, and migration roadmap. Apply when user mentions Yii2, PHP legacy modernization, or framework migration to NestJS
analyze
Deep analysis mode - thorough multi-phase investigation with expert consultation for complex problems requiring careful examination
analyze-system
システム分析エージェント - ユビキタス言語、アクター、ロール、権限、ドメイン-コード対応表を抽出。/analyze-system [対象パス] で呼び出し。
analyze-size
Analyze codebase size and language distribution using cloc. Use when user wants to understand codebase scale, primary languages, code composition, or assess project complexity. Provides total LOC, size category, language breakdown percentages, and key insights.
analyze-rust-optimizations
This skill performs thorough analysis of Rust libraries to find optimization opportunities. It should be used when reviewing Rust code for performance improvements, memory efficiency, or when profiling indicates bottlenecks. Focuses on runtime performance and memory usage through dynamic profiling tools and static code analysis.
analyze-project-architecture
LLM-based architectural analysis that transforms raw project data into meaningful structure
analyze-pr-performance
Analyze code review pipeline performance for a specific PR. Use when investigating slow PRs, identifying bottlenecks, or debugging performance issues in code reviews.
analyze-m1-module-for-migration
Systematically analyze a Magento 1 module to determine its purpose, usage, and migration requirements for Magento 2. Use when you need to decide whether to migrate a M1 module, find alternatives, or skip it.