Sandbox Migrate To Next logo

Sandbox Migrate To Next

OrganizationPopular
cloudflare
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.

Overview

Publishercloudflare
Repositoryskills
Skill namesandbox-migrate-to-next
Stars
2.8K
Forks
277
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by cloudflare on GitHub. Read the source before you install it.

Installation

Install the Sandbox Migrate To Next AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/cloudflare/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/sandbox-migrate-to-next .claude/skills/sandbox-migrate-to-next
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Sandbox Migrate To Next in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Sandbox Migrate To Next on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Sandbox Migrate To Next is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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 worksandbox-stable. Deprecated-API cleanup without moving to @next2026 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

  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 / setTransportRemove — RPC only
await sandbox.exec("cmd") → buffered resultawait sandbox.exec(argv) → handle, then output / waits
execStream / startProcessSame handle: logs, waitFor*, kill
Default / named sessionsGone — cwd/env per launch, or one shell script
sandbox.terminal(request) / session terminalcreateTerminal + terminal.connect(request)
xterm sessionIdterminalId
Interpreter methods on SandboxwithInterpretersandbox.interpreter.*
gitCheckoutargv git via exec
String kill signalsNumeric only
Files, mounts, backups, ports, tunnels, proxyToSandboxMostly unchanged (ignore session/transport bits on stable pages)

Depth: Migrate · 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:

AreaDoc
Commands / handles / waitsProcesses · Processes API
cwd / env / secretsEnvironment · Outbound traffic
Drop sessionsMigrate · Lifecycle
TerminalsTerminals
InterpreterInterpreter
ErrorsErrors
Durable job across requestsProcess execution — lifetime / durability

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 · Container rollouts

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

Frequently asked questions

What does the Sandbox Migrate To Next AI skill do?

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.

Why use Sandbox Migrate To Next on TypingMind?

Because you install it once and use it with any model. Sandbox Migrate To Next is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Sandbox Migrate To Next in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/cloudflare/skills/tree/main/skills/sandbox-migrate-to-next. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Sandbox Migrate To Next?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Sandbox Migrate To Next?

As many as you like. As long as a model supports skills, you can use Sandbox Migrate To Next with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Sandbox Migrate To Next AI skill free?

Yes. It is published on GitHub by cloudflare under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇