docker-sandboxes-env
Use this skill when creating, updating, reviewing, planning, or running a declarative `sbxenv.yaml` file for Docker Sandboxes (`sbx env plan/create/run/exec/rm`), even if the user just says "check in a sandbox config", "set up this project for sbx env", "which kits should this project's sbxenv use", "bump or pin the kits in my sbxenv", or "run a setup script before the agent starts". Covers composing an agent workload and v3 mixin kits chosen from the live Docker Hub catalog with the bundled `scripts/kits.py` helper, kit and environment `args`, secrets/registries/bindings, workspace and mounts, `entrypoint`/`cmd`, ports, MCP servers, `sandboxOptions` (including `writableEnvFiles`), host `lifecycle` commands and the approval plan, multi-file merge, and the `~/.sbxenv.yaml` user defaults.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 12
- Forks
- 5
01 前言 Front Matter
- name
- docker-sandboxes-env
- license
- Apache-2.0
- description
- Use this skill when creating, updating, reviewing, planning, or running a declarative `sbxenv.yaml` file for Docker Sandboxes (`sbx env plan/create/run/exec/rm`), even if the user just says "check in a sandbox config", "set up this project for sbx env", "which kits should this project's sbxenv use", "bump or pin the kits in my sbxenv", or "run a setup script before the agent starts". Covers composing an agent workload and v3 mixin kits chosen from the live Docker Hub catalog with the bundled `scripts/kits.py` helper, kit and environment `args`, secrets/registries/bindings, workspace and mounts, `entrypoint`/`cmd`, ports, MCP servers, `sandboxOptions` (including `writableEnvFiles`), host `lifecycle` commands and the approval plan, multi-file merge, and the `~/.sbxenv.yaml` user defaults.
- compatibility
- Requires standalone sbx with experimental `sbx env` support and sbxenv.yaml schemaVersion "1"; help and docs checked against sbx v0.51.0. scripts/kits.py needs Python 3.9+ and anonymous HTTPS access to Docker Hub (PyYAML only for older YAML descriptors). Provenance is in references/sources.md.
02 资源文件 10
- 参考文档agents/openai.yaml484 B
- 资产文件assets/sbxenv.yaml286 B
- 参考文档checks/runtime-results.md4.7 KB
- 参考文档checks/verification.md6.2 KB
- 参考文档evals/scaffold-pin-plan.yaml3.6 KB
- 参考文档references/authoring-workflow.md11.2 KB
- 参考文档references/env-schema-fields.md11.9 KB
- 参考文档references/sources.md2.7 KB
- 脚本scripts/kits.py29.6 KB
- 参考文档skill.yaml2.1 KB
03 SKILL.md 正文
Docker Sandboxes: Declarative sbxenv.yaml Environments
Overview
sbxenv.yaml (schemaVersion "1", EXPERIMENTAL) declares one local or cloud
sandbox environment: the agent, the kits composed onto it, workspace mounts,
environment variables, secrets/registries/bindings to provision, MCP servers,
ports, launch command, and host-side lifecycle commands. sbx env plan|create|run|exec|rm stand it up and tear it down reproducibly instead of a
long flag invocation. This skill owns that file end to end: authoring it from
the project's signals, refreshing its kit references, and explaining how it is
applied and approved. Decoding is strict — an unknown key anywhere is an error
— so check references/env-schema-fields.md before writing a field you are
not sure about.
When to use this skill
Activate this skill when:
- The user wants a checked-in, reproducible sandbox environment instead of a
long
sbx create/sbx runcommand line, or asks to scaffold, create, or review ansbxenv.yamlor~/.sbxenv.yaml. - The user wants kits suggested for a project's
sbxenv.yaml, or wants the kit references in an existingsbxenv.yamlupgraded, bumped, or pinned to digests. - The user wants host-side setup or teardown commands (cloning a repo, seeding fixtures, archiving state) tied to the environment's lifecycle.
- The user wants to parameterize a shared environment file with named
arguments (
args:+--env-arg). - The user is debugging why
sbx env create/runasks for approval, or why a declared change did not take effect on an existing sandbox.
Do not use this skill when
Do not use this skill when:
- The task is the underlying
sbx create/run/rmflag-based workflow with nosbxenv.yamlinvolved — usedocker-sandboxes-lifecycle. - The task is choosing network policy or storing a secret/registry credential
independent of any environment file — use
docker-sandboxes-network-credentials. This file'ssecrets:/registries:/bindings:provision into that same store; do not redefine its rules here. - The task is authoring, building, publishing, or signing the kit descriptor
a
kits:entry references, or composing kits withsbx run --kitflags and no environment file — usedocker-sandboxes-kits. This skill only selects, configures, and pins kits inside ansbxenv.yaml.
Core guidance
Ground rules when writing or updating a file
- Look up kits live, every time. Kits, tags, and digests change daily.
Take every kit name, tag, digest, arg, and credential from
scripts/kits.pyin the current run — never from memory, an earlier conversation, or the examples in this skill. If Docker Hub is unreachable the helper exits nonzero; say so and stop suggesting kits rather than guessing. - Pick the highest version tag, not the one pushed last. Hub lists tags by
last update, and a republished old release or a moving tag (
latest,edge) can sit on top. UsenewestRelease/suggestedfromkits.py update, which ranks dotted versions numerically. Do not write a bare untagged reference or:latestwhen a release tag exists. - Prefer v3 kits. Search results are v3-only by default. If a file uses a
v2 kit (often a
-kitsuffix) and a v3 sibling exists, offer the move. - Never write secret values. Use
ref:orcommand:, even if asked for a literal: the file is meant to be committed. A binding approves a credential; it never contains one. - Guide, don't interrogate. Recommend a concrete choice with a one-line reason at each step, batch related questions, and skip what the workspace already answers.
- When updating, edit in place. Keep the user's comments, ordering, and formatting; change only what the user agreed to.
The scripts/kits.py helper
scripts/kits.py ships in this skill's directory; substitute the path this
SKILL.md was loaded from for <skill-dir>. It uses only the standard
library, prints JSON, reads public repositories anonymously, and must be run
with python3 -I. A nonzero exit means at least one lookup failed: that entry
carries error, and the other entries remain valid.
| Command | Use |
|---|---|
kits.py search [TERM …] [--orgs a,b] [--include-v2] |
v3 kits under sbx/ and docker/, ranked by pulls. Each term is a separate Hub search; no term lists the whole catalog for those orgs. |
kits.py describe REF … [--arg [HANDLE.]NAME=VALUE …] [--platform OS/ARCH] |
From the live descriptor: kind, agent, handle (what agent: uses), version, create-phase args, buildArgs, buildSecrets, credentials with a suggestedBinding, and hostGrants. Pass --platform for the machine that runs sbx if it differs from this one. |
kits.py update REF … [--pin] |
suggested = the highest version release tag (or the same moving tag), with a fresh digest when REF was pinned or --pin is given; also newestRelease and notes such as major bumps. Local and git sources are skipped. |
kits.py pin REF … |
TAG@DIGEST for the tag as written. Never changes the release. Pin a tagged reference: an untagged one comes back digest-only for whatever latest points to. |
kits.py tags REF |
Every tag with its digest, in Hub last-updated order. Inspect only; never pick a release from the top of this list. |
python3 -I <skill-dir>/scripts/kits.py search go github
python3 -I <skill-dir>/scripts/kits.py update sbx/playwright
Create or update workflow
- Decide the mode.
./sbxenv.yamlexists → update. A project-level./.sbxenv.yamlis not read (that name is only the home-directory defaults file); offer to rename it tosbxenv.yaml.~/.sbxenv.yamlis the user's personal defaults — usually bindings andsandboxOptions, not project kits. Nothing exists → create. - Create: read only the file listing, manifests, and git remote; turn
signals into search terms;
searchanddescribecandidates to shortlist; resolve each kit'snewestReleaseanddescribethat exact reference before configuring it; propose a composition table (kit, kind, tag, why); set kit and environment args from that descriptor; add bindings/secrets per credential; set workspace and options; ask tags vs tag+digest; write the file with a prerequisites header; then run the checks. - Update: list every
kits:source andagent:; runkits.py updateon all OCI references in one call; present current → suggested with notes; for each accepted change,describeold and new and reconcile args, credentials, host grants,kind, andhandle; apply only accepted edits in place.
The step-by-step procedure, the workspace-signal table, credential and host
grant handling, and the final checklist are in
references/authoring-workflow.md. Follow it rather than improvising.
Composition: agent: and kits:
- A composition has exactly one workload and any number of mixins.
agent:is either a built-in agent (claude,codex,shell, …) or the name of the agent workload kit listed underkits:— itshandleaskits.py describereports it. To add tools to a built-in agent, keep the built-in name inagent:and list only mixins. - When both
XandX-mixinexist, the plain kit is the workload and the-mixinlayers that agent onto another workload. Use the mixin only when the user wants a different base. - A mixin's
requirescan under-declare what it needs from the workload:sbx/playwrightreportsrequires: []but its install step needs Node, so on the bareshellagent creation fails (env: 'node': No such file or directory). Only a disposablesbx env createproves a composition; say so when you hand over a file you could not create. - An entry is a bare reference or
{source, args}. Explicit relative paths (./…,../…,.,.., or ending in.zip) resolve against the declaring file's directory; a bareorg/kitis always a registry reference. Git sources usegit+https://orgit+ssh://; pin them for reproducibility with#ref=<commit>(plus&dir=<subdir>when needed). - A published (OCI) kit accepts only its create-phase args.
buildArgs(typicallyversion) were fixed at publish time — choose another tag instead.buildSecretsare build inputs, never runtime credentials. - Remote kit sources must match the
kit.allowedSourcessetting; Docker Hub is allowed by default. Setting it replaces the whole allowlist. --kit-arg/--kit-args-fileand--env-arg/--env-args-fileare experimental flags; mention that when you rely on them.
File resolution, merging, and user defaults
- From a directory,
sbx envreads exactlysbxenv.yaml. EachPATHargument is a directory (→<PATH>/sbxenv.yaml) or the file itself. - Several paths deep-merge in order,
docker compose -f-style: mappings merge by key, later scalars win, lists concatenate — exceptentrypointandcmd, which later files replace, andkitsentries naming the same source, which fold into one entry with theirargsmerged. Each file must be valid on its own; a later file cannot repair an invalid earlier value.sbx env run base.sbxenv.yaml local.sbxenv.yaml - With no
PATH,~/.sbxenv.yamlis merged underneath the project file; naming anyPATHskips it. It may not setname:, and itsworkspace:must be${{ env.projectDir }}or a subdirectory of it. ${{ env.projectDir }}(directory of the firstPATH, or cwd) and${{ env.fileDir }}(the declaring file's directory) plus${{ env.args.NAME }}are the only expansions. A bare$is literal, soPATH: $PATH:/opt/binreaches the sandbox unchanged;$${{ … }}escapes. References cannot appear in field names or inside theargs:block.
Naming and workspace
- Without
name:or--name, the sandbox is named<agent>-<workspace-basename>, so any two environments with the same agent and the same workspace directory name collide — even in different parent directories. Give each environment an explicitname:when that can happen. If you pass--name, pass the same value to everysbx envcommand for that environment. workspace:is the primary mount (read/write in bind mode); omitting it mounts nothing, so an agent would start without the project. The object form{path: ., clone: true}mounts the path read-only and runs the agent on a private clone (--clone/--clone=falseoverride it per invocation).additionalWorkspaces:require a primaryworkspace:.
Where the environment file lives (write protection)
- Prefer keeping
sbxenv.yamloutside every directory you mount — the primary workspace and eachadditionalWorkspacesentry — for example beside the project directory withworkspace: ./web-app. The file decides which lifecycle, secret, and MCP commands run on the host, so the agent must not be able to change it. - If it must live inside a mount, put it directly at the mount root.
sbxmounts env files read-only by default, but a file in a subdirectory can still be replaced: the sandbox renames the writable parent directory and recreates the path.sbx env plancalls this out; never claim the rename creates no gap. (One sbx v0.51.0 macOS test refused that rename — seechecks/runtime-results.md— but the plan and docs still treat the file as unprotected, so do not rely on it.) sandboxOptions.writableEnvFiles: truelets the sandbox write its own env files (local only). It is a deliberate security downgrade the plan reports; use it only when the agent is meant to change what future invocations run on the host.
args: — parameterizing a shared file
- Each argument needs exactly one of
defaultorrequired: true, plus optionaldescriptionand eitherenumorpattern(RE2, whole value). - Values come only from
--env-arg NAME=VALUEor--env-args-file FILE; the host environment is never read. An undeclared reference, missing required value, unknown supplied name, or failedenum/patternis an error. - An unquoted reference is re-read as YAML after substitution (
cpus: ${{ env.args.cpus }}becomes an integer); quote it to keep a string. - Use an environment arg for values callers vary (model, target repo, branch)
or one value that feeds several kits; pin a project decision directly in
the kit entry's
args:.
Secrets, registries, and bindings
secrets:andregistries:provision into the same credential store assbx secret set, at this sandbox's scope, sosbx env rmremoves them. Each source sets exactly one ofvalue/ref/command; seedocker-sandboxes-network-credentialsfor runtime semantics.- Secret
command:sources run on the host from a fresh temporary directory and run whenever the secret is needed, even with--skip-host-commands. Use absolute helper paths and keep helpers outside writable mounts. bindings:merge into the user's globalcredentials.yamland survivesbx env rmunless--prune-bindingsis passed — which deletes the whole global entry for each declared service, possibly affecting other sandboxes. Bind only the mechanism (apiKeyoroauth) the user will actually use.- A literal
value:appears only as asha256:digest in the plan and state, but the file itself still holds the plaintext. Useref:orcommand:; the plan shows where such a secret comes from, never its resolved value.# OPTIONAL fragment — add only if this environment needs the credential. secrets: anthropic: ref: op://Private/Anthropic/api-key # never a literal `value:` refresh: 55m
lifecycle: — host commands
- Commands run on the host, outside the sandbox, with your privileges,
through the user's shell, from the project directory unless
workdir:is set. Within a phase they run in order and stop at the first failure. They receiveSBX_LIFECYCLE_PHASE,SBX_ENV_FILE(S),SBX_ENV_DIR,SBX_SANDBOX_NAME,SBX_AGENT, andSBX_WORKSPACE, but not the file'senv:values or resolved secrets.initialize— before anything else, on everycreateandrun, including a run that attaches to an existing sandbox. It must be idempotent.postCreate— once, after a new sandbox is created and before attachment; not on reattach.preRemove— after removal is approved, before deletion. A failure is only a warning. Afterwardssbxrebuilds the destroy plan and stops if the commands introduced changes the approval did not cover.
lifecycle: initialize: - command: test -d app || git clone https://github.com/acme/app postCreate: - command: ./scripts/seed-fixtures.sh - Kits own what runs inside the sandbox; use
lifecycleonly for host-side preparation and teardown.
The plan and approval
sbx env plan [PATH...]prints what applying would change outside the sandbox — host commands, credentials, bindings, MCP registrations, directories, kits, ports, options, and variables — compared with what was last applied and approved. It changes, approves, and records nothing. It also does not resolve kit references: an invented kit or a missing tag plans cleanly.describeevery OCI reference at the exact tag you write before trusting a clean plan. Margin symbols:+add,~change,-destroy,>run a host command again,!stop tracking without deleting.create,run, andrmshow their plan and ask for approval. Interactive approval is recorded; a later plan with no host commands applies silently until something changes or a resource is missing.- Plans with lifecycle commands, credential command sources, or local MCP
commands are asked about on every invocation by default, even when
unchanged.
sbx settings set env.rememberHostCommands trueasks again only when the commands change — never enable it for commands you have not reviewed. -f/--forceapproves onecreate/runwithout recording consent (onrmit also deletes a sandbox in use). Use it for reviewed, trusted files in automation only — never for untrusted pull-request content, because the plan's host commands run with the runner's privileges.--skip-host-commandsskips lifecycle commands and disables the environment's local MCP commands until a laterenv runwithout it; credential command sources still run.- If
sbx env runreports a sandbox that "agrees with everything this environment declares" but "nothing was done", its environment state was lost. Rerunsbx env runinteractively with the same paths and name and confirm adoption only for the intended sandbox;--forcenever confirms adoption, so automation needs this done interactively first.
env exec and updating an existing environment
sbx env exec [PATH...] -- COMMANDruns no lifecycle commands for an existing sandbox. If the sandbox is missing, it offers to create it only in an interactive terminal (with the normal approval and lifecycle); with non-interactive stdin or--no-inputit fails (exit 125) — runsbx env createfirst.- On an existing sandbox,
sbx env runapplies changedenvvalues and reconciles MCP servers, andentrypoint/cmdtake effect on each run. Changes to workspaces, kits, kit host mounts, ports, secrets, bindings, andsandboxOptionsapply only on the next creation:sbx env rm, then create again.
mounts:, ports:, mcp:, entrypoint/cmd, and sandboxOptions:
These map onto kit host mounts, sbx ports --publish, MCP gateway
registrations, the agent launch argv, and sbx create options. Exact field
shapes, defaults, and what sbx env rm leaves behind for each are in
references/env-schema-fields.md.
Related skills
- For the
sbx create/run/rmflag-based workflow this file wraps, usedocker-sandboxes-lifecycle. - For what
secrets:/registries:/bindings:mean at runtime, and for network policy independent of any environment file, usedocker-sandboxes-network-credentials. - For authoring, building, publishing, or signing the v3 kit descriptor a
kits:entry references, usedocker-sandboxes-kits.
References
references/authoring-workflow.md— step-by-step create and update procedure, workspace-signal table, credential and host-grant handling, and the final checklist.references/env-schema-fields.md— every top-level field, its shape and defaults, with YAML examples.references/sources.md— provenance for the rules above.
Assets
assets/sbxenv.yaml— a complete, minimal, safe example: ashellagent mounting the declaring file's own directory, one static env var, and no credentials — it validates and plans without onboarding authentication. It sits at its mount root; for real projects prefer a file outside the mounts.
Scripts
scripts/kits.py— live Docker Hub kit search, descriptor summary, version-ordered update, and digest pinning forkits:entries. Run withpython3 -I; it only reads public registries.
Checks
checks/verification.md— verification runbook for the helper andsbx envbehavior (run manually with an isolated, uniquely named--app-namesigned in for the run, never with real secret values or untrusted lifecycle commands force-approved).checks/runtime-results.md— recorded results of that runbook on sbx v0.51.0 (macOS arm64), including what the plan does not check.
04 同仓库更多 Skills
zarr-python
Stores and queries chunked N-D scientific arrays with Zarr-Python 3, including codecs, sharding, S3/GCS storage, and NumPy/Dask/Xarray integration. Use for array layout, bounded I/O, format migration, or scientific metadata preservation.
yeet
Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.
xarray
N-dimensional labeled arrays and datasets in Python. Built on top of NumPy and Dask. It introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays, making data analysis in physical sciences more intuitive and less error-prone. Use for working with multi-dimensional scientific data, NetCDF/GRIB/Zarr files, climate/weather/oceanographic datasets, remote sensing, geospatial imaging, large out-of-memory datasets with Dask, and labeled array operations.
writing-mstest-tests
Use when asked to fix, rewrite, update, improve, modernize, show corrected code for, or explain existing MSTest tests or MSTest-specific configuration. Use for "review" when corrected code or edits are wanted, even for one pasted assertion or passing tests with bad failure output. Covers expected/actual labels; generic Boolean, collection, string, numeric, null, identity, exception, hard-cast, and object[] checks; TestContext/lifecycle; timeout/cancellation; OS/CI conditions, retry, cleanup, parallelization, MSTest.Sdk project setup, and MSTESTxxxx. Honor the installed MSTest version. DO NOT USE to design new test cases (code-testing), perform report-only audits, create project files rather than explain MSTest setup, run tests, migrate frameworks, or handle non-MSTest/non-.NET code.
wgs-prs
End-to-end WGS to polygenic risk score pipeline. Takes paired-end FASTQ files (or a pre-existing VCF) through nf-core/sarek for variant calling, applies VCF QC (normalisation, hard filtering, Ti/Tv and Het/Hom checks), then computes polygenic risk scores via the PGS Catalog. Fills the FASTQ to VCF gap upstream of the gwas-prs skill.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.