sandbox — команда для Claude Code: что делает и как установить
Команда sandbox создаёт временный SpecKit-проект по рецепту или показывает доступные рецепты и уже созданные песочницы. Работает в Claude Code и Codex.
MIT ★ 110 обновлён 2026-10-19
.claude/commands/sandbox.mdЧто делает sandbox
sandbox создаёт небольшую временную песочницу из рецепта в соседнем репозитории speckit-sandboxes. Пустой вызов показывает рецепты и существующие песочницы, а where печатает путь к корню песочниц. При сборке занятое имя не перезаписывается: добавляется суффикс вроде -2 или -3.
Для режима разработки есть флаг --dev: тогда Companion берётся из текущего checkout через COMPANION_DIR="$PWD". Дополнительные аргументы после имени передаются рецепту без изменений, что нужно, например, для сценария living-specs. Команда не удаляет папки и не пишет в этот репозиторий.
Перед запуском нужен checkout репозитория speckit-sandboxes: .claude/sandboxes-env.sh задаёт пути к нему и к корню песочниц. Без этого checkout команда остановится. Если сборка завершится ошибкой, частично созданная папка останется на месте.
Какие задачи решает
- создать временный SpecKit-проект по рецепту
- посмотреть список доступных рецептов
- найти уже созданные песочницы
- узнать путь к корню песочниц
- собрать песочницу с Companion из текущего checkout
Примеры запросов агенту
- Создай песочницу по рецепту
living-specsс именемdrift-check - Покажи доступные рецепты и уже созданные песочницы через
/sandbox - Выведи путь к корню песочниц командой
/sandbox where
Как установить sandbox
Вручную: положить файлы
.claude/commands/sandbox.mdВызов — /sandbox. Для всех проектов — ~/.claude/commands/
Вручную: положить файлы
~/.codex/prompts/sandbox.mdВызов — /prompts:sandbox. В Codex этот формат помечен устаревшим, замена — скиллы
Вручную: положить файлы
.github/prompts/sandbox.prompt.mdВручную: положить файлы
.gemini/commands/sandbox.tomlGemini хранит команды в TOML: текст запроса — в поле prompt
Вопросы о sandbox
Как установить sandbox в Claude Code?
Скопируйте файл в .claude/commands/sandbox.md.
Что делает команда sandbox?
Она создаёт временную SpecKit-песочницу из рецепта либо выводит список рецептов и существующих песочниц. Путь к корню можно получить через /sandbox where.
Что произойдёт при запуске sandbox с флагом --dev?
Companion будет установлен из текущего checkout через COMPANION_DIR="$PWD". Рецепты vscode-qa-stock, copilot-stock и claude-mod-stock отказываются от --dev, поэтому сборка не запускается.
Исходный текст
sandbox.md · MIT
---
allowed-tools: Bash(. .claude/sandboxes-env.sh:*), Bash("$SANDBOXES_REPO"/new-sandbox.sh:*), Bash(ls:*)
description: Build a throwaway SpecKit test sandbox from a recipe, or list the recipes and the sandboxes that exist
argument-hint: "[<recipe> [name] [--dev] | where]"
---
## Your task
Build one test sandbox, or show what there is. A sandbox is a small throwaway project in a known starting state; the recipes live in the sibling `speckit-sandboxes` repo and every built sandbox lands under its sandbox root, never in this repo.
Shell state does not persist between Bash calls, so start each one with `. .claude/sandboxes-env.sh`. It sets `$SANDBOXES_REPO` (the sibling checkout) and `$SANDBOXES_DIR` (the sandbox root). If it says there is no checkout, relay that line and stop.
### Read `$ARGUMENTS`
- **empty**: list. Print the recipes, then the sandboxes that already exist:
```bash
. .claude/sandboxes-env.sh && "$SANDBOXES_REPO"/new-sandbox.sh --list
. .claude/sandboxes-env.sh && ls -1 "$SANDBOXES_DIR" 2>/dev/null || echo "(no sandboxes yet)"
```
Show both as two short lists, with the root's path above the second. Do not build anything. Two folders in the second list are not sandboxes, so say what they are when they show up: `bench-cells` holds the benchmark's cells and `awesome-copilot` is `/publish-canvas`'s upstream clone.
- **`where`**: print the sandbox root and nothing else.
```bash
. .claude/sandboxes-env.sh && "$SANDBOXES_REPO"/new-sandbox.sh --where
```
- **`<recipe> [name]`**: build one. The name defaults to the recipe, and a name that is taken is never reused: the new sandbox becomes `<name>-2`, then `-3`.
```bash
. .claude/sandboxes-env.sh && "$SANDBOXES_REPO"/new-sandbox.sh <recipe> [name]
```
- **`<recipe> [name] --dev`**: the same, with Companion installed from this checkout in place of the published build. `COMPANION_DIR` points the recipe here; without it the recipe uses the `speckit-companion` folder beside the sandboxes repo, which is not this checkout when you are in a worktree.
```bash
. .claude/sandboxes-env.sh && COMPANION_DIR="$PWD" "$SANDBOXES_REPO"/new-sandbox.sh <recipe> [name] -- --dev
```
A recipe with no Companion (`vscode-qa-stock`, `copilot-stock`, `claude-mod-stock`) refuses `--dev`; say so and build nothing.
Anything else after the name goes to the recipe after `--`, unchanged: `living-specs` takes its scenario that way (`/sandbox living-specs drift-check ls-6`). An unknown recipe prints the list; relay it.
### Report
The recipe ends by printing `Sandbox ready: <folder>` and what to do in it. Relay exactly that: the folder, and what to type next. Add nothing of your own, and do not open the folder or run anything in it.
### Guardrails
- This command never deletes anything: not a sandbox, not a file inside one, not the root. Throwing a sandbox away is the user's call and the user's `rm`.
- It never builds over an existing folder, and never writes into this repo.
- A build that fails leaves its half-built folder in place. Name it in the report so the user can look, and do not clean it up.
© alfredoperez · MIT · alfredoperez/speckit-companion