rust-wasm
Skill4 starsChanged 4 months agoApache-2.0View on GitHub
Compile Rust to WebAssembly for browser and Node.js environments. Use when building wasm modules with wasm-bindgen, creating JS interop, using web-sys/js-sys, optimizing wasm size, or deploying Rust+WASM to production.
- Installs packages
3 other projects use a version of this.
Adopted by
Most recently taken up by
- po4yka/rust-skillstheir own version, first seen Nov 2, 2026
- adxptived/Rust-Skillstheir own version, first seen Oct 17, 2026
- Lu1sDV/skillsmdtheir own version, first seen Oct 13, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- po4yka/rust-skills★ 5same name
- Lu1sDV/skillsmd★ 2same name
- adxptived/Rust-Skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository80 other files it gives its agents.
- a11y-accessibility-designSkill
- agentic-ui-patternsSkill
- ai-native-ui-designSkill
- ai-ui-anti-patternsSkill
- ai-ui-heuristicsSkill
- calm-technology-uiSkill
- conversion-growth-designSkill
- cross-platform-designSkill
- dark-mode-designSkill
- data-visualizationSkill
- design-systemsSkill
- design-thinking-processSkill
- error-empty-statesSkill
- ethical-design-patternsSkill
- form-uxSkill
- information-architectureSkill
- interaction-design-patternsSkill
- internationalization-uiSkill
- mobile-touch-designSkill
- modal-classes-lifecycleSkill
- modal-container-imagesSkill
- modal-dicts-queuesSkill
- modal-endpointsSkill
- modal-fundamentalsSkill
- modal-gpu-computeSkill
- modal-networkingSkill
- modal-observabilitySkill
- modal-parallel-executionSkill
- modal-sandboxesSkill
- modal-scaling-performanceSkill
- modal-schedulingSkill
- modal-secretsSkill
- modal-serversSkill
- modal-storageSkill
- modal-web-servingSkill
- modal-workspace-adminSkill
- motion-design-principlesSkill
- notifications-permissionsSkill
- onboarding-uxSkill
- rust-api-designSkill
- rust-async-programmingSkill
- rust-cargo-masterySkill
- rust-cli-applicationsSkill
- rust-clippy-lintsSkill
- rust-closures-iteratorsSkill
- rust-compiler-internalsSkill
- rust-concurrencySkill
- rust-design-patternsSkill
- rust-editionsSkill
- rust-embeddedSkill
- rust-error-handlingSkill
- rust-game-developmentSkill
- rust-lifetimes-borrowingSkill
- rust-macrosSkill
- rust-performanceSkill
- rust-rustdocSkill
- rust-rustup-toolchainSkill
- rust-smart-pointersSkill
- rust-testing-benchmarkingSkill
- rust-type-systemSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 174
Use WebAssembly.instantiateStreaming for fastest loading.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust & WebAssembly
Based on the Rust and WebAssembly book, the wasm-bindgen guide, and wasm-pack documentation.
When to Use This Skill
- Compiling Rust to
.wasmfor the browser - Interoperating with JavaScript (functions, objects, strings)
- Using DOM APIs from Rust via
web-sys - Publishing Rust-WASM packages to npm
- Optimizing
.wasmbinary size - Debugging and profiling WASM modules
Quick Start
# Install tooling
rustup target add wasm32-unknown-unknown
cargo install wasm-pack
# Create project
cargo new --lib my-wasm-lib
cd my-wasm-libCargo.toml
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = ["console", "Document", "Element", "Window"] }
js-sys = "0.3"
[profile.release]
opt-level = "s" # optimize for size
lto = truesrc/lib.rs
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn greet(name: &str) -> String {
format!("Hello, {name}!")
}
#[wasm_bindgen]
pub struct Universe {
width: u32,
height: u32,
cells: Vec<u8>,
}
#[wasm_bindgen]
impl Universe {
pub fn new(width: u32, height: u32) -> Self {
Self { width, height, cells: vec![0; (width * height) as usize] }
}
pub fn tick(&mut self) { /* game of life step */ }
pub fn cells_ptr(&self) -> *const u8 { self.cells.as_ptr() }
}Build & Use
wasm-pack build --target web # for <script type="module">
wasm-pack build --target bundler # for webpack/vite
wasm-pack build --target nodejs # for Node.jswasm-bindgen Attributes
Exporting to JS
#[wasm_bindgen]
pub fn add(a: u32, b: u32) -> u32 { a + b }
#[wasm_bindgen]
pub struct Counter { count: u32 }
#[wasm_bindgen]
impl Counter {
#[wasm_bindgen(constructor)]
pub fn new() -> Self { Self { count: 0 } }
pub fn increment(&mut self) { self.count += 1; }
#[wasm_bindgen(getter)]
pub fn count(&self) -> u32 { self.count }
}Importing from JS
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
#[wasm_bindgen(js_namespace = console)]
fn log(s: &str);
#[wasm_bindgen(js_namespace = Math)]
fn random() -> f64;
}DOM Manipulation (web-sys)
use web_sys::{window, Document, Element};
pub fn create_element() -> Result<(), JsValue> {
let document = window().unwrap().document().unwrap();
let div = document.create_element("div")?;
div.set_text_content(Some("Hello from Rust!"));
document.body().unwrap().append_child(&div)?;
Ok(())
}Size Optimization
# Cargo.toml
[profile.release]
opt-level = "z" # aggressive size optimization
lto = true
codegen-units = 1
strip = true# Further reduce with wasm-opt (from binaryen)
wasm-opt -Oz -o output.wasm input.wasm
# Analyze what's taking space
cargo install twiggy
twiggy top pkg/my_lib_bg.wasm
twiggy dominators pkg/my_lib_bg.wasmAvoid:
format!/panic!messages (pull in formatting machinery)std::collections::HashMap(large; use a simpler map)- String-heavy APIs (prefer passing indices/pointers for hot paths)
Deployment
wasm-pack build --target web --release
# Produces pkg/ directory with:
# my_lib.js — JS glue
# my_lib_bg.wasm — compiled module
# my_lib.d.ts — TypeScript definitionsServe with correct MIME type: application/wasm
Use WebAssembly.instantiateStreaming for fastest loading.
Reference Map
references/wasm-bindgen-api.md— attributes, types, conversionsreferences/web-sys-dom.md— DOM, events, fetch, canvasreferences/optimization-debugging.md— size profiling, debugging, testing
Key References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

