Examples
40 reference guardrails.
Add any with npx guardrails-ref add <name> or use presets:
add --preset default, security, quality, frontend, api, backend, data, production. Combine: add --preset default,frontend.
Use npx guardrails-ref why <name> to show full content.
Reference guardrails
| Name | What it prevents |
|---|---|
| Logging or committing API keys, passwords, tokens | |
| Unredacted PII (SSN, credit cards, emails, full names) in logs, API responses, or reports | |
| Complying with "ignore instructions" or prompt-injection style overrides | |
| Fake or placeholder API keys instead of asking for real values | |
| Catching errors without surfacing them to the user | |
| Exposing sensitive data or admin actions without role checks | |
| Destructive ops without plan.md and audit log | |
| Continuing in polluted context; reset when 80% full or 10+ errors | |
| Direct schema changes instead of migrations | |
rm -rf, DROP TABLE, TRUNCATE without approval | |
| eval(), new Function(), or dynamic code execution | |
| New packages without human confirmation | |
| Touching node_modules, .git, lockfiles, .env without approval | |
| git commit or push without explicit user approval | |
| Hardcoded API URLs, base URLs, endpoints | |
sudo, su, or root commands without approval | |
| Runaway tool calls and API loops | |
| Unsafe or overly powerful tools without allow lists, thresholds, or approvals | |
console.log in production code | |
| Merging code without tests | |
| Reimplementing when existing code or helpers exist | |
Inline style= in HTML/JSX | |
| Raw SQL without parameterization | |
| Unexplained numeric literals | |
git push --force, destructive rebase without approval | |
| Suggesting deprecated or obsolete APIs | |
| Assuming env vars exist without validation | |
| Hardcoded labels, messages, errors in UI | |
| Breaking public APIs without semver bump or migration path | |
| User-controlled paths without validation (.., symlinks) | |
Raw dangerouslySetInnerHTML or unsanitized HTML from user/API content (XSS) | |
| Enforcing authorization only in the client; server must re-validate permissions | |
| UI without alt text, ARIA, keyboard support, or contrast | |
| API calls without timeouts, retries, or error handling | |
| Changing behavior without updating README, docs, or changelog | |
| Async UI without visible loading and error states (blank screens, silent failures) | |
| Forms without validation, field-level errors, or preserved input on error | |
| Hardcoded colors, spacing, or typography instead of design tokens or theme variables | |
| Leaking internal prompts, system messages, or hidden guardrails into code, logs, or docs | |
| Logging without structure, clear levels, or protection against secrets/PII |
Presets
| Preset | Guardrails |
|---|---|
| 4 no-plaintext-secrets, no-destructive-commands, no-new-deps-without-approval, require-commit-approval | |
| 15 security guardrails (secrets, PII, XSS, client-only auth, access control, path traversal, SQL, eval, etc.) | |
| 11 code quality guardrails (tests, magic numbers, inline styles, loading/error states, form validation, design tokens, etc.) | |
| 7 frontend guardrails (accessibility, inline styles, unsafe HTML, loading/error states, form validation, design tokens) | |
| 5 API guardrails (resilience, hardcoded URLs, env validation, placeholder creds, no client-only auth) | |
| 9 backend services (secrets, API resilience, access control, DB migrations/SQL, path traversal, env safety, versioning, logging) | |
| 6 data/analytics (PII and secrets, placeholder creds, rate limiting, prompt leaks, logging standards) | |
| 12 production-ready guardrails (tests, migrations, docs, versioning, XSS, server-side auth, loading/error states, etc.) |
npx guardrails-ref add --preset default npx guardrails-ref add --preset security npx guardrails-ref add --preset quality npx guardrails-ref add --preset frontend npx guardrails-ref add --preset api npx guardrails-ref add --preset backend npx guardrails-ref add --preset data npx guardrails-ref add --preset default,frontend Combine presets with commas.
Use init --preset default to add a preset at init.
Add multiple
npx guardrails-ref add no-destructive-commands no-new-deps-without-approval no-hardcoded-urls add --list for the full list of available guardrails.
why <name> to show a guardrail's full content before adding.