sandbox-migrate-to-next
This skill migrates Cloudflare Sandbox applications from the stable @cloudflare/sandbox package to the @cloudflare/sandbox@next SDK 1.0 preview release.
Identity proven by a skills index on cloudflare.com
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- Apache-2.0 (permissive)
- Pin
- a84b615pinned Oct 9, 2026
- Context cost
- about 1,900 tokenswhen the skill loads
- GitHub stars
- 3,012on cloudflare/skills
- Scripts
- None found
What it does
“Migrate Cloudflare Sandbox apps from stable @cloudflare/sandbox to @cloudflare/sandbox@next (SDK 1.0 preview). Use sandbox-next for apps already on the preview.”
Generated summary from the skill's own text
This skill migrates Cloudflare Sandbox applications from the stable @cloudflare/sandbox package to the @cloudflare/sandbox@next SDK 1.0 preview release. It walks through a five-step workflow to audit the codebase, clarify cutover decisions with users, update packages and container images, and validate the migration. The skill provides a replacement map for deprecated APIs and enforces that Worker packages and container images must match versions during an immediate production rollout.
When to use it
- Upgrading existing Cloudflare Sandbox apps to SDK 1.0 preview before stable release
- Preparing apps for final 1.0 transition with controlled migration steps
- Handling API changes from stable session-based design to next preview design
- Managing production cutover with immediate container rollout requirements
When not to
- Starting new projects, which should use sandbox-next skill directly
- Day-to-day stable work without migration needs
- Gradual or rolling container deployments during cutover
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add cloudflare/skills --skill sandbox-migrate-to-nextInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install cloudflare/skills sandbox-migrate-to-next@a84b615ff9d40e7f99755aea23d65e52d645bd42Installs the commit we checked (a84b615).
Copy by hand
Download the folder at a84b615 and put it in .claude/skills/sandbox-migrate-to-next for Claude Code and in .agents/skills/sandbox-migrate-to-next for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Claude Code plugin
/plugin install cloudflare@claude-plugins-officialThe publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "sandbox-migrate-to-next" by Cloudflare. Source, pinned to commit a84b615ff9d40e7f99755aea23d65e52d645bd42: https://github.com/cloudflare/skills/tree/a84b615ff9d40e7f99755aea23d65e52d645bd42/skills/sandbox-migrate-to-next 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/sandbox-migrate-to-next/ for Claude Code and .agents/skills/sandbox-migrate-to-next/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/cloudflare/sandbox-migrate-to-next
SKILL.md at the pin
---
name: sandbox-migrate-to-next
description: Migrate Cloudflare Sandbox apps from stable @cloudflare/sandbox to @cloudflare/sandbox@next (SDK 1.0 preview). Use sandbox-next for apps already on the preview.
---
# Migrate stable → Sandbox SDK 1.0 preview (`@next`)
**Perform** the port. Follow the steps in order. Depth lives in docs—fetch the linked page when a step needs detail.
Human guide: [Migrate](https://developers.cloudflare.com/sandbox/sdk/migrate/index.md) · [1.0 preview](https://developers.cloudflare.com/sandbox/index.md)
**New projects** should start on `@next` (**`sandbox-next`**), not this skill. **Day-to-day stable work** → **`sandbox-stable`**. Deprecated-API cleanup **without** moving to `@next` → [2026 deprecation guide](https://developers.cloudflare.com/sandbox/sdk/migrate/index.md) first if needed.
Existing apps should migrate **when you can**, so you are ready when 1.0 becomes the stable release. Do **not** force production cutover without the user agreeing.
**Prefer installed `@next` types and the migrate doc over memory.**
## Workflow
1. **Review** hard rules and the replacement map
2. **Audit** the codebase; list hits and target shapes
3. **Clarify** with the user (cutover, bridge, Python image, unclear sites)
4. **Upgrade** package, image, and code
5. **Validate**
Stop after any step that needs a user decision.
## Hard rules
- Worker package and container image must be the **same** `@next` line.
- Production cutover uses **immediate** container rollout. Stable and `@next` control protocols are incompatible both ways; gradual rollout leaves a broken mixed window. In-flight container work can stop.
- After cutover, `await sandbox.exec(...)` means process **started**, not command **finished**.
- Argv is as-is (no implicit shell). Shell syntax needs an explicit shell binary.
- Process handles have **no stdin** → terminals for interactive input.
- Observation `timeout` / `AbortSignal` cancel the **wait only**, not the process.
- No single retry loop for every error.
- Do not invent APIs (`gitCheckout` on core, process stdin, string-exec completion helper).
- Self-deployed bridge stays on **stable** (not part of the preview line yet).
## Replacement map
| Stable | `@next` |
| ------ | ------- |
| `SANDBOX_TRANSPORT` / `transport` / `setTransport` | Remove — RPC only |
| `await sandbox.exec("cmd")` → buffered result | `await sandbox.exec(argv)` → handle, then `output` / waits |
| `execStream` / `startProcess` | Same handle: `logs`, `waitFor*`, `kill` |
| Default / named sessions | Gone — `cwd`/`env` per launch, or one shell script |
| `sandbox.terminal(request)` / session terminal | `createTerminal` + `terminal.connect(request)` |
| xterm `sessionId` | `terminalId` |
| Interpreter methods on `Sandbox` | `withInterpreter` → `sandbox.interpreter.*` |
| `gitCheckout` | argv `git` via `exec` |
| String kill signals | Numeric only |
| Files, mounts, backups, ports, tunnels, `proxyToSandbox` | Mostly unchanged (ignore session/transport bits on stable pages) |
Depth: [Migrate](https://developers.cloudflare.com/sandbox/sdk/migrate/index.md) · after port, day-to-day → **`sandbox-next`**
## Audit
```sh
rg 'SANDBOX_TRANSPORT|transport:|setTransport|enableDefaultSession|createSession|getSession|deleteSession|execStream\(|startProcess\(|killProcess\(|sandbox\.terminal\(|sessionId|gitCheckout\(|SandboxTransport|ExecutionSession'
```
Also: string `exec(`, `cd` then a later `exec`, bare `createCodeContext` / `runCode` on `Sandbox`.
## Clarify (ask when needed)
- OK to cut production with `--containers-rollout=immediate` (live processes/terminals/streams may stop)?
- Self-deployed bridge? Leave on stable.
- Python interpreter → **`-python`** image variant?
- Call sites not covered by the map?
## Upgrade
### Package and image
```sh
npm install @cloudflare/sandbox@next
```
```dockerfile
FROM cloudflare/sandbox:next
# Python: cloudflare/sandbox:next-python
```
Same prerelease tag on Worker and image when not on floating `next`.
### Code by area
Apply replacements from the map. For each area, implement from the doc—not from stable habits:
| Area | Doc |
| ---- | --- |
| Commands / handles / waits | [Processes](https://developers.cloudflare.com/sandbox/index.md) · [Processes API](https://developers.cloudflare.com/sandbox/index.md) |
| `cwd` / `env` / secrets | [Environment](https://developers.cloudflare.com/sandbox/index.md) · [Outbound traffic](https://developers.cloudflare.com/sandbox/sdk/guides/outbound-traffic/index.md) |
| Drop sessions | [Migrate](https://developers.cloudflare.com/sandbox/sdk/migrate/index.md) · [Lifecycle](https://developers.cloudflare.com/sandbox/index.md) |
| Terminals | [Terminals](https://developers.cloudflare.com/sandbox/index.md) |
| Interpreter | [Interpreter](https://developers.cloudflare.com/sandbox/index.md) |
| Errors | [Errors](https://developers.cloudflare.com/sandbox/index.md) |
| Durable job across requests | [Process execution — lifetime / durability](https://developers.cloudflare.com/sandbox/index.md) |
**Commands (shape):**
```ts
// Before (stable)
const result = await sandbox.exec("npm test");
// After (@next)
const process = await sandbox.exec(["/bin/bash", "-lc", "npm test"]);
const result = await process.output({ encoding: "utf8" });
```
```ts
const server = await sandbox.exec(["/bin/bash", "-lc", "npm run dev"], {
cwd: "/workspace/app",
});
await server.waitForPort(3000, { timeout: 60_000 });
await server.kill(); // numeric; default 15
```
**Terminals (shape):**
```ts
const terminal = await sandbox.createTerminal({ command: ["bash"], cwd: "/workspace" });
const t = await sandbox.getTerminal(terminal.id);
if (!t) return new Response("terminal gone", { status: 410 });
return t.connect(request, { cursor, cols, rows });
```
**Interpreter (shape):**
```ts
import { Sandbox as BaseSandbox } from "@cloudflare/sandbox";
import { withInterpreter } from "@cloudflare/sandbox/interpreter";
export class Sandbox extends BaseSandbox<Env> {
interpreter = withInterpreter(this);
}
```
**Git (shape):**
```ts
const clone = await sandbox.exec(
["git", "clone", "--depth", "1", "--", repoUrl, "/workspace/repo"],
{ cwd: "/workspace" },
);
const result = await clone.output({ encoding: "utf8" });
```
Delete transport settings entirely. Remove session APIs. Isolate users with **separate sandbox IDs**.
### Deploy cutover
Staging/branch first. Production is **one** deploy of matching Worker + image:
```sh
npx wrangler deploy --containers-rollout=immediate
```
Leave `rollout_active_grace_period` at default `0` (or set `0` if raised). After cutover, pre-deploy process/terminal IDs are invalid. Details: [Migrate](https://developers.cloudflare.com/sandbox/sdk/migrate/index.md) · [Container rollouts](https://developers.cloudflare.com/containers/configuration/rollouts/index.md)
## Validate
1. Lockfile + Dockerfile on the same `@next` line
2. Typecheck against `@next`
3. Smoke argv `exec` + `output({ encoding: "utf8" })`
4. Smoke long process / terminal / interpreter if used
5. Errors distinguished: unavailable / interrupted-RPC / stale / local wait
6. No live secrets in sandbox env
7. Grep again for removed APIs
8. Production used `--containers-rollout=immediate`
Then day-to-day work uses **`sandbox-next`**.
## Red flags — stop and fix
- Mixing `@next` Worker with stable image (or reverse)
- Gradual container rollout for this cutover
- Treating `await exec` as command completion
- Assuming `cd` / exports persist across `exec` calls
- One retry wrapper for every error
- Inventing `gitCheckout`, process stdin, or undocumented APIs
- Keeping pre-cutover process/terminal IDs after deploy
- Forcing production cutover without user agreement
- Putting live secrets in `setEnvVars` / launch `env`
From cloudflare/skills at a84b615, shown as plain text under its license: Apache-2.0 (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at a84b615Files
- SKILL.md7.9 KB · cd070c652654
1 file, 7.9 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at a84b615More from Cloudflare
security-audit
This skill guides security audits of codebases, APIs, and services by finding vulnerabilities that cross real trust boundaries.
Contains scripts
Claude Code · about 5.4K tokens · pinned 6 days ago
kumo-design
Provides design rules for Cloudflare dashboard interfaces and Kumo UI components, covering text sizing, typography, spacing, borders, icons, animations, and…
Claude Code, Codex, Cursor +4 · about 1.5K tokens · pinned 6 days ago
agents-sdk
This skill helps build and debug Cloudflare Agents SDK applications, enabling creation of persistent agents with state management, RPC methods, scheduling…
Claude Code, Codex, Cursor +4 · about 3K tokens · pinned 6 days ago
basin
This skill helps agents build and troubleshoot Cloudflare Basin analytics workflows, which ingest events, transform data, manage Apache Iceberg tables in R2…
Claude Code, Codex, Cursor +4 · about 600 tokens · pinned 6 days ago
cloudflare
This skill helps agents discover Cloudflare products that match stated requirements and recommend the right combination for architecture and implementation.
Claude Code, Codex, Cursor +4 · about 6.4K tokens · pinned 6 days ago
cloudflare-email-service
This skill enables agents to send transactional emails and route incoming emails using Cloudflare's Email Service platform.
Claude Code, Codex, Cursor +4 · about 1.6K tokens · pinned 6 days ago
Related in Cloud and DevOps
cloudflare-one-migrations
This skill helps assess and plan migrations from VPN, SWG, or SASE platforms (Zscaler ZIA/ZPA, Palo Alto, legacy systems) to Cloudflare One.
by CloudflareOfficial publisher
Claude Code, Codex, Cursor +4 · about 3.1K tokens · pinned 6 days ago
k2
This skill helps agents build and manage Cloudflare K2 durable logs for event streaming.
by CloudflareOfficial publisher
Claude Code, Codex, Cursor +4 · about 490 tokens · pinned 6 days ago
nextjs-on-cloudflare
This skill guides agents to build and deploy Next.js applications on Cloudflare Workers using vinext, a Vite-based reimplementation of Next.js.
by CloudflareOfficial publisher
Claude Code, Codex, Cursor +4 · about 560 tokens · pinned 6 days ago
sandbox-next
This skill enables building and maintaining Cloudflare Sandbox apps using the @cloudflare/sandbox@next SDK (1.0 preview), which provides isolated Linux…
by CloudflareOfficial publisher
Claude Code, Codex, Cursor +4 · about 1.6K tokens · pinned 6 days ago
sandbox-stable
Builds and maintains Cloudflare Sandbox applications on the stable @cloudflare/sandbox package, providing isolated Linux environments running on Cloudflare…
by CloudflareOfficial publisher
Claude Code, Codex, Cursor +4 · about 2.3K tokens · pinned 6 days ago
wrangler
This skill enables the agent to run Wrangler CLI commands for Cloudflare Workers projects, including local development setup, configuration management…
by CloudflareOfficial publisher
Claude Code, Codex, Cursor +4 · about 2.7K tokens · pinned 6 days ago