sandbox-migrate-to-next
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.
Install / Use
npx skills add cloudflare/skills --skill sandbox-migrate-to-nextInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Our assessment of sandbox-migrate-to-next
sandbox-migrate-to-next scores 86/100 on our quality scale, 1288th of 3,478 Development & Engineering skills we index (top 38%).
Its SKILL.md is 7.8 KB long, well organised into 13 sections with 9 code examples: a thorough specification that gives an agent plenty to work with.
With 2,898 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 6 days ago, so sandbox-migrate-to-next is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit β read the skill file before letting an agent act on it.
sandbox-migrate-to-next compared with similar skills
All 4 of these similar skills score higher than sandbox-migrate-to-next; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| sandbox-migrate-to-next (this skill)by cloudflare | 86 | 2.9k | 6d ago | SKILL.md |
| ai-job-searchby MadsLorentzen | 100 | 44.4k | today | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 41.7k | 3d ago | CLAUDE.md |
| algorithmic-artby anthropics | 100 | 177.9k | 6d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 6d ago | SKILL.md |
Frequently asked questions
- How do I install sandbox-migrate-to-next?
- Run
npx skills add cloudflare/skills --skill sandbox-migrate-to-next. The install tabs above show the steps for each supported agent. - Which AI agents does sandbox-migrate-to-next work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is sandbox-migrate-to-next safe to use?
- It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is sandbox-migrate-to-next still maintained?
- The repository was last updated 6 days ago, so sandbox-migrate-to-next is actively maintained.
Skill content
View source on GitHubname: 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 Β· 1.0 preview
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 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
- Review hard rules and the replacement map
- Audit the codebase; list hits and target shapes
- Clarify with the user (cutover, bridge, Python image, unclear sites)
- Upgrade package, image, and code
- Validate
Stop after any step that needs a user decision.
Hard rules
- Worker package and container image must be the same
@nextline. - Production cutover uses immediate container rollout. Stable and
@nextcontrol 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/AbortSignalcancel the wait only, not the process. - No single retry loop for every error.
- Do not invent APIs (
gitCheckouton 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 Β· after port, day-to-day β sandbox-next
Audit
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 β
-pythonimage variant? - Call sites not covered by the map?
Upgrade
Package and image
npm install @cloudflare/sandbox@next
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 Β· Processes API |
| cwd / env / secrets | Environment Β· Outbound traffic |
| Drop sessions | Migrate Β· Lifecycle |
| Terminals | Terminals |
| Interpreter | Interpreter |
| Errors | Errors |
| Durable job across requests | Process execution β lifetime / durability |
Commands (shape):
// 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" });
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):
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):
import { Sandbox as BaseSandbox } from "@cloudflare/sandbox";
import { withInterpreter } from "@cloudflare/sandbox/interpreter";
export class Sandbox extends BaseSandbox<Env> {
interpreter = withInterpreter(this);
}
Git (shape):
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:
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 Β· Container rollouts
Validate
- Lockfile + Dockerfile on the same
@nextline - Typecheck against
@next - Smoke argv
exec+output({ encoding: "utf8" }) - Smoke long process / terminal / interpreter if used
- Errors distinguished: unavailable / interrupted-RPC / stale / local wait
- No live secrets in sandbox env
- Grep again for removed APIs
- Production used
--containers-rollout=immediate
Then day-to-day work uses sandbox-next.
Red flags β stop and fix
- Mixing
@nextWorker with stable image (or reverse) - Gradual container rollout for this cutover
- Treating
await execas command completion - Assuming
cd/ exports persist acrossexeccalls - 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/ launchenv
Related Skills
ai-job-search
44.4kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
41.7kA visual, example-driven guide to Claude Code β from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way β as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an emβ¦
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit β see the Safety scan above for what the skill file itself contains.
