guardrails

Quality gates for Claude Code.
Format every edit. Gate every turn.

› /plugin marketplace add rossedman/guardrails
› /plugin install guardrails@guardrails
claude — ~/code/api
› Add a Drain method to the queue
Edit internal/sched/queue.go
PostToolUse ✓ gofumpt · goimports · golangci-lint 0.9s
Stop ✗ go gate failed (1 of 6 checks)
[coverage] 84.2% < 90.0%
queue.go:41 (*Queue).Drain 0/14 stmts
Claude Adding table-driven tests for Drain…
Edit internal/sched/queue_test.go
Stop ✓ go gate passed (6 checks) · cov 92.6%
›
  • 90%coverage on touched code
  • 90%of changed lines covered
  • ~2sfix and check per edit
  • 0tools to install

The loop

Every edit fixed.
Every turn gated.

Guardrails is one Go binary wired into Claude Code's hooks. A fast inner loop on every edit, and a hard gate before Claude can call the work done.

  1. SessionStart

    Brief

    Claude learns the standards for the languages this repo uses before it writes a line.

    standards
  2. PreToolUse

    Guard

    Suppressions, skipped tests, lowered thresholds and risky commands are stopped before they run.

    deny · ask
  3. PostToolUse

    Fix

    Every edited file is formatted in place, then linted and type-checked.

    < 2s
  4. Stop

    Gate

    Touched code must build, pass tests, hold coverage and pass every linter before the turn ends.

    block · pass

What Claude sees

One report.
Exactly where to look.

Failures name the file, the function and the fix. Claude keeps working until the gate passes, and after three blocks in a row hands the turn back to you with a summary.

  • block the gate failed, keep working
  • deny an edit that weakens the standards
  • ask irreversible infrastructure actions
  • pass the turn ends
The feedback format
Stop hook
guardrails: go gate failed (2 of 6 checks)

[coverage] 84.2% < 90.0%
  internal/sched/queue.go:41  (*Queue).Drain  0/14
  internal/api/handler.go:88  decodeRequest   3/11
  fix: add table-driven tests

[lint] 1 issue
  internal/api/handler.go:102:5  errcheck
  fix: suppression comments are not allowed

attempt 1 of 3 · guardrails gate --explain

Quick start

Install it.
Pick a bar. Work.

The plugin downloads its own binary and every linter and scanner it runs, pinned and checksum-verified, the first time they're needed. Nothing else to install. macOS and Linux, amd64 and arm64.

Full getting-started guide
  1. Add the plugin in Claude Code

    › /plugin marketplace add rossedman/guardrails
    › /plugin install guardrails@guardrails
  2. It tells you it's on

    Your next session opens with one line: the languages it found and the bar Claude is held to. No config needed.

  3. Pick the bar for this repo

    Claude measures the code and recommends a preset: strict for new code, standard, or adopt for existing repos (coverage never drops; new code is tested).

    › /guardrails:setup
  4. Work as usual

    Edits are fixed, risky moves stopped, and every turn gated. When you want more:

    › /guardrails:status   # what's on, what's next
    › /guardrails:gate     # check before you commit
    › /guardrails:harden   # do the tests test?
    › /guardrails:learn    # mistakes into rules

Languages

Six languages.
One gate.

Each language module fixes on edit, checks in about two seconds, and adds its own checks to the Stop gate. Modules switch on when the repo uses the language.

Commands

The same gate,
from your terminal.

Everything the hooks and skills do, you can run yourself, in CI or a pre-commit hook. Every command has --help with examples.

Daily

status
What's on, the last gate, and what to do next
gate
Run the full gate on changed files, or --all
gate --staged
Gate what's staged, for pre-commit
harden
Mutation-test and fuzz the Go you changed
learn
Gate history and your corrections, as rules to teach

Setup

init --preset
Write .guardrails.yaml and Claude rules
doctor
Check config, runtimes and tools
tools install
Download pinned tools up front
config
Print the effective configuration
schema
The config's JSON Schema, for editors

Claude Code

hook <event>
Handle a hook event from stdin
statusline
Gate status for Claude Code's status line
completion
Shell completion for bash, zsh and fish
version
Version, commit and build date

Full CLI reference

Let Claude ship work
you'd merge.

Free and open source under the MIT license.