/vibe:skill-guardrail-patternsfrom vibe
Decision framework for choosing and implementing guardrails in production LLM applications. Covers tool selection, layering strategy, and cost-performance tradeoffs for safety, content filtering, and prompt injection prevention.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When building an LLM application that needs safety layers, apply this decision framework.
Always add guardrails when:
Minimal guardrails are acceptable when:
No guardrails is never acceptable in production. Even a simple length check and rate limit prevents the worst automated attacks.
| Check | Latency | Cost | Catches |
|---|---|---|---|
| Input length limit | <1ms | Free | Prompt stuffing, resource exhaustion |
| Rate limiting | <1ms | Free | Automated attacks, scraping |
| Keyword blocklist | <1ms | Free | Obvious injection patterns |
| Output length limit | <1ms | Free | Context stuffing, runaway generation |
| Check | Latency | Cost | Catches |
|---|---|---|---|
| Regex injection detection | 1-5ms | Free | 80% of direct injection attempts |
| PII regex patterns | 1-5ms | Free | Emails, SSNs, credit cards, phones |
| Topic keyword classifier | 1-5ms | Free | Off-topic requests (violence, illegal) |
| Output toxicity regex | 1-5ms | Free | Graphic violence, explicit instructions |
| Check | Latency | Cost | Catches |
|---|---|---|---|
| OpenAI Moderation API | ~100ms | Free | 11 harm categories with confidence scores |
| LlamaGuard 3 (self-hosted) | ~200ms | GPU cost | 13 safety categories, works offline |
| Presidio PII detection | ~10ms | Free | 28 entity types, NLP-enhanced |
| Prompt injection classifier (deberta-v3) | ~50ms | Free/GPU | 95%+ injection detection accuracy |
| Check | Latency | Cost | Catches |
|---|---|---|---|
| Relevance scoring (embeddings) | ~50ms | Embedding API | Off-topic responses, topic drift |
| System prompt leak detection | ~10ms | Free | Attempts to extract your instructions |
| Hallucination check vs source | ~100ms | Embedding API | Fabricated facts in RAG responses |
| NeMo Guardrails (Colang flows) | ~50ms + LLM | LLM call | Custom conversation boundaries |
Input -> Rate limit -> OpenAI Moderation -> LLM -> OpenAI Moderation -> Output
Total added latency: ~200ms. Cost: free. Catches: ~85% of attacks.
Input -> Rate limit -> Regex filters -> Injection classifier -> LLM -> Toxicity filter -> PII scrub -> Output
Total added latency: ~50-100ms. Cost: minimal (self-hosted classifiers). Catches: ~95% of attacks.
Input -> Rate limit -> Regex -> LlamaGuard -> Presidio PII -> Injection classifier
-> LLM (with NeMo Rails)
-> LlamaGuard -> Toxicity filter -> Presidio PII scrub -> Relevance check -> Hallucination check -> Output
Total added latency: ~500-800ms. Cost: GPU infrastructure. Catches: ~99% of attacks.
| Approach | Added Latency | Monthly Cost | Detection Rate | Maintenance |
|---|---|---|---|---|
| Regex only | <5ms | $0 | ~60% | Low (update patterns quarterly) |
| Regex + OpenAI Moderation | ~100ms | $0 | ~85% | Low |
| Regex + ML classifiers (self-hosted) | ~50ms | $50-200 (GPU) | ~92% | Medium (retrain quarterly) |
| Full stack (LlamaGuard + Presidio + NeMo) | ~500ms | $200-500 (GPU) | ~99% | High (continuous monitoring) |
| Failure | Cause | Fix |
|---|---|---|
| False positives on legitimate queries | Overly aggressive keyword matching | Use confidence thresholds, not binary match |
| Missed encoded attacks | Only checking plain text | Decode base64/ROT13/hex before checking |
| PII in tool results | Scrubbing outputs but not tool responses | Scrub at every boundary, not just final output |
| Prompt extraction via paraphrasing | Only checking for exact prompt text | Use embedding similarity, not string matching |
| Rate limit bypass via multiple accounts | Per-account limits only | Add IP-based and fingerprint-based limits |
| Jailbreak via multi-turn manipulation | Only checking individual messages | Track conversation-level risk scores |
| Indirect injection in RAG | Trusting retrieved content as instructions | Isolate data from instructions with delimiters |
Before shipping any LLM application, run these 10 tests:
<script>alert('xss')</script> in input to test output escapingIf any of these succeed, you have work to do before launch.
Log these for every request:
Alert on these:
Dashboard these:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
guardrails, safety, content-filtering, prompt-injection, pii, moderation, llamaguard, nemo
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job