skills/sandbox-next/SKILL.md
Use when building or changing Cloudflare Sandbox apps on @cloudflare/sandbox@next (Sandbox SDK 1.0 preview)—code execution, AI runners, interpreters, CI-like jobs, terminals, files, mounts, tunnels, preview URLs, lifecycle, or errors. Not for the default stable package (use sandbox-stable) or for porting stable to @next (use sandbox-migrate-to-next).
npx skillsauth add cloudflare/skills sandbox-nextInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
@next (1.0 preview)Isolated Linux environments on Cloudflare Containers, driven from Workers.
Prefer preview docs and installed @next types over memory. APIs change; this skill is a gate, a contract, and a retrieval map—not a full manual.
We recommend new projects on this line. Apps still on the default package use sandbox-stable. Port only when asked, via sandbox-migrate-to-next.
Before writing code, inspect the app:
| Check | Must match |
| ----- | ---------- |
| npm dependency | @cloudflare/sandbox@next (or another preview tag) |
| Container image | Same line (e.g. cloudflare/sandbox:next, next-python) |
| If you find… | Action |
| ------------ | ------ |
| Default @cloudflare/sandbox (no @next) | Stop. Load sandbox-stable. Do not apply this skill’s APIs. |
| User wants to port stable → @next | Stop. Load sandbox-migrate-to-next. |
| Self-deployed bridge only | Bridge is not on the 1.0 preview line yet. Keep bridge on stable package + image. Bridge (stable) |
Never mix an @next Worker package with a stable container image (or the reverse).
Skills install: Agent setup · cloudflare/skills
sandbox.exec(argv) takes an argv list and resolves when the process starts. It returns a handle, not a finished command result.output(), logs(), waitForExit(), waitForPort(), waitForLog(), kill(signal?).["/bin/bash", "-lc", script].cd / export in one exec is not visible to the next. Pass cwd and env per launch, or one shell script.createTerminal + connect).timeout / AbortSignal cancel the wait only. They do not kill the process. Use kill or exec’s remote timeout.getProcess / listProcesses / getTerminal / listTerminals do not start a container; they return null / [] when none is up.setEnvVars / launch env. Live credentials stay in the Worker; use outbound handlers when the sandbox calls external APIs.gitCheckout on core, string-exec completion, session execution, sandbox.terminal(request)).Minimal shape:
import { getSandbox, proxyToSandbox, Sandbox } from "@cloudflare/sandbox";
export { Sandbox };
const sandbox = getSandbox(env.Sandbox, "user-123");
const process = await sandbox.exec(["python3", "-c", "print(2 + 2)"]);
const result = await process.output({ encoding: "utf8" });
// result.stdout, result.exitCode
Optional non-exhaustive cheatsheet (process/terminal/interpreter only): references/api-quick-ref.md
Examples index (next branch): references/examples.md
Fetch the page before implementing. Installed @next types win over guesses.
| You need to… | Open |
| ------------ | ---- |
| Orient / choose preview | 1.0 preview overview |
| First Worker, wrangler, Dockerfile | Get started |
| exec, handles, readiness, durability | Process execution |
| Process API signatures | Processes API |
| Sandbox ID vs container vs sleep/destroy | Lifecycle |
| cwd / env / setEnvVars | Environment |
| Interactive PTY / browser terminal | Terminals · Terminals API |
| Python/JS code interpreter | Interpreter · Interpreter API |
| Extensions model | Extensions |
| Error classes and recovery | Errors · Errors API |
| Common failures | Troubleshooting |
| API hub | API reference |
| Files, mounts, backups, ports, tunnels, proxyToSandbox | Main docs for shared surfaces (ignore stable-only session/transport/sandbox.terminal): Files · Storage / mounts · Ports · Tunnels · Backups · Outbound traffic · Expose services · Production |
| Example apps | examples on next |
| Still on stable package | sandbox-stable · Main Sandbox docs |
| Porting an existing stable app | sandbox-migrate-to-next · Migrate |
@next line@next typesdevelopment
Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
development
Comprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), feature flags (Flagship), networking (Tunnel, Spectrum), security (WAF, DDoS), and infrastructure-as-code (Terraform, Pulumi). Use for any Cloudflare development task. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
development
Use when building or changing Cloudflare Sandbox apps on the current stable @cloudflare/sandbox package (default npm tag)—commands, sessions, files, ports, tunnels, terminals, bridge, production, or deprecated-API cleanup while staying on stable. Not for @cloudflare/sandbox@next (use sandbox-next) or for porting to 1.0 (use sandbox-migrate-to-next).
development
Use when porting a Cloudflare Sandbox app from stable @cloudflare/sandbox to @cloudflare/sandbox@next (Sandbox SDK 1.0 preview), or when the user asks to migrate or upgrade to Sandbox 1.0 / @next. Not for day-to-day stable work (sandbox-stable) or new @next apps (sandbox-next).