Documentation

Quick start

npx guardrails-ref init

Creates .agents/guardrails/, adds no-plaintext-secrets,
configures Cursor, Claude Code, VS Code Copilot, Windsurf, Continue, and JetBrains.

Use init --preset default to add the default preset (4 guardrails) instead of one. Use init --user for ~/.agents/guardrails/ (user-level).

Run npx guardrails-ref setup so the AI reads your guardrails. Required until IDEs add native support.

Add more

npx guardrails-ref add no-destructive-commands

Or add a preset: add --preset default, security, quality, frontend, api, or production. Combine with commas: add --preset default,frontend.

30 reference guardrails with descriptions and add commands.

Run npx guardrails-ref add --list to list available guardrails.

Commands

CommandDescription
initCreate dir, add example, run setup
init --preset defaultAdd preset instead of single example
init --minimalCreate .agents/guardrails/ only (no example, no setup)
add <name>Add guardrail(s)
add --dry-runPreview what would be added without writing
add --preset defaultAdd default preset (4 guardrails)
add --preset default,frontendAdd multiple presets (comma-separated)
add --preset securityAdd security preset (9 guardrails)
add --preset qualityAdd quality preset (8 guardrails)
add --preset frontendAdd frontend preset (3 guardrails)
add --preset apiAdd API preset (4 guardrails)
add --preset productionAdd production preset (6 guardrails)
remove <name>Remove guardrail
setupAdd rule to Cursor, Claude Code, Copilot, Windsurf, Continue, JetBrains
setup --removeUndo setup
setup --pre-commitAdd guardrails check to pre-commit (Husky or pre-commit)
setup --ide <name>Target IDE: cursor, claude, copilot, windsurf, continue, jetbrains, junie, or auto
setup --dry-runPreview what would be added/removed
setup --checkShow which IDEs are configured
setup --check --fail-if-missingExit 1 if configured IDE lacks rule (CI)
validateValidate files
validate --fixApply fixes (whitespace, newline, frontmatter key order)
validate --userValidate user-level guardrails
validate --jsonJSON output for scripting
validate --strictFail on warnings (CI)
checkMinimal CI output
upgradeUpdate to latest templates
upgrade --userUpgrade user-level guardrails
upgrade --dry-runPreview changes
diffShow diff between installed and templates
listList guardrails
list --userList user-level guardrails
list --jsonJSON output for scripting
list --compactOne name per line (for piping)
why <name>Show guardrail template content
why <name> --jsonJSON output (name, description, body)

Scripting & CI

For pipelines and tooling:

npx guardrails-ref add --dry-run no-destructive-commands

Preview what would be added without writing files.

npx guardrails-ref list . --compact | xargs -I {} npx guardrails-ref why {}

One name per line for piping. Combine with why to inspect each.

npx guardrails-ref why no-plaintext-secrets --json

Machine-readable output (name, description, body) for tooling.

npx guardrails-ref setup --check --fail-if-missing

Exit 1 if configured IDE lacks the guardrail rule (CI enforcement).

More

README · Examples · Pre-commit · npm