Production Guardrails
PreToolUse hook that makes Claude ask before destructive kubectl, helm and terraform commands against production.
hook PreToolUseMITCódigo-fonte
Instalar
/plugin install prod-guardrails@pieroazambujaAinda não adicionou o marketplace? Rode antes /plugin marketplace add piazambuja/piazambuja.github.io.
Este plugin é um hook do Claude Code e não tem versão para o Codex.
Este plugin é um hook do Claude Code e não tem versão para o Gemini CLI.
Este plugin é um hook do Claude Code e não tem versão para o Copilot.
Este plugin é um hook do Claude Code e não tem versão para o Cursor.
Este plugin é um hook do Claude Code e não tem versão para o Kiro.
Como funciona
A PreToolUse hook that makes Claude Code ask for your approval before it runs a destructive infrastructure command that may hit production.
What it catches
| Tool | Commands |
|---|---|
| kubectl | delete, drain, cordon, patch, replace --force, scale --replicas=0, rollout undo/restart |
| helm | uninstall, delete, rollback |
| terraform | destroy (always asks), apply -auto-approve |
| aws cli | delete-*, remove-*, terminate-instances |
How it decides it's production
- An explicit
--context/--kube-contextflag in the command. - Otherwise the current
kubectlcontext, theterraform workspace, orAWS_PROFILE. - Matched against
prod|prd|production|live(case-insensitive).
Settings
| Variable | Effect | |
|---|---|---|
CLAUDE_PROD_PATTERN | Your own regex for production names, e.g. `acme-prd | -prod-` |
CLAUDE_GUARD_ALL=1 | Ask for every destructive command, in any environment |
Requires python3 on the machine running Claude Code. It never blocks on its own: it only turns the call into an approval prompt.