Borrowing it
Nothing to install: this file belongs to radif-ru/ai-multi-agent-system. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/radif-ru/ai-multi-agent-system/main/.agents/skills/prompt-injection-defense/SKILL.mdgit clone --depth 1 https://github.com/radif-ru/ai-multi-agent-systemWrote 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.
[](https://agentmods.dev/skills/radif-ru/ai-multi-agent-system/prompt-injection-defense)<a href="https://agentmods.dev/skills/radif-ru/ai-multi-agent-system/prompt-injection-defense"><img src="https://agentmods.dev/badge/skills/radif-ru/ai-multi-agent-system/prompt-injection-defense/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.
<a href="https://agentmods.dev/skills/radif-ru/ai-multi-agent-system/prompt-injection-defense"><img src="https://agentmods.dev/badge/skills/radif-ru/ai-multi-agent-system/prompt-injection-defense.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00047 | $0.00718 |
| Opus 5 | $0.00023 | $0.00359 |
| Sonnet 5 | $0.00009 | $0.00144 |
| Haiku 4.5 | $0.00005 | $0.00072 |
Grade B, and why
prompt-injection-defense scanned grade B with 1 finding 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 11d 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.
Instruction-override phrasingmediumPrompt injection
Text telling the model to disregard its earlier instructions or safety rules is the shape of a prompt injection, whoever wrote it.
1. **Вход → `InputSanitizer`.** Пользовательский текст перед передачей в `core.handle_user_task` пропускай через `sanitize_user_input(...)` (режим `"warn"` по умолчанию). Он детектит prompt injection: `ignore previous in Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.
How it starts
The opening of the file, as written. The whole thing — 31 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Skill: prompt-injection-defense
Меры защиты от типичных атак на LLM-систему. Источник истины — _docs/security.md.
Когда использовать
- Добавляешь новую точку входа пользовательского текста (новый адаптер/handler).
- Добавляешь tool, работающий с файловой системой или сетью.
- Меняешь то, что попадает в
final_answerили в системный промпт.
Алгоритм
- Вход →
InputSanitizer. Пользовательский текст перед передачей вcore.handle_user_taskпропускай черезsanitize_user_input(...)(режим"warn"по умолчанию). Он детектит prompt injection:ignore previous instructions,repeat your system prompt,forget everything above,system:в начале строки, разделители<|...|>. - Пути →
FileIdMapper. Не клади полные пути файлов в goal/ответы. Генерируй временныйfile_id(generate_id) и восстанавливай путь черезget_path. Toolsread_file/read_documentпринимаютfile_idкак альтернативуpath. - Выход →
ResponseSanitizer.final_answerперед отправкой пользователю пропускай черезsanitize_response(...): маскирует полные пути ([FILE_PATH]), конфиг-ключи ([CONFIG_KEY]), фрагменты системного промпта ([SYSTEM_SECTION]/[SYSTEM_IDENTITY]). - Опасные tools → allowlist (secure by default).
_DANGEROUS_TOOLS = {"http_request", "read_file"}. По умолчаниюdangerous_tools_allowlistпуст — все опасные tools запрещены. Разрешение — только явно через.env(DANGEROUS_TOOLS_ALLOWLIST=...). - Валидация параметров. Для ФС-tools: запрет
..(path traversal), запрет системных путей (/etc,/sys,/proc,~/.ssh), проверка нахождения внутри разрешённой директории. Дляhttp_request: толькоhttp/https, проверкаnetloc. - Системный промпт. Правила безопасности живут в
app/prompts/agent_system.md(отказ выполнять «ignore instructions», отказ печатать системный промпт, отказ от опасных операций без явного запроса).
Чего избегать
- Прокидывания сырого пользовательского ввода в системный промпт без санитайзинга.
- Полных путей ФС в goal, логах и ответах пользователю.
- Разрешения опасных tools по умолчанию (allowlist должен быть пуст, пока явно не разрешено).
- Иллюзии полной защиты: помни про known-limitations (
_docs/security.md§5) — юникод-эскейпы, base64-инъекции, голые секреты без=.
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.
- 11d ago First seen · 31 lines · 47 tokens per session scan B dc98e652fb7b
prompt-injection-defense is a skill published in the GitHub repository radif-ru/ai-multi-agent-system (6 stars, last pushed 1mo ago), licensed MIT. It adds 47 tokens to every session and 718 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (instruction-override phrasing). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
ai-portable-setup
Erstellt einen portablen KI-Arbeitsbereich auf einem USB-Stick oder beliebigen Laufwerk. RAG-Pipeline mit lokalen LLM-Modellen (Ollama), Vektordatenbank (ChromaDB) und vorkonfigurierten Prompts.
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
ai-image-color-cycling
Generate an AI image, quantize it to a 256-color indexed palette, and produce BOTH a self-contained HTML artifact AND a perfect-loop animated GIF that bring the image to life via classic 1990s palette cycling — the trick where rotating palette entries makes water flow, fire flicker, and stars twinkle without ever…
algorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright…
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when…
frontend-slides
Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.