implementing-llm-guardrails-for-security

implementing-llm-guardrails-for-security is a skill for Claude Code, Codex from adriannoes/awesome-agentic-ai. It costs 143 tokens per session (2,067 once invoked), scanned A, a copy of implementing-llm-guardrails-for-security, MIT.

A set of checks around an application that uses a large language model, such as a chatbot or AI agent. The checks validate incoming prompts and outgoing responses for risks such as prompt injection, personal-data leaks, unsafe content, and invalid formats.

In plain words
What is it for?
Use it to detect or redact personally identifying information, restrict allowed topics, check response formats, and reduce unsafe or manipulated model output in Python-based AI applications.
Why use it?
Language models can follow hostile instructions in user input or retrieved documents and can produce answers that do not meet application rules. Guardrails add a validation layer, but do not replace authentication, permissions, or network security.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to detect or redact personally identifying information, restrict allowed topics, check response formats, and reduce unsafe or manipulated model output in Python-based AI applications.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add adriannoes/awesome-agentic-ai --skill implementing-llm-guardrails-for-security
Clone the repo
git clone --depth 1 https://github.com/adriannoes/awesome-agentic-ai

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for implementing-llm-guardrails-for-security

README.md
[![agentmods](https://agentmods.dev/badge/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security/github.svg)](https://agentmods.dev/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security)
Your own site
<a href="https://agentmods.dev/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security"><img src="https://agentmods.dev/badge/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for implementing-llm-guardrails-for-security

Your own site · 80×15
<a href="https://agentmods.dev/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security"><img src="https://agentmods.dev/badge/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 143 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,067 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 92% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00143 $0.02067
Opus 5 $0.00072 $0.01033
Sonnet 5 $0.00029 $0.00413
Haiku 4.5 $0.00014 $0.00207

Measured 8d ago against content hash 1cf02a88ea56, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

implementing-llm-guardrails-for-security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/agent.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

92% identical to implementing-llm-guardrails-for-security — 49 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

cursor-claude-codex/skills/anthropic-cybersecurity-skills/skills/implementing-llm-guardrails-for-security/SKILL.md · 236 lines

How it starts

The opening of the file, as written. The whole thing — 236 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Implementing LLM Guardrails for Security

When to Use

  • Deploying a new LLM-powered application that processes user input and needs input/output safety controls
  • Adding content policy enforcement to an existing chatbot or AI agent to comply with organizational policies
  • Implementing PII detection and redaction in LLM pipelines handling sensitive customer data
  • Building topic-restricted AI assistants that must refuse off-topic or disallowed queries
  • Validating that LLM responses conform to expected schemas before they reach downstream systems or users
  • Protecting RAG pipelines from indirect prompt injection in retrieved documents

Do not use as a replacement for proper authentication, authorization, and network security controls. Guardrails are a defense-in-depth layer, not a perimeter defense. Not suitable for real-time content moderation of user-to-user communication without LLM involvement.

Prerequisites

  • Python 3.10+ with pip for installing guardrail dependencies
  • An OpenAI API key or local LLM endpoint for NeMo Guardrails self-check rails (set as OPENAI_API_KEY environment variable)
  • The nemoguardrails package for Colang-based guardrail definitions
  • The guardrails-ai package for structured output validation (optional, for JSON schema enforcement)
  • Familiarity with YAML configuration and basic Colang 2.0 syntax for defining rail flows

Workflow

Step 1: Install Guardrail Frameworks

Install the required Python packages:

# Core NeMo Guardrails library
pip install nemoguardrails

# Guardrails AI for structured output validation (optional)
pip install guardrails-ai

# Additional dependencies for PII detection and content analysis
pip install presidio-analyzer presidio-anonymizer spacy
python -m spacy download en_core_web_lg

Step 2: Run the Guardrails Security Agent

The agent implements a complete input/output validation pipeline:

# Analyze a single input through all guardrail layers
python agent.py --input "Tell me how to hack into a system"

# Analyze input with a custom content policy file
python agent.py --input "Some text" --policy policy.json

# Scan a file of prompts through the guardrail pipeline
python agent.py --file prompts.txt --mode full

# Input-only validation (no LLM call, just check if input is safe)
python agent.py --input "Some text" --mode input-only

# Output validation mode (validate a pre-generated LLM response)
python agent.py --input "User question" --response "LLM response to validate" --mode output-only

# PII detection and redaction mode
python agent.py --input "My SSN is 123-45-6789 and email [email protected]" --mode pii

# JSON output for pipeline integration
python agent.py --file prompts.txt --output json

Read the full file on GitHub · 236 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 236 lines · 143 tokens per session scan A 1cf02a88ea56

Subscribe to this mod's changes

implementing-llm-guardrails-for-security is a skill published in the GitHub repository adriannoes/awesome-agentic-ai (57 stars, last pushed 14d ago), licensed MIT. It adds 143 tokens to every session and 2,067 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. It is 92% identical to implementing-llm-guardrails-for-security, differing in 49 lines, and is treated as a copy.

Related

Other skills, from other repositories

implementing-llm-guardrails-for-security

Implements input and output validation guardrails for LLM-powered applications to prevent prompt injection, data leakage, toxic content generation, and hallucinated outputs. Builds a security validation pipeline using NVIDIA NeMo Guardrails Colang definitions, custom Python validators for PII detection and content…

xalgorix/xalgorix · 143 tokens

cost-aware-llm-pipeline

A planning guide for choosing language models and managing the amount of conversation context used by an AI coding workflow. It groups tasks by complexity and gives rules for avoiding context overflow during long sessions.

hashgraph-online/awesome-codex-plugins · 42 tokens

prompt-engineering

Use when one prompt must give the same right answer across reruns, models, and pasted-in hostile input: forcing a fixed schema, picking the few-shot set, ordering the prompt blocks, or the inline cases you run while tuning. NOT the agent loop, tools, or retrieval (that is building-agents), NOT a standing CI eval…

ericrisco/rsc-harness · 83 tokens

happyhorse-prompt-studio

Interactive prompt studio for HappyHorse 1.0 video generation. Guides users through scenario discovery with vivid examples, then assembles production-ready prompts in JP/CN/EN. Use when someone wants to create AI video content with HappyHorse but doesn't know where to start, or when they have a specific scenario and…

modelstudioai/skills · 93 tokens

ai-orchestration-langchain

LangChain.js patterns for building LLM applications — chat models, LCEL chains, prompt templates, structured output, agents, tools, RAG, streaming, and LangSmith tracing.

agents-inc/skills · 43 tokens

ai-observability-promptfoo

Testing and evaluation framework for LLM prompts and applications -- promptfooconfig.yaml, assertions, model-graded evals, red teaming, CI/CD integration, custom providers, and comparative evaluation.

agents-inc/skills · 46 tokens