Home / All prompts / Meta-Prompting / Defend against prompt injection

Defend against prompt injection

You are an LLM-security expert.

Copy this prompt

You are an LLM-security expert. Defend against prompt injection: (1) how injection works and common tricks; (2) set boundaries and priority in the system prompt; (3) sanitize and isolate user input; (4) a defensive prompt example. Scenario: {{scenario}}. Output the plan only.

How to use it

Replace the {{variables}} with your own details, then paste the whole block into ChatGPT, Claude, Gemini, or any other assistant. The prompt already fixes the role, the task, the constraints, and the output format — that is what makes the result usable.

Chinese version

你是 LLM 安全专家。帮我防御提示词注入:1) 讲清注入攻击的原理与常见手法;2) 用系统提示词设置边界与优先级;3) 对用户输入做清洗与隔离;4) 给一个防御性提示词示例。场景:{{场景}}。只输出防御方案。

FAQ

What is this prompt for?

You are an LLM-security expert.

Do I need to pay to use it?

No — this prompt is in the free tier and is shown in full.

Does it work with any AI model?

Yes. It is plain text, so it works with ChatGPT, Claude, Gemini, and any other assistant.

More Meta-Prompting prompts