Marketplace

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@pieroazambuja

Ainda não adicionou o marketplace? Rode antes /plugin marketplace add piazambuja/piazambuja.github.io.

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

ToolCommands
kubectldelete, drain, cordon, patch, replace --force, scale --replicas=0, rollout undo/restart
helmuninstall, delete, rollback
terraformdestroy (always asks), apply -auto-approve
aws clidelete-*, remove-*, terminate-instances

How it decides it's production

  1. An explicit --context / --kube-context flag in the command.
  2. Otherwise the current kubectl context, the terraform workspace, or AWS_PROFILE.
  3. Matched against prod|prd|production|live (case-insensitive).

Settings

VariableEffect
CLAUDE_PROD_PATTERNYour own regex for production names, e.g. `acme-prd-prod-`
CLAUDE_GUARD_ALL=1Ask 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.