Claude Code Guardrails
Incident-derived guardrail hooks and a plan→implement→verify→crosscheck delivery loop for Claude Code. Hook cost measured; 35 bats tests.
Install: /plugin marketplace add tillmeier/claude-code-guardrails
Works with Claude Code · 41 GitHub stars
Install
/plugin marketplace add tillmeier/claude-code-guardrailsInstall command taken from the project's README or registry entry. Always review code before running it.
README excerpt
Read full README on GitHub →claude-code-guardrails
Hooks, commands and an output style I use with Claude Code, extracted from my private config.
- Hooks — run outside the model's judgment: block bulk
git add/git commit -aand WHERE-less SQL before the Bash call executes, record the session-start commit, snapshot work state before context compaction, run the project's own formatter after edits. - Commands — a delivery loop (
/plan→/implement→/verify→/critical-review→/crosscheck) and doc-maintenance commands (/save-learnings-to-docs,/cleanup-docs,/refactor-claude-md,/init-local-md). - Reviewer backend —
/critical-reviewruns an independent, read-only reviewer on the diff (Codex CLI, Claude Code CLI, or your own command) through one adapter script, and never shows it the task brief. - Output style —
terse.md: result first, no padding. - Fleet sync — push commands/skills/styles to your servers over SSH, audit drift with
--check.
Install
As a plugin (Claude Code ≥ 2.1):
/plugin marketplace add tillmeier/claude-code-guardrails
/plugin install guardrails@tillmeier
Restart Claude Code. Hooks are active immediately; commands are namespaced
(/guardrails:plan, /guardrails:verify, /guardrails:critical-review, …); the output style is
selectable with /output-style Terse.
By hand (bare /plan, /verify, … and control over which hooks run):
git clone https://github.com/tillmeier/claude-code-guardrails ~/claude-code-guardrails
cp ~/claude-code-guardrails/commands/*.md ~/.claude/commands/
cp ~/claude-code-guardrails/output-styles/*.md ~/.claude/output-styles/
then wire the hooks you want into ~/.claude/settings.json. /critical-review looks for its backend
script at ~/claude-code-guardrails/scripts/review-backend.sh; for a checkout elsewhere, export
REVIEW_BACKEND=<checkout>/scripts/review-backend.sh. Wire the hooks:
"hooks": {
"SessionStart": [{"hooks": [{"type": "command", "command": "bash \"$HOME/claude-code-guardrails/hooks/session-start.sh\""}]}],
"PreToolUse": [{"matcher": "Bash", "hooks": [
{"type": "command", "command": "bash \"$HOME/claude-code-guardrails/hooks/sql-guard.sh\"", "timeout": 10},
{"type": "command", "command": "bash \"$HOME/claude-code-guardrails/hooks/git-staging-guard.sh\"", "timeout": 10}
]}],
"PostToolUse": [{"matcher": "Edit|Write|MultiEdit", "hooks": [{"type": "command", "command": "bash \"$HOME/claude-code-guardrails/hooks/format-file.sh\""}]}],
"PreCompact": [{"hooks": [{"type": "command", "command": "bash \"$HOME/claude-code-guardrails/hooks/precompact-handoff.sh\""}]}]
}
Requirements: bash ≥ 3.2, git, python3. /critical-review needs one reviewer: the
Codex CLI (logged in), the Claude Code CLI, or a command of your
own (see Reviewer backend). Tests need
bats-core; the fleet sync needs ssh + rsync.
Hooks
Similar plugs
Multi-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, Google Antigravity, and Pi
The Developer Tool for Visual Engineers • An Open-Source AI-First Design tool • Visually build, style, and edit your code with AI • World's best, top-most agent recommended #1…
A powerful GUI app and Toolkit for Claude Code - Create custom agents, manage interactive Claude Code sessions, run secure background agents, and more.