← ClaudeAtlas

docker-volume-guardrailslisted

Set up a Claude Code hook to unconditionally block Docker commands that permanently delete a volume (docker volume rm/prune, docker rm -v, docker system prune --volumes, docker compose down -v). Use when setting up guardrails against destructive volume deletion, or after "never delete volumes without confirmation" has been violated or nearly violated.
wakqasahmed/ai-engineering-workflow-skills · ★ 2 · AI & Automation · score 68
Install: claude install-skill wakqasahmed/ai-engineering-workflow-skills
# Docker Volume Guardrails Sets up a PreToolUse hook that unconditionally blocks any Docker command that permanently deletes one or more volumes. ## Why unconditional, with no override This repo's own global instructions already say: "never delete volumes without explicit human confirmation." A hook only ever sees the raw command string handed to it - it has no way to observe whether a human actually confirmed *this specific* deletion earlier in the conversation. The only mechanical enforcement that is actually faithful to that rule is to never let the agent run this class of command at all - exactly matching `git-guardrails-claude-code`'s own precedent for force-push and `reset --hard`. If a human has genuinely decided to delete a volume, they run that command themselves, outside the agent. Companion to `docker-db-guardrails`, which handles a different class of mistake (a schema/data-wipe command run against the wrong database because its real target was never resolved and verified). This skill's class of mistake needs no such resolution step - volume deletion is destructive regardless of which volume it targets, so the rule is simply "never," full stop. ## What Gets Blocked - `docker volume rm` / `docker volume remove` - `docker volume prune` - `docker rm -v` / `docker rm --volumes` (removes anonymous volumes attached to a container) - `docker system prune --volumes` (with or without `-a`) - `docker compose ... down -v` / `--volumes`, and the legacy `docker-compose