sandbox-next

Build and maintain Cloudflare Sandbox apps on the @cloudflare/sandbox@next 1.0 preview SDK.

Updated Sep 1, 2026
One-click install
npx skills add https://github.com/jpmoya/claude-agents --skill sandbox-next-jpmoya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sandbox-next
Source: https://github.com/jpmoya/claude-agents/tree/main/skills/sandbox-next
Command: npx skills add https://github.com/jpmoya/claude-agents --skill sandbox-next-jpmoya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudflare/sandbox, and includes references (resource) components.

What problem does it solve? Cloudflare's Sandbox SDK 1.0 preview (@cloudflare/sandbox@next) introduces breaking API changes versus the stable package, and mixing package lines or relying on outdated knowledge produces broken Workers. This Skill gates the package line, enforces the non-negotiable API contract, and routes you to the correct preview documentation before any code is written. ## Core Features & Use Cases - Package-line gate: Verifies the npm dependency and container image are both on the @next line, and redirects to sandbox-stable or sandbox-migrate-to-next when they are not. - API contract enforcement: Codifies the preview rules—argv-based exec returning process handles, explicit shells, per-launch cwd/env, no stdin on process handles, and correct timeout/kill semantics. - Documentation retrieval map: Maps each task (processes, terminals, interpreter, lifecycle, environment, errors) to the exact preview docs page, with local quick references for APIs and examples. - Use Case: You are building a new Worker that runs Python code in an isolated Cloudflare container. The Skill confirms you are on @next, gives you the minimal getSandbox + exec + output() pattern, and points you to the interpreter and process API docs before you ship. ## Quick Start Ask the assistant to scaffold a new Cloudflare Sandbox Worker on the @next preview SDK that executes a Python command and returns its output.

Frequently Asked Questions about sandbox-next

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a command in a Cloudflare Sandbox with the @next SDK?

Call sandbox.exec with an argv array, which returns a process handle once the process starts. Collect results with handle methods like output(), logs(), or waitForExit(); shell syntax requires an explicit shell such as ["/bin/bash", "-lc", script].

What is the difference between @cloudflare/sandbox stable and @next?

The @next line is the 1.0 preview with breaking changes: exec takes argv and returns handles, session execution and string-exec completion are removed, and terminals use createTerminal. Stable apps should use the sandbox-stable skill; ports use sandbox-migrate-to-next.

Can I mix an @next Worker package with a stable container image?

No. The npm dependency and container image must be on the same line, such as @cloudflare/sandbox@next with cloudflare/sandbox:next. Mixing lines is explicitly prohibited because the APIs are incompatible.

Why does my sandbox process keep running after the wait times out?

Local wait timeout or AbortSignal only cancels the wait, not the remote process. To stop execution, call the handle's kill(signal) method or pass a remote timeout to exec itself.

How do I keep environment variables across multiple exec calls?

Each exec launch is independent; a cd or export in one is invisible to the next. Pass cwd and env per launch, configure shared variables with setEnvVars, or run one shell script, and never place live secrets in sandbox env.