Cloudflare Sandbox Builder
Guides agents in building secure, isolated code execution on Cloudflare Workers.
The document explicitly targets isolated execution of untrusted code and recommends per-user or per-session sandbox IDs and cleanup. However, it does not explain network isolation, credential or environment-variable handling, sensitive-data flows, preview URL access control, user confirmation, or recovery. The irreversible impact of destroy() is also underexplained, so points are deducted.
Installation requirements, configuration, core APIs, error handling, and result-error checks are documented, making the happy path plausible. However, the quick reference describes readFile() as returning an object while an earlier example treats the result directly as file content; there is no committed test suite, compatibility matrix, or broad failure-diagnostic coverage. Under static calibration, the score is capped below 10.
Target scenarios, triggers, and main API use cases are fairly clear for AI code execution, CI/CD, and interactive development. Non-fit cases, permission boundaries, network requirements, I/O constraints, and Chinese-language support are insufficiently specified, and the retrieval-first workflow depends on external Cloudflare documentation, limiting environment-fit evidence.
The skill includes installation steps, layered references, an example index, anti-patterns, lifecycle notes, and an Apache-2.0 license. It lacks a named maintenance owner, update path, changelog, SDK version policy, known-limitations section, and systematic FAQ; the instruction to preserve an exact configuration structure also hides assumptions.
Copyable configuration, Worker export, command, interpreter, file, and port examples provide clear value for the core setup task. However, the examples have no execution evidence in the supplied files, important production safety configuration is incomplete, and API details are partly inconsistent, so the score reflects only plausible completion of the core task.
The skill supplies pinned-looking documentation, API, and example repository references plus return types and error structures, providing some traceability. Evidence is still primarily author-provided documentation, with no committed tests, CI coverage of Sandbox key paths, or independent reproduction record. Under static calibration, the score is capped below 5.
- Do not treat the claims of being secure or isolated as verified security boundaries; separately review networking, credentials, quotas, tenant isolation, and preview URL authentication before deployment.
- Verify the actual readFile() return type and SDK version because the supplied examples are inconsistent.
- Before executing user- or model-generated code, define confirmation, data-access, external-network, and destruction/recovery policies.
- The retrieval workflow depends on Cloudflare documentation and GitHub examples; confirm reachability from mainland-China networks and prepare an offline version if needed.
What does this skill do, and when should you use it?
This skill helps build secure, isolated execution environments on Cloudflare Workers. It covers Sandbox SDK lifecycle management, commands, files, the code interpreter, and preview URLs. Local development requires `@cloudflare/sandbox` and Docker. For Sandbox SDK work, it directs agents to retrieve current Cloudflare documentation and examples before implementing features.
Guides installation of @cloudflare/sandbox, configuration of wrangler.jsonc, and re-exporting the Sandbox class from the Worker entry point. It shows how to obtain sandboxes with getSandbox(), execute commands with exec(), run Python, JavaScript, or TypeScript with runCode(), create persistent code contexts, read and write files, create and list directories, expose ports, and destroy sandboxes. It also covers Dockerfile extensions, preview URL requirements, and integration helpers for the OpenAI Agents SDK.
- A Cloudflare Workers developer executing untrusted code can use it to build an isolated runtime.
- An AI product team building a code execution feature or interpreter can use `runCode()` with persistent contexts.
- An engineer implementing CI/CD or build pipelines can use `exec()` for exit codes and stderr capture.
- A team building an interactive development environment can combine workspace file operations, port exposure, and preview URLs.
- A developer running data analysis in a sandbox can use Python, pandas, and rich chart or table outputs.
What are this skill's strengths and limitations?
- Covers sandbox acquisition, commands, code interpretation, files, ports, and lifecycle management.
- Provides directly reusable TypeScript patterns and configuration examples.
- Uses a retrieval-first workflow to address potentially outdated SDK knowledge.
- Includes guidance for Dockerfile extensions, preview URLs, and OpenAI Agents SDK integration.
- Docker is explicitly required for local development.
- Production preview URLs require a custom domain with wildcard DNS; `workers.dev` does not support preview URL subdomains.
- The SKILL.md provides no test suite or automated verification workflow.
- Full API options and return types are delegated to reference files that are not included in the supplied material.
How do you install this skill?
Install the dependency and verify local Docker: npm install @cloudflare/sandbox, then run docker info. Copy the repository folder skills/sandbox-sdk into the skill directory used by your Agent Skills client. The README lists ~/.claude/skills/ for Claude Code, ~/.cursor/skills/ for Cursor, ~/.config/opencode/skills/ for OpenCode, ~/.codex/skills/ for OpenAI Codex, and ~/.pi/agent/skills/ for Pi.
How do you use this skill?
In an Agent Skills-compatible client, make a specific Sandbox SDK request such as: “Create a Cloudflare Workers Sandbox that runs Python code and returns the result.” Before implementation, retrieve the relevant page from https://developers.cloudflare.com/sandbox/, the API reference, or the examples. Preserve the required container, Durable Object binding, migration, and export { Sandbox } configuration.