prompt-injection-defense

Implement input sanitization, instruction hierarchy, and tool permissions to mitigate prompt injection.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/tylern91/dotfiles --skill prompt-injection-defense-tylern91
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prompt-injection-defense
Source: https://github.com/tylern91/dotfiles/tree/main/agents/.agents/skills/prompt-injection-defense
Command: npx skills add https://github.com/tylern91/dotfiles --skill prompt-injection-defense-tylern91

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents prompt injection and indirect prompt attacks by enforcing input controls, strict tool permissions, output validation, and clear isolation boundaries across LLM-powered systems.

Core Features & Use Cases

  • Instruction hierarchy enforcement and context isolation to stop leakage of system prompts.
  • Context-aware input sanitization, canary token integration, and adjustable tool-permission policies for secure agent workflows.
  • Use cases include securing chat assistants, RAG pipelines, and agentic workflows with external tools.

Quick Start

Configure layered defenses and practice safe prompt handling in your LLM application.

Frequently Asked Questions about prompt-injection-defense

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent prompt injection attacks in my LLM application?

Prevent prompt injection by enforcing input sanitization, strict tool permissions, output validation, and clear context isolation boundaries across LLM-powered systems. These layered defenses mitigate both direct and indirect prompt attacks.

What is the best way to secure an agentic workflow with external tools against indirect prompt attacks?

Secure agentic workflows by implementing instruction hierarchy enforcement, context-aware input sanitization, and adjustable tool-permission policies. This isolates untrusted content and prevents unauthorized tool execution from indirect prompt attacks.

Does this prompt injection defense approach work with RAG pipelines that ingest untrusted content?

Yes, this defense explicitly applies to RAG pipelines ingesting untrusted content. It mitigates indirect prompt attacks by enforcing input controls, context isolation, and output validation to secure the retrieval pipeline.

How do canary tokens detect system prompt leakage in AI systems?

Canary tokens detect system prompt leakage by embedding unique markers within the instruction hierarchy. During output validation, if these tokens appear in the generated response, the system confirms unauthorized leakage of the system prompt.

When do I need instruction hierarchy enforcement for my chat assistant?

Instruction hierarchy enforcement is needed when chat assistants process untrusted user inputs or external data. It establishes strict isolation boundaries to stop leakage of system prompts and maintain secure context boundaries.