guard
Denies merges, closes, secret reads, container teardown and shell rewrites of tracked files until you give the go.
Install
/plugin install guard --marketplace rezk2ll/skills What it does
Denies actions that should wait for your explicit go: merging or closing PRs and issues, posting GitLab notes, reading secret files, printing Kubernetes secrets and tearing down Docker containers. It also stops two habits that hide mistakes: rewriting git tracked files through the shell, and committing behind a check whose exit code a pipe swallowed.
When to use it
- You run Claude with broad permissions and want a short list of actions that always come back to you.
- You keep
.env,*.pemorsecrets.yamlfiles in your projects and do not want their values in a transcript. - You test against local containers and do not want them torn down under you.
- You want to see every file change as a diff, not as a
sed -i.
How it works
Bash: each rule matches the command. Text inside heredocs and quoted--bodyor-mvalues is ignored, so a PR body that mentionsdocker compose downpasses.Read: denies reading.env,.env.*(except.example,.sample,.template,.dist),*secret*.yaml,*.pemandid_rsaorid_ed25519files.- GitHub MCP tools: merging a PR or closing an issue or PR asks you first.
- Every denial says which token to append if you really want the action.
Overrides
Append the token to the command, only after you said yes:
# merge-go:gh pr merge|close,gh issue close,glab mr merge|close,glab issue close.# gh-go:glab mr|issue noteandglab apiPOST, PUT or DELETE on notes.# teardown-go:dockerordocker composedown,stop,kill,rm,prune.# secret-go: printing a secret file (cat,grep,jqand similar),kubectl get secret -o yaml|json,kubectl execrunningenvorprintenv.# shell-edit:sed -i,perl -i,>,>>,teeorcponto a git tracked file, and scripts that write one.# pipe-commit:git commitorgit pushchained after a test, lint or build piped throughgrep,tailorhead.
Secret reads through the Read tool have no override. Ask for the one value you need.
Requirements
python3andgit.
Source
{
"hooks": {
"PreToolUse": [
{
"hooks": [
{
"type": "command",
"command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/guard.py",
"timeout": 10
}
],
"matcher": "Bash|Read|mcp__.*github.*"
}
]
}
}