writing-skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
dockerManage Docker containers, images, volumes, and Compose stacks via the `docker` CLI — list, inspect, logs, run, build, stop, remove, compose up/down. Use for local container ops.
Independent GitHub snapshot · Automated classification · Original documentation governs
name: docker
description: Manage Docker containers, images, volumes, and Compose stacks via the docker CLI — list, inspect, logs, run, build, stop, remove, compose up/down. Use for local container ops.
version: 1.0.1
requires_tools:
Drive local containers with the docker CLI. Reads
(ps, images, logs, inspect) are safe to run directly; writes
(run, build, stop, rm, rmi, prune, compose down) mutate state and
surface the runtime approval gate — confirm intent with the user first.
Verify with one solo step:
[{ "tool": "os.shell.run", "args": { "cmd": "docker", "args": ["version", "--format", "{{.Server.Version}}"] } }]
Outcome map:
exit 0 + version → daemon reachable, proceed.command not found: docker → enter Setup playbook → "docker missing".Cannot connect to the Docker daemon → enter Setup playbook → "daemon not running".OFFER help; do not dump docs on the user.
Reply (solo reply step):
"Docker is not installed. On macOS, install Docker Desktop (https://docker.com/products/docker-desktop) or run
brew install --cask docker, then launch the app. Tell me when it is running and I will re-check."
Do NOT attempt to install Docker Desktop silently — it needs a GUI launch and privileged setup.
"Docker is installed, but the daemon is not running. Open Docker Desktop (or run
systemctl start dockeron Linux), then tell me when it is up."
Do not try to start the daemon via os.shell.run on macOS — it requires the
Desktop app.
os.fs.* tools, then docker build.kubectl skill.All examples invoke os.shell.run with cmd: "docker". Reads are listed first.
| Goal | args |
|---|---|
| Running containers | ["ps"] |
| All containers | ["ps", "-a"] |
| List images | ["images"] |
| Container logs (last 100) | ["logs", "--tail", "100", "<name>"] |
| Inspect | ["inspect", "<name>"] |
| Resource stats (one shot) | ["stats", "--no-stream"] |
| Compose status | ["compose", "ps"] |
| Goal | args |
|---|---|
| Run detached | ["run", "-d", "--name", "web", "-p", "8080:80", "nginx"] |
| Build image | ["build", "-t", "myapp:dev", "."] |
| Stop container | ["stop", "<name>"] |
| Remove container | ["rm", "<name>"] |
| Remove image | ["rmi", "myapp:dev"] |
| Exec a command | ["exec", "<name>", "sh", "-c", "echo hi"] |
| Compose up | ["compose", "up", "-d"] |
| Compose down | ["compose", "down"] |
Applies only when a host directory is bind-mounted into a container
(-v "$PWD:/app", or a Compose volumes: entry). Skip this section entirely
for native, non-container work — a plain host-side python -m venv is fine and
needs no warning.
A virtual environment records absolute paths to the interpreter that built
it. A .venv created inside a container stores container paths, so it stops
working the moment it is used from the host — and the reverse is equally true.
Because the directory lives in the mounted project folder, it outlives the
container and looks like an ordinary project artifact. It is not one.
Other build output written into the mount is unusable across runtimes for a
related but distinct reason — platform and ABI mismatch rather than baked-in
paths: node_modules containing compiled native addons, and Go or Rust build
caches. .tox and .nox hit both, since they contain real virtual
environments. Treat all of them as runtime-specific.
This is normal Python behaviour, not a fault in the project or the container.
Create the environment inside a container against a bind mount:
[{ "tool": "os.shell.run", "args": { "cmd": "docker", "args": ["run", "--rm", "-v", "/Users/me/proj:/app", "-w", "/app", "python:3.12", "python", "-m", "venv", ".venv"] } }]
Inside the container the environment resolves correctly:
/app/.venv/bin/python3.12 -> /usr/local/bin/python3.12 # exists in the image
/app/.venv/bin/python3 -> python3.12 # relative
/app/.venv/bin/python -> python3.12 # relative
Note which link is absolute: the versioned name. python and python3 are
relative links pointing at it, so inspecting bin/python3 alone shows a bare
python3.12 and reveals nothing. The interpreter path is baked in twice — in
that versioned symlink, and in the home key of pyvenv.cfg. Back on the host
neither target exists, so the very same .venv is dead:
$ .venv/bin/python --version
.venv/bin/python: No such file or directory
$ grep '^home' .venv/pyvenv.cfg
home = /usr/local/bin # a container path
Recreate it on the host with the host interpreter — into a separate directory, so the two never overwrite each other:
[{ "tool": "os.shell.run", "args": { "cmd": "python3", "args": ["-m", "venv", ".venv-host"] } }]
Then install into whichever environment matches the runtime you are about to
use. Do not attempt to "repair" a foreign .venv; recreating is faster and
reliable.
.venv can be activated on the host, or the
other way round. Recreate it per runtime instead./opt/venv and put /opt/venv/bin first on PATH.
Nothing interpreter-bound is then written into the user's project folder, so
the problem cannot arise at all. Fall back to distinct in-project paths
(.venv in the container vs .venv-host on the host) only when the
environment must live inside the mount..venv/ (and any host-side variant) to
.gitignore. Do not edit .gitignore, or any other ignore file, unless
the user explicitly asks — recommend, then wait..venv after container work, read
.venv/pyvenv.cfg and check whether its home = directory exists on the
host. If it does not, this is the cause. Compare the directory itself rather
than matching a literal path: /usr/local/bin is what the official python
images use, but other images (Alpine, deadsnakes, uv) differ.Whenever you install dependencies or run tests as part of container work, the
final report must name the runtime the commands actually ran in — container
or host — and say which environment was used. "Tests pass" is ambiguous and
misleading here; "Tests pass in the python:3.12 container against
/app/.venv; the host environment was not created" is not.
Never present a container-only verification as evidence the project works on the host.
docker system prune -a or volume rm without explicit,
unambiguous user confirmation — they delete data irreversibly.--format / --json output for parsing; summarise only what matters..venv (or other
interpreter-bound directory) created in one runtime as usable in the other —
see Bind-mounted projects above. Name the runtime that installs ran in
whenever you report results.