---
name: "guardrails-ai-input-output-validators"
description: "Enforce runtime safety, PII redaction, and semantic constraints with Guardrails AI."
metadata:
  author: "Guardrails AI"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "add guardrails to llm"
  - "redact pii with guardrails"
  - "validate output with guardrails ai"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Guardrails AI Input/Output Rail Validators

Integrates Guardrails AI (guardrails-ai): defining .rail specifications, PII redaction (DetectPII), toxic language filters, regex validation, and automated re-asking on failed validations.

## When to Invoke
Invoke this skill whenever you need to:
- add guardrails to llm
- redact pii with guardrails
- validate output with guardrails ai

## Execution SOP & Rules
1. Initialize Guard objects with pre-built or custom validators: Guard().use(ToxicLanguage()).
2. Wrap LLM calls with guard(client.chat.completions.create, prompt=...) for automated interception.
3. Configure on_fail='reask' to allow automatic model correction on rule violation.
4. Log validation failures to compliance monitoring systems for audit reporting.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
