add-export
/add-export
Export a new function, class, method or option from this Rust WebAssembly package to JavaScript, with its TypeScript types, error codes and native, wasm and consumer tests. Use when the user asks the package to expose something new to JavaScript or change an existing export.
- Author
- steamfield ↗
- Repository
- stacks ↗
- Licence
- Apache-2.0
- Last repository change
- 08.11.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 08.11.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
What it does and when to use it
Export a new function, class, method or option from this Rust WebAssembly package to JavaScript, with its TypeScript types, error codes and native, wasm and consumer tests. Use when the user asks the package to expose something new to JavaScript or change an existing export.
Original author description
Export a new function, class, method or option from this Rust WebAssembly package to JavaScript, with its TypeScript types, error codes and native, wasm and consumer tests. Use when the user asks the package to expose something new to JavaScript or change an existing export.
How it works
SKILL.md has no level-two headings · 12 lines, 250 words
SKILL.md preview
--- name: add-export description: Export a new function, class, method or option from this Rust WebAssembly package to JavaScript, with its TypeScript types, error codes and native, wasm and consumer tests. Use when the user asks the package to expose something new to JavaScript or change an existing export. --- # Add an export `slugInfo` is the worked example: the logic in `src/slug.rs` (`describe`, with native tests), the export and its doc comment in `src/lib.rs`, its `SlugInfo` shape in the `TYPES` section, its wasm case in `src/web_tests.rs`, its consumer test in `consumer/test/package.test.ts`, and its row in `docs/js-api.md`. Follow the same path. 1. **Decide.** Read `docs/js-api.md`. Name the semver effect (adding is minor; changing or removing is breaking) and tell the user before writing a breaking change. 2. **Logic.** Write it in plain Rust in the module it belongs to, `pub(crate)`, returning `Result<_, Error>`. A new failure is a variant in `src/error.rs` with a new `code()`. Unit tests go beside it; run `cargo test <name>`. 3. **Export.** In `src/lib.rs` only: a `#[wasm_bindgen]` function (camelCase it with `js_name`) or method that decodes options through `js::settings`, calls the logic and returns with `?`. A new options key goes in `Options`, `Options::KEYS` and `SlugOptions` together. A plain-object result gets a `serde::Serialize` struct, an interface in `TYPES`, an `extern "C"` type named with `typescript_type`, and `js::to_js`. A class documents `free()` and `using`. 4. **Document.** A doc comment for JavaScript callers with an `# Errors` section naming the codes it throws; it lands in `pkg/*.d.ts`. A new code also goes in `SlugErrorCode`, the README's error table and `docs/js-api.md`. 5. **Test.** A wasm case in `src/web_tests.rs` with JavaScript values in and each code out, and a case in `consumer/test/package.test.ts` importing it by package name. 6. Run `make lint test test-wasm test-js`, then read the diff of `pkg/*.d.ts`.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · steamfield/stacks | 96 | Apache-2.0 |
| cyanheads/mcp-ts-core | 100 | Apache-2.0 |
| steamfield/stacks | 96 | Apache-2.0 |
| steamfield/stacks | 96 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version ff4b1cefad67 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100cloudflare-workers-multi-lang
Multi-language Workers development with Rust, Python, and WebAssembly. Use when building Workers in languages other than JavaScript/TypeScript, or when integrating WASM modules for performance-critical code. - 100webassembly-expert
Create production-ready WebAssembly modules for web and server environments with optimal performance and seamless JavaScript integration. Use when the user mentions WebAssembly or Wasm, WASI, compiling Rust/C/C++ to the browser, Emscripten, wasmtime, or JavaScript-to-Wasm… - 95wasm
WebAssembly (WASM) integration, WASI, component model, Rust/Go to WASM compilation. Use when implementing WASM modules, browser/edge compute, or polyglot runtime. - 95port-from-typescript
Port TypeScript or JavaScript into Rust — construct mapping against runtime semantics, the traps (every number is an f64, two kinds of absent, structural typing, regex feature gaps), and the napi-rs and wasm-bindgen boundaries. Use when porting, rewriting, or migrating… - 96add-public-item
Add a public type, function, method, error variant or feature to this Rust library with its docs, doctest, tests and API notes. Use when the user asks the crate to expose something new or change what it exports. - 86rust
Rust开发专家助手。当用户需要进行Rust系统编程、高性能服务、WebAssembly、CLI工具或安全关键应用开发时调用。