mintuz/.dotfiles/sandbox-sdk
Claude Code and agent skill by mintuz/.dotfiles
- community
Checking that the SKILL.md file is still in the repository.
Build sandboxed applications for secure code execution. Load when building AI code execution, code interpreters, CI/CD systems, interactive dev environments, or executing untrusted code. Covers Sandbox SDK lifecycle, commands, files, code interpreter, and preview URLs. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
Install
npx vskill@latest install mintuz/.dotfiles/sandbox-sdkSKILL.md
The same SKILL.md was published earlier as openai/plugins/sandbox-sdk.
Cloudflare Sandbox SDK
Build secure, isolated code execution environments on Cloudflare Workers.
FIRST: Verify Installation
Retrieval Sources
Your knowledge of the Sandbox SDK may be outdated. Prefer retrieval over pre-training for any Sandbox SDK task.
| Resource | URL | |
|---|---|---|
| Docs | https://developers.cloudflare.com/sandbox/ | |
| API Reference | https://developers.cloudflare.com/sandbox/api/ | |
| Examples | https://github.com/cloudflare/sandbox-sdk/tree/main/examples | |
| Get Started | https://developers.cloudflare.com/sandbox/get-started/ |
When implementing features, fetch the relevant doc page or example first.
Required Configuration
wrangler.jsonc (exact - do not modify structure):
Worker entry - must re-export Sandbox class:
Quick Reference
| Task | Method | |
|---|---|---|
| Get sandbox | getSandbox(env.Sandbox, 'user-123') | |
| Run command | await sandbox.exec('python script.py') | |
| Run code (interpreter) | await sandbox.runCode(code, { language: 'python' }) | |
| Write file | await sandbox.writeFile('/workspace/app.py', content) | |
| Read file | await sandbox.readFile('/workspace/app.py') | |
| Create directory | await sandbox.mkdir('/workspace/src', { recursive: true }) | |
| List files | await sandbox.listFiles('/workspace') | |
| Expose port | await sandbox.exposePort(8080) | |
| Destroy | await sandbox.destroy() |
Core Patterns
Execute Commands
Code Interpreter (Recommended for AI)
Use runCode() for executing LLM-generated code with rich outputs:
Languages: python, javascript, typescript
State persists within context. Create explicit contexts for production.
File Operations
When to Use What
| Need | Use | Why | |
|---|---|---|---|
| Shell commands, scripts | exec() | Direct control, streaming | |
| LLM-generated code | runCode() | Rich outputs, state persistence | |
| Build/test pipelines | exec() | Exit codes, stderr capture | |
| Data analysis | runCode() | Charts, tables, pandas |
Extending the Dockerfile
Base image (docker.io/cloudflare/sandbox:0.7.0) includes Python 3.11, Node.js 20, and common tools.
Add dependencies by extending the Dockerfile:
Keep images lean - affects cold start time.
Preview URLs (Port Exposure)
Expose HTTP services running in sandboxes:
Production requirement: Preview URLs need a custom domain with wildcard DNS (*.yourdomain.com). The .workers.dev domain does not support preview URL subdomains.
See: https://developers.cloudflare.com/sandbox/guides/expose-services/
OpenAI Agents SDK Integration
The SDK provides helpers for OpenAI Agents at @cloudflare/sandbox/openai:
See examples/openai-agents for complete integration pattern.
Sandbox Lifecycle
getSandbox()returns immediately - container starts lazily on first operation- Containers sleep after 10 minutes of inactivity (configurable via
sleepAfter) - Use
destroy()to immediately free resources - Same
sandboxIdalways returns same sandbox instance
Anti-Patterns
- Don't use internal clients (
CommandClient,FileClient) - usesandbox.*methods - Don't skip the Sandbox export - Worker won't deploy without
export { Sandbox } - Don't hardcode sandbox IDs for multi-user - use user/session identifiers
- Don't forget cleanup - call
destroy()for temporary sandboxes
Detailed References
- [references/api-quick-ref.md](references/api-quick-ref.md) - Full API with options and return types
- [references/examples.md](references/examples.md) - Example index with use cases
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagents/.agents/skills/sandbox-sdk/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mintuz/.dotfiles/sandbox-sdk)