Draft Input Sanitization Rules for AI Agents
Get five strict, deterministic input-sanitization rules to prevent prompt injection and data leakage before processing untrusted user inputs in an agent.
Agent prompt for Claude and ChatGPT
Prompt
mkdir -p .agents/skills/draft-input-sanitization-rules-for-ai-agents && curl -sL "https://prompts-gpt.com/prompts/draft-input-sanitization-rules-for-ai-agents/raw" -o .agents/skills/draft-input-sanitization-rules-for-ai-agents/SKILL.md---
name: draft-input-sanitization-rules-for-ai-agents
description: "Get five strict, deterministic input-sanitization rules to prevent prompt injection and data leakage before processing untrusted user inputs in an agent."
---
# Draft Input Sanitization Rules for AI Agents
Get five strict, deterministic input-sanitization rules to prevent prompt injection and data leakage before processing untrusted user inputs in an agent.
## Prompt
```
You are a security engineer specializing in AI agent guardrails. Draft five specific, actionable sanitization rules to block malicious input before it reaches an LLM agent. For each rule, include: 1. A clear technical requirement (e.g., regex, structure, or length). 2. A valid input example. 3. An invalid, malicious input example. Rules must focus on preventing prompt injection, escaping control characters, and enforcing data schemas. After presenting the rules, explain how to implement them in a Python-based pipeline. This is not legal or cybersecurity advice; consult a qualified security professional for production infrastructure. Output format: ## Rule 1: [Title] - Requirement: [Description] - Valid: [Example] - Invalid: [Example] ... ## Implementation Summary: [Brief technical overview]
```
## Usage Notes
Use this prompt when building agentic applications in Claude, ChatGPT, or Gemini to ensure untrusted user data is sanitized. Copy the output into your middleware layer before the LLM receives the prompt.
You are a security engineer specializing in AI agent guardrails. Draft five specific, actionable sanitization rules to block malicious input before it reaches an LLM agent. For each rule, include: 1. A clear technical requirement (e.g., regex, structure, or length). 2. A valid input example. 3. An invalid, malicious input example. Rules must focus on preventing prompt injection, escaping control characters, and enforcing data schemas. After presenting the rules, explain how to implement them in a Python-based pipeline. This is not legal or cybersecurity advice; consult a qualified security professional for production infrastructure. Output format: ## Rule 1: [Title] - Requirement: [Description] - Valid: [Example] - Invalid: [Example] ... ## Implementation Summary: [Brief technical overview]Example output
Tips and common edits
Why this works
- Requires specific examples of both valid and malicious inputs for every rule.
- Forces a focus on deterministic checks rather than relying on the LLM to police itself.
- Includes a clear technical implementation path using standard programming libraries.
Use this prompt when building agentic applications in Claude, ChatGPT, or Gemini to ensure untrusted user data is sanitized. Copy the output into your middleware layer before the LLM receives the prompt.
Common edits
- Adjust character limits based on your specific use case requirements.
- Add or remove blacklisted keywords depending on the specific model architecture.
Reuse it: Use in a workflowAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
Red Team Agent System Prompts for Injection Vulnerabilities
Assess the security of your agent system prompt against five common indirect prompt injection vectors using a structured risk analysis table.
Design an AI Agent With Tools, Guardrails and Eval Cases Before You Build It
Turns an agent idea into a build-ready design: the job, the tools with their inputs and permissions, guardrails, failure handling and a set of evaluation cases to test it.
Checkable Guardrail Rules for a Coding Agent: Blocked Commands, Approvals, Secrets and Hooks
Produces a set of testable guardrail rules for your coding agent, covering blocked commands, approval gates, secret handling and hook checks.
Tool Permission Matrix and Function Spec for a Tool-Using Agent
Produces a least-privilege tool inventory, function definitions, and approval rules for an agent that calls APIs or internal systems.
Agent Run Pre-Mortem and Self-Correction Loop Designer
Designs verification checks, error handling, and a self-correction loop for an agent task before it runs, based on likely failure modes.
Generate Adversarial Evaluation Transcripts for AI Agents
Create three distinct multi-turn conversation logs designed to test your AI agent for social engineering, tool hallucination, and silent goal drift.
- Coding Agent Task Brief with Guardrails, Test Plan, and Rollback Steps
- Audit Agent Tool Definitions to Fix Routing Errors
- Agent Tool Names, Descriptions and JSON Schemas from API Docs
- Agent Workflow Decomposition with Autonomy Levels and Stop Rules
- Incident Recovery Playbook for Rogue AI Agent Loops
- Model Tier Budget and Latency Breakdown for Multi-Turn Agents