sandbox-migrate-to-next

Migrates Cloudflare Sandbox apps from stable @cloudflare/sandbox to the Sandbox SDK 1.0 preview.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/lettucebo/Skills --skill sandbox-migrate-to-next-lettucebo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sandbox-migrate-to-next
Source: https://github.com/lettucebo/Skills/tree/main/skills/cloudflare/sandbox-migrate-to-next
Command: npx skills add https://github.com/lettucebo/Skills --skill sandbox-migrate-to-next-lettucebo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudflare/sandbox.

What problem does it solve? Porting an existing Cloudflare Sandbox app from the stable @cloudflare/sandbox package to the @next Sandbox SDK 1.0 preview involves breaking API changes—removed sessions, transport settings, buffered exec results, and renamed terminal APIs—that are easy to miss and can break production if the rollout is mishandled. ## Core Features & Use Cases - Structured Migration Workflow: Guides the port through audit, clarification, upgrade, and validation phases with a stable-to-@next replacement map covering exec, sessions, terminals, interpreter, and git operations. - Hard Rules and Red Flags: Enforces critical constraints such as matching Worker package and container image versions, immediate container rollout for production cutover, and argv-based exec without implicit shells. - Use Case: You have a production Worker using stable sandbox sessions and await sandbox.exec("npm test"). This Skill audits the codebase with grep patterns, rewrites calls to handle-based exec with output() waits, swaps the Dockerfile to cloudflare/sandbox:next, and deploys with --containers-rollout=immediate. ## Quick Start Migrate my Cloudflare Worker from stable @cloudflare/sandbox to the @next Sandbox SDK 1.0 preview and update the container image and deploy command.

Frequently Asked Questions about sandbox-migrate-to-next

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

FAQPage Schema
How do I migrate from stable @cloudflare/sandbox to Sandbox SDK 1.0?▼

Install @cloudflare/sandbox@next, switch the Dockerfile to cloudflare/sandbox:next, and apply the replacement map: buffered exec becomes handle-based exec with output() waits, sessions are removed in favor of per-launch cwd/env, and sandbox.terminal becomes createTerminal plus connect. Deploy production with --containers-rollout=immediate.

What replaced sandbox.exec and sessions in Sandbox SDK 1.0?▼

exec now takes an argv array and returns a process handle; awaiting it means the process started, not finished, so use output() or waitFor* methods for results. Default and named sessions are removed—pass cwd and env per launch or run one shell script instead.

Can I use gradual container rollout when migrating to @next?▼

No. Stable and @next control protocols are incompatible both ways, so a gradual rollout leaves a broken mixed window. Production cutover must use wrangler deploy --containers-rollout=immediate, accepting that in-flight processes and terminals may stop.

Does the Sandbox 1.0 preview support the self-deployed bridge?▼

No. The self-deployed bridge stays on the stable line and is not part of the @next preview. If your app uses a self-deployed bridge, leave that component on stable while migrating the rest.

Why does my exec command with shell syntax fail after migrating?▼

Argv is passed as-is with no implicit shell, so pipes, redirects, and cd do not work directly. Invoke an explicit shell binary such as ["/bin/bash", "-lc", "your command"] to get shell behavior.

When should I not use this migration skill?▼

Skip it for day-to-day stable sandbox work, which belongs to sandbox-stable, and for brand-new projects, which should start directly on @next with sandbox-next. Also avoid it for deprecated-API cleanup that does not move to the preview line.