yolo-docker
claude_code
2 companion files
SKILL.md
--- name: yolo description: Skill that spawns a Docker sandbox with Claude Code for autonomous development tasks. Use that when user mentions 'yolo mode, 'yolo work', 'in sandbox' or similar word indicating isolated environment for code changes. allowed-tools: Bash, Write, Read, Edit, Grep, Glob, Task, WebSearch, WebFetch, Skill, SlashCommand, Task, mcp__jina__*, Bash(gh:*) --- # YOLO Mode - Docker Sandbox Orchestration Spin up isolated Docker sandboxes with Claude Code running in `--dangerously-skip-permissions` mode (safe inside container). ## Quick Reference ```bash SANDBOX="/root/.claude/skills/yolo/docker-sandbox.ts" # Basic sandbox bun $SANDBOX <directory> # Claude YOLO mode (interactive) bun $SANDBOX --claude <directory> # Claude with task (non-interactive) bun $SANDBOX --claude --prompt "<task>" <directory> # With ports bun $SANDBOX --claude --ports 3000,8080 <directory> # Full isolation bun $SANDBOX --claude --no-network <directory> # Memory-efficient options (RECOMMENDED for parallel execution) bun $SANDBOX --claude --memory 2g --model haiku --prompt "<task>" <directory> # Management bun $SANDBOX --shell <directory> # Shell access bun $SANDBOX --logs <directory> # View logs bun $SANDBOX --stop <directory> # Stop bun $SANDBOX --remove <directory> # Remove container bun $SANDBOX --teardown <directory> # Remove container + image bun $SANDBOX --rebuild <directory> # Rebuild image bun $SANDBOX --status # Show all running instances # Parallel execution with worktrees (RECOMMENDED) /tree feat/task-1,feat/task-2 # Create worktrees first bun $SANDBOX --claude --background --auto-port --prompt "<task>" <worktree-dir> bun $SANDBOX --status # Monitor all instances /tree merge feat/task-1 # Merge after completion ``` ## Execution Instructions When the user invokes this skill: ### 1. Gather Requirements Ask if not provided: - **Directory**: Project path (default: current working directory) - **Ports**: Comma-separated (e.g., "3000,5173,8080") - **Task**: What Claude should accomplish in the sandbox #### 1.1 About tasks - The tasks can refer to existing claude code slash commands, agent configuration and skills, they are available inside the container in user space. (~/.claude) ### 2. Validate & Execute ```bash # Check Docker is running docker info > /dev/null 2>&1 || echo "Docker not running" # Spin up sandbox with task bun /root/.claude/skills/yolo/docker-sandbox.ts \ --claude \ --prompt "<user's task>" \ --ports <ports> \ <directory> ``` The docker sandbox is a long running task. Use the Bash tool with `run_in_background: true` parameter. This returns an `output_file` path - use `Read` tool or `tail` to check progress periodically. Use `TaskOutput` tool to retrieve final results. Check status every 5 minutes initially, then increase interval by 1 minute every 10 minutes. ### 3. Report Status After execution, provide: ``` ## Sandbox Status | Container | Directory | Ports | Status | Log Path | |-----------|-----------|-------|--------|---------| | ai-sandbox-xxxx | /path | 3000 | Running | Path to logs | ## Access - http://localhost:3000 ## Commands - Logs: `bun docker-sandbox.ts --logs <dir>` - Shell: `bun docker-sandbox.ts --shell <dir>` - Stop: `bun docker-sandbox.ts --stop <dir>` ``` ## Multi-Sandbox Orchestration ### True Parallel Execution with Worktrees (RECOMMENDED) Use git worktrees to isolate each task. Each container mounts its own worktree directory, preventing git conflicts. ```bash # Step 1: Create worktrees with /tree command /tree feat/task-1,feat/task-2,feat/task-3 # Step 2: Each container mounts its own worktree bun $SANDBOX --claude --background --instance-id task-1 --auto-port \ --prompt "implement feature 1" ~/project/trees/feat/task-1 & bun $SANDBOX --claude --background --instance-id task-2 --auto-port \ --prompt "implement feature 2" ~/project/trees/feat/task-2 & bun $SANDBOX --claude --background --instance-id task-3 --auto-port \ --prompt "implement feature 3" ~/project/trees/feat/task-3 & # Step 3: Monitor progress bun $SANDBOX --status # Step 4: After completion, merge with /tree merge /tree status /tree merge feat/task-1 /tree merge feat/task-2 /tree merge feat/task-3 ``` ### Parallel for Different Projects ```bash bun $SANDBOX --name svc-1 --claude --prompt "task 1" --ports 8080 ~/svc1 & bun $SANDBOX --name svc-2 --claude --prompt "task 2" --ports 3000 ~/svc2 & wait ``` ### Sequential (dependent tasks) ```bash bun $SANDBOX --claude --prompt "build API" --ports 8080 ~/backend bun $SANDBOX --claude --prompt "build frontend using API at :8080" --ports 3000 ~/frontend ``` ### Monitor all ```bash # Quick status view bun $SANDBOX --status # Docker commands docker ps --filter "name=ai-sandbox" docker stop $(docker ps -q --filter "name=ai-sandbox") docker rm -f $(docker ps -aq --filter "name=ai-sandbox") ``` ## Container Features - **Base**: Ubuntu 22.04 with Node.js 24, Bun, TypeScript - **AI Tools**: Claude Code, Codex, Gemini CLI - **TTY**: Full terminal support (xterm-256color, UTF-8) - **Mounts**: Working dir → `/workspace`, plus `~/.claude*`, `~/.codex`, `~/.gemini` - **Signals**: `--init` for proper Ctrl+C handling ## Memory Management for Parallel Execution Each container needs memory. Plan based on your system: | System RAM | Recommended --memory | Max Parallel Containers | | ---------- | -------------------- | ----------------------- | | 8GB | 2g | 2-3 | | 16GB | 2g | 5-6 | | 16GB | 4g (default) | 3 | | 32GB | 4g | 6-7 | | 32GB | 2g | 12-14 | **For 3+ parallel tasks, ALWAYS use `--memory 2g`:** ```bash # Safe parallel execution bun $SANDBOX --claude --background --memory 2g --prompt "task 1" <dir1> bun $SANDBOX --claude --background --memory 2g --prompt "task 2" <dir2> bun $SANDBOX --claude --background --memory 2g --prompt "task 3" <dir3> ``` The script will warn you if memory is low and suggest appropriate settings. ## Safety | Flag | Effect | | -------------- | ---------------------------------------- | | (default) | Network enabled, changes persist to host | | `--no-network` | Full network isolation | | `--dind` | Docker-in-Docker (privileged) | Changes in `/workspace` **persist** to the mounted host directory. ## Troubleshooting **Claude won't start interactively:** ```bash bun /root/.claude/skills/yolo/docker-sandbox.ts --rebuild <directory> ``` **Container exists but won't start:** ```bash bun /root/.claude/skills/yolo/docker-sandbox.ts --remove <directory> bun /root/.claude/skills/yolo/docker-sandbox.ts --claude <directory> ``` **Check container status:** ```bash docker ps -a --filter "name=ai-sandbox" ``` ---
Danger Zone
Deleting this skill will remove all associated files. This action cannot be undone.
Owner
Prasham Trivedi
Created
2/16/2026, 6:50:18 PM
Last Updated
2/16/2026, 6:50:18 PM
🆔 Skill ID
iItaXKwJJ6bBRpNZVr5eS