← ClaudeAtlas

port-from-typescriptlisted

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 TypeScript, JavaScript, Node, Deno, Bun, Express, or a JS CLI or library into Rust, when replacing a hot JS module with a native addon or WebAssembly, or when the user asks how a TypeScript or JavaScript construct translates to Rust.
rewrite-rs/skills · ★ 2 · AI & Automation · score 73
Install: claude install-skill rewrite-rs/skills
# Port from TypeScript ## A construct mapping and two boundaries, nothing else This skill maps the JavaScript runtime to Rust and owns the two boundaries, napi-rs and wasm-bindgen. The parity contract, the phases, and the anti-patterns are `/port-to-rust`. TypeScript and JavaScript are one skill because they are one runtime: the types are erased before anything runs, so the mapping is the same and the annotations are evidence about intent, not guarantees about values. ## The end state decides whether a binding layer appears at all `/port-to-rust` names three end states, and this skill asks rather than assumes. | End state | In TypeScript and JavaScript terms | Binding layer | |---|---|---| | A. Replacement | A Rust binary or crate takes over; nothing imports it from JavaScript afterwards, and the seam is the CLI, route, or worker that already exists | Neither napi-rs nor wasm appears | | B. Rust core, the npm package is the product | The module keeps its name and its exported signatures; the engine underneath becomes Rust | Permanent public surface — signatures, error types, prebuilds per platform, semver | | C. Scaffold | The port ends standalone, but JavaScript calls the Rust module while the migration is under way | Temporary, and deleted at cut-over | ## Two boundaries, and the target decides which Under B or C: Node, Deno, and Bun take a native addon through napi-rs; browsers and edge runtimes take WebAssembly through wasm-bindgen. They are not interchangeable: wa