Skip to content

LlamaGuard Content Moderation

Screen user prompts and AI responses for unsafe content using Meta's LlamaGuard classifier

Stars
14,195
Licence
MIT
Files
1 file

What it does

This skill teaches an agent how to set up Meta's LlamaGuard, a 7-8 billion parameter model trained to label text as safe or unsafe. Once installed, the agent can write code that checks what a user types, or what an AI model replies, against six safety categories such as violence, sexual content, weapons, substances, self-harm and criminal planning. It also shows how to serve the classifier through vLLM, a FastAPI endpoint, or NeMo Guardrails.

Great for

  • Developers building chatbots or LLM apps who need an input or output safety filter
  • Teams wanting a self-hosted moderation model instead of sending text to a third-party API
  • Engineers integrating moderation into NeMo Guardrails pipelines

Skip it if

  • Non-developers looking for a ready-made moderation tool: the skill produces code, and running the model needs a GPU and setup work
  • Projects needing guaranteed safety: the file itself cites 94-95% accuracy, so some unsafe content will be missed and some safe content wrongly blocked
  • Use cases needing a commercial-license guarantee for the model weights, since access requires accepting Meta's license terms on Hugging Face

Try asking

  • “Write a Python function that checks user messages with LlamaGuard before they reach my LLM”
  • “Set up a FastAPI /moderate endpoint using vLLM and LlamaGuard”
  • “Show me how to add LlamaGuard input and output rails to my NeMo Guardrails config”
  • “Batch-moderate a list of chat transcripts with LlamaGuard using vLLM”
Step-by-step guide: how to use LlamaGuard Content ModerationInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    llamaguard.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip llamaguard.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip llamaguard.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Verify the exact model ID and label format (for example 'unsafe' followed by a category code) against the current Hugging Face model card, since the examples are illustrative and some snippets reference undefined variables like tokenizer or llm.
  • Test the classifier on your own sample data before relying on it, and combine it with other safeguards rather than treating it as the only filter.
  • Keep the Hugging Face token out of source code and use environment variables or a secrets manager.

What's inside

  • SKILL.md

Redistributed unmodified from Orchestra-Research/AI-Research-SKILLs under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.