sandbox-migrate-to-next

Migrates Cloudflare Sandbox apps from stable SDK to the @next 1.0 preview.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudflare/sandbox.

What problem does it solve? Porting a Cloudflare Sandbox application from the stable @cloudflare/sandbox SDK to the @next 1.0 preview involves breaking API changes—removed sessions, handle-based exec, new terminal and interpreter patterns, and incompatible container rollout behavior—that are easy to get wrong without a structured procedure. ## Core Features & Use Cases - Guided migration workflow: Audit the codebase with ready-made grep patterns, clarify cutover decisions with the user, upgrade package and container image, then validate the result. - Replacement map and code shapes: Concrete before/after TypeScript snippets for exec handles, terminals, interpreters, and git operations, plus a stable-to-next API mapping table. - Safe production cutover: Enforces matching Worker/image versions and immediate container rollout to avoid a broken mixed-protocol window. - Use Case: You maintain a Worker using sandbox.exec with sessions and want to move to @cloudflare/sandbox@next; the skill audits your code, rewrites each call site, and walks you through a safe deploy. ## Quick Start Migrate my Cloudflare Sandbox app from the stable SDK to @cloudflare/sandbox@next, auditing the code and updating each API call site.

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 @cloudflare/sandbox stable to the 1.0 preview?

Install @cloudflare/sandbox@next, switch the container image to cloudflare/sandbox:next, then replace removed APIs: sessions become per-launch cwd/env, buffered exec becomes handle-based exec with output() waits, and sandbox.terminal becomes createTerminal plus connect. Deploy production with --containers-rollout=immediate.

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

exec now takes an argv array and returns a process handle; call output() or waitFor* methods on it instead of awaiting a buffered result. Default and named sessions are removed—pass cwd and env per launch or run one shell script.

Can I use gradual container rollout when migrating to @cloudflare/sandbox@next?

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

Does the Cloudflare Sandbox 1.0 preview support gitCheckout and process stdin?

No. gitCheckout is removed—run git through argv exec instead. Process handles have no stdin; use createTerminal for interactive input. Do not invent these APIs on the new SDK.

When should I not migrate my Cloudflare Sandbox app to @next?

Stay on stable if you run a self-deployed bridge (it is not part of the preview line) or if you cannot accept an immediate production cutover that stops live processes. New projects should start directly on @next rather than migrating.