guardrails-safety-filter-builder

guardrails-safety-filter-builder is a skill for Claude Code, Codex from patricio0312rev/skillset. It costs 52 tokens per session (1,312 once invoked), scanned A, a copy of guardrails-safety-filter-builder, MIT.

A set of safety checks for AI applications that filter inputs and outputs, hide personal information, enforce topic rules, and detect attempts to manipulate the instructions.

In plain words
What is it for?
Use it to redact email addresses, phone numbers, payment-card numbers, and other personal data; detect prompt injection; block unsafe inputs; and provide safe refusals.
Why use it?
It helps prevent sensitive data from being exposed and limits harmful, disallowed, or instruction-breaking requests and responses.

Skill for Claude CodeCodex

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

Good fit Use it to redact email addresses, phone numbers, payment-card numbers, and other personal data; detect prompt injection; block unsafe inputs; and provide safe refusals.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/patricio0312rev/skillset/guardrails-safety-filter-builder
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 patricio0312rev/skillset --skill guardrails-safety-filter-builder
Clone the repo
git clone --depth 1 https://github.com/patricio0312rev/skillset

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 guardrails-safety-filter-builder

README.md
[![agentmods](https://agentmods.dev/badge/skills/patricio0312rev/skillset/guardrails-safety-filter-builder/github.svg)](https://agentmods.dev/skills/patricio0312rev/skillset/guardrails-safety-filter-builder)
Your own site
<a href="https://agentmods.dev/skills/patricio0312rev/skillset/guardrails-safety-filter-builder"><img src="https://agentmods.dev/badge/skills/patricio0312rev/skillset/guardrails-safety-filter-builder/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 guardrails-safety-filter-builder

Your own site · 80×15
<a href="https://agentmods.dev/skills/patricio0312rev/skillset/guardrails-safety-filter-builder"><img src="https://agentmods.dev/badge/skills/patricio0312rev/skillset/guardrails-safety-filter-builder.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,312 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 100% 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.00052 $0.01312
Opus 5.5 $0.00021 $0.00525
Sonnet 5.5 $0.00010 $0.00262
Haiku 4.5 $0.00005 $0.00131

Measured 3mo ago against content hash eab4365c265b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

guardrails-safety-filter-builder 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 3mo ago.

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

100% identical to guardrails-safety-filter-builder — 0 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.

templates/ai-engineering/guardrails-safety-filter-builder/SKILL.md · 227 lines

How it starts

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

Guardrails & Safety Filter Builder

Build comprehensive safety systems for LLM applications.

Safety Layers

  1. Input filtering: Block malicious prompts
  2. Output filtering: Redact sensitive data
  3. Topic constraints: Policy-based refusals
  4. PII detection: Mask personal information
  5. Prompt injection: Detect manipulation attempts

PII Detection & Redaction

import re
from presidio_analyzer import AnalyzerEngine
from presidio_anonymizer import AnonymizerEngine

analyzer = AnalyzerEngine()
anonymizer = AnonymizerEngine()

def redact_pii(text: str) -> str:
    # Detect PII
    results = analyzer.analyze(
        text=text,
        language='en',
        entities=["EMAIL_ADDRESS", "PHONE_NUMBER", "CREDIT_CARD", "SSN"]
    )

    # Anonymize
    anonymized = anonymizer.anonymize(text, results)
    return anonymized.text

# Example: "My email is [email protected]" → "My email is <EMAIL_ADDRESS>"

Prompt Injection Detection

def detect_prompt_injection(user_input: str) -> bool:
    """Detect common prompt injection patterns"""
    patterns = [
        r'ignore (previous|above) instructions',
        r'disregard (all|any) (prior|previous)',
        r'you are now',
        r'new instructions',
        r'system:',
        r'override',
    ]

    for pattern in patterns:
        if re.search(pattern, user_input, re.IGNORECASE):
            return True

    return False

# Block if detected
if detect_prompt_injection(user_input):
    return "I cannot process that request."

Topic Constraints

# Define allowed/disallowed topics
POLICY = {
    "allowed_topics": [
        "product_features",
        "troubleshooting",
        "billing",
        "account_management"
    ],
    "disallowed_topics": [
        "medical_advice",
        "legal_advice",
        "financial_advice",
        "politics",
        "violence"
    ],
    "requires_disclaimer": [
        "security_practices",
        "data_privacy"
    ]
}

# Classify topic
def classify_topic(query: str) -> str:
    classification_prompt = f"""
    Classify this query into one of these topics:
    {', '.join(POLICY['allowed_topics'] + POLICY['disallowed_topics'])}

    Query: {query}

    Return only the topic name.
    """
    return llm(classification_prompt)

# Check policy
def check_policy(query: str) -> dict:
    topic = classify_topic(query)

    if topic in POLICY["disallowed_topics"]:
        return {
            "allowed": False,
            "reason": f"Cannot provide {topic}",
            "refusal": REFUSAL_TEMPLATES[topic]
        }

    return {"allowed": True, "topic": topic}

Read the full file on GitHub · 227 lines

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. 3mo ago First seen · 227 lines · 52 tokens per session scan A eab4365c265b

Subscribe to this mod's changes

guardrails-safety-filter-builder is a skill published in the GitHub repository patricio0312rev/skillset (7 stars, last pushed 10mo ago), licensed MIT. It adds 52 tokens to every session and 1,312 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to guardrails-safety-filter-builder, differing in 0 lines, and is treated as a copy.

Related

guardrails-safety-filter-builder compared with skills from other repositories

guardrails-safety-filter-builder next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
guardrails-safety-filter-builderpatricio0312rev/skillsetSkill710mo agoMITA52Claude Code, Codex
llm-app-patternsdavila7/claude-code-templatesSkill35ktodayMITA54Claude Code, Codex
enhance-promptgoogle-labs-code/stitch-skillsSkill15ktodayApache-2.0A41Claude Code
prompt-engineerJeffallan/claude-skillsSkill13ktodayMITA93Claude Code
prompt-optimizationlangwatch/langwatchSkill5.1ktodayApache-2.0A105Claude Code, Codex
prompt-library-for-startupsaws/agent-toolkit-for-awsSkill3.6ktodayApache-2.0A244Claude Code
hve-buildermicrosoft/hve-coreSkill1.7ktodayMITA54Claude Code