Run a disposable Python, TypeScript/JavaScript, Rust, Go, or C# snippet with a selected runtime version and temporary dependencies—without modifying your global environment or current project.
echo 'print("hello")' | run-code python@3.14A small experiment should not require creating a project, choosing a package manager layout, switching the active runtime, installing dependencies, and deleting everything afterward. Installing a package globally or into the current project is faster initially, but leaves unrelated state behind.
run-code turns the disposable case into one command:
- select a runtime or toolchain version;
- prepare dependencies in an isolated temporary environment;
- run code from stdin or a source file.
Use it to try a package from its README, verify behavior on a specific runtime, reproduce a small example, or let an agent run a focused check. Use a normal project for multi-file programs, durable dependencies, or build configuration. run-code is isolation for convenience, not a security sandbox.
After installing the binary, an agent can read its matching run-code-snippet skill and exact version-specific instructions by running:
run-code skillInstall the skill into a project when its use should be repository-specific:
mkdir -p .agents/skills/run-code-snippet
run-code skill > .agents/skills/run-code-snippet/SKILL.mdOr install it globally for reuse across projects:
mkdir -p ~/.agents/skills/run-code-snippet
run-code skill > ~/.agents/skills/run-code-snippet/SKILL.mdFor a one-off check, the essential pattern is:
run-code TOOLCHAIN[@VERSION] [--package SPEC ...] [--clean] [--quiet] <<'LANG'
CODE
LANGThis gives the agent an explicit runtime, disposable dependencies, isolated project state, and normal stdout/stderr without asking it to scaffold a project manually.
On macOS:
brew install timzhong1024/tap/run-codeOther options:
npm install --global @timzhong2000/run-code
cargo install --locked --git https://github.com/timzhong1024/run-codeStandalone macOS, Linux, and Windows binaries are available from GitHub Releases.
run-code delegates runtime installation to existing tools. Install only the backends you use:
| Code | Toolchain argument | Required backend |
|---|---|---|
| Python | python[@VERSION] |
uv |
| TypeScript / JavaScript | node[@VERSION] |
Vite+ (vp) |
| Rust | rust[@VERSION] |
rustup |
| Go | go[@VERSION] |
mise |
| C# | dotnet[@VERSION] |
mise |
run-code node@20 --package zod@4 --clean <<'TS'
import { z } from "zod";
console.log(await Promise.resolve(z.object({ id: z.number() }).parse({ id: 1 })));
TSrun-code python@3.14 --package requests==2.32.5 --clean <<'PY'
import requests
print(requests.__version__)
PYrun-code rust@stable --package serde_json@1 --clean <<'RS'
fn main() {
println!("{}", serde_json::json!({"hello": "world"}));
}
RSrun-code node@20 \
--package zod@4 \
--cwd ./fixtures \
--env-file ./snippet.env \
snippet.ts -- first --verboseThe file is copied into a fresh isolated template; its existing project, dependencies, and sibling files are not used. Arguments after -- go to the snippet. --cwd affects only the final code process, while --env-file supplies dotenv-compatible variables without changing the current shell or exposing their values in the displayed command.
- Omitting a version selects the built-in stable policy: Python 3.14, Node latest, Rust stable, Go latest, and .NET 10.
- Python and Node stdin snippets without
--packagerun directly; dependencies or file input use an isolated template project. - Temporary projects are retained by default so their generated command paths remain inspectable. Add
--cleanfor a one-off run. - Package-manager download caches remain enabled, so isolation does not mean downloading every package again.
- By default, dependency installation and the final command are displayed and their output is streamed.
--quietleaves only the final process stdout/stderr. - Node defaults to ESM with TypeScript and top-level
awaitsupport. Use--commonjsonly for CommonJS-specific code.
run-code [OPTIONS] TOOLCHAIN[@VERSION]
run-code [OPTIONS] TOOLCHAIN[@VERSION] FILE [-- ARG ...]
run-code skill
| Argument | Meaning |
|---|---|
TOOLCHAIN[@VERSION] |
python, node, rust, go, or dotnet; javascript/typescript alias node, and csharp/cs alias dotnet |
FILE |
Copy and run one source file instead of reading stdin |
-- ARG ... |
Pass trailing arguments to the snippet |
-p, --package SPEC |
Add a dependency; repeat for multiple packages |
--cwd DIR |
Set the final snippet process working directory |
--env-file FILE |
Load dotenv variables for the final process |
--commonjs |
Run Node code as CommonJS instead of ESM |
--clean |
Remove the temporary project after execution |
--quiet |
Show only final-process stdout/stderr |
skill |
Print the bundled agent skill |
Package specs follow their ecosystems. Python accepts NAME==VERSION; Node, Rust, Go, and .NET accept NAME@VERSION. Rust features use NAME[@VERSION][FEATURE,...], for example 'tokio@1[full]'.
Bash and Zsh use the quoted heredocs shown above. Fish can pipe printf:
printf '%s\n' \
'const value: string = await Promise.resolve("hello");' \
'console.log(value);' |
run-code node@20PowerShell 7 can pipe a single-quoted here-string:
@'
print("hello\nworld")
'@ | run-code python@3.14 --cleanSnippets, dependencies, package lifecycle hooks, Python build backends, and Cargo build scripts run with the current user's permissions. They may access files, the network, environment variables, credentials, and other processes. Run only trusted code and packages; pin versions when reproducibility matters and do not pass secrets to untrusted snippets.
--clean removes the temporary project, but cannot undo filesystem or network side effects. See SECURITY.md for the reporting policy and complete security boundary.