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 -a and
WHERE-less SQL before the Bash call executes, record the session-start commit, snapshot work
state before context compaction and feed it back in right after, 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-review runs 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.
- Skill —
browser-mcp: how to drive chrome-devtools-mcp cheaply and safely (which server for
what, token-cheap check order, screenshot/emulate pitfalls, secrets, logged-in apps).
- Output style —
terse.md: result first, no padding.
- Fleet sync — push commands/skills/styles to your servers over SSH, audit drift with
--check.
Quick start (fresh Mac)
You need Claude Code ≥ 2.1, installed and logged in. Homebrew is optional.
- Command-line tools. Install them if
git --version asks for them: xcode-select --install.
They provide git and python3.
- The plugin. In Claude Code, run the two commands below, then restart Claude Code:
/plugin marketplace add tillmeier/claude-code-guardrails
/plugin install guardrails@tillmeier
- Hooks are active right away.
- Commands and the skill are namespaced:
/guardrails:plan, /guardrails:critical-review,
guardrails:browser-mcp, ….
- Check what works here.
/guardrails:setup-check prints ✓/✗ per part, with the exact fix for
each gap. It installs nothing. Each ✓ says what it rests on, e.g. "login not checked" or
"browser launch not tested". It also flags hooks that run twice because your settings.json
registers them as well.
- Optional browser servers, for the
browser-mcp skill and /verify --ui. They need Node
(^20.19, ^22.12 or ≥ 23; brew install node) and Google Chrome:
# isolated: temp profile, logged out — measuring and public pages
claude mcp add -s user chrome-devtools -- npx -y [email protected] --isolated --screenshotMaxWidth 1280 --screenshotMaxHeight 2000
# optional, attached to your running Chrome (144+) with its logins. Needs remote debugging enabled
# at chrome://inspect/#remote-debugging; while that is on, any local process can attach.
claude mcp add -s user chrome-live -- npx -y [email protected] --autoConnect --redactNetworkHeaders --screenshotMaxWidth 1280 --screenshotMaxHeight 2000
Skip the second server if you don't want an agent acting with your logins.
- Optional extras:
/output-style Terse.
- A reviewer for
/critical-review and /plan --codex: the Codex CLI
(npm i -g @openai/codex && codex login) or the Claude Code CLI.
- Restart, then run
/guardrails:setup-check again.
If the same Mac also carries a hand-installed copy of these files (or a private config they came
from), pick one. Step 3 shows hooks that would run twice.
By hand
For 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/
mkdir -p ~/.claude/skills && cp -R ~/claude-code-guardrails/skills/browser-mcp ~/.claude/skills/
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: