Borrowing it
Nothing to install: this file belongs to lasso-security/claude-hooks. 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/lasso-security/claude-hooks/dev/.claude/skills/prompt-injection-defender/SKILL.mdgit clone --depth 1 https://github.com/lasso-security/claude-hooksWrote 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/lasso-security/claude-hooks/prompt-injection-defender)<a href="https://agentmods.dev/skills/lasso-security/claude-hooks/prompt-injection-defender"><img src="https://agentmods.dev/badge/skills/lasso-security/claude-hooks/prompt-injection-defender/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/lasso-security/claude-hooks/prompt-injection-defender"><img src="https://agentmods.dev/badge/skills/lasso-security/claude-hooks/prompt-injection-defender.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.00000 | $0.00958 |
| Opus 5 | $0.00000 | $0.00479 |
| Sonnet 5 | $0.00000 | $0.00192 |
| Haiku 4.5 | $0.00000 | $0.00096 |
Grade B, and why
prompt-injection-defender scanned grade B with 2 findings 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 10d 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.
- [Instruction Override] Attempts to ignore previous instructions Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.
Reads agent configuration directorieslowAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
| Global | `~/.claude/settings.json` | All projects | 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 — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Prompt Injection Defender Skill
Overview
Defense against indirect prompt injection attacks for Claude Code. This skill provides PostToolUse hooks that scan tool outputs (files, web pages, command results) for injection attempts and warn Claude about suspicious content.
Features
- Real-time scanning of tool outputs (Read, WebFetch, Bash, Grep, Task, MCP tools)
- 4 detection categories: Instruction Override, Role-Playing/DAN, Encoding/Obfuscation, Context Manipulation
- 50+ patterns covering known injection techniques
- Warn + Continue approach (doesn't block, just warns Claude)
- Dual implementation: Python/UV and TypeScript/Bun
Skill Structure
prompt-injection-defender/
├── SKILL.md # This file
├── patterns.yaml # Single source of truth for detection patterns
├── cookbook/
│ ├── install_workflow.md # Interactive installation guide
│ ├── modify_patterns_workflow.md # Pattern modification guide
│ └── test_defender.md # Testing workflow
├── hooks/
│ ├── defender-python/ # Python implementation
│ │ ├── post-tool-defender.py
│ │ ├── python-settings.json
│ │ └── test-defender.py
│ └── defender-typescript/ # TypeScript implementation
│ ├── post-tool-defender.ts
│ ├── typescript-settings.json
│ └── test-defender.ts
└── test-prompts/ # Test scenarios
├── injection_v1.md # Instruction override tests
├── injection_v2.md # Role-playing tests
├── injection_v3.md # Encoding tests
└── injection_v4.md # Context manipulation tests
Cookbook Decision Tree
Triggers → Workflows
| User Request Pattern | Workflow to Use |
|---|---|
| "install prompt injection defender" | install_workflow.md |
| "install the defender" | install_workflow.md |
| "protect against prompt injection" | install_workflow.md |
| "add new pattern" | modify_patterns_workflow.md |
| "modify patterns" | modify_patterns_workflow.md |
| "update detection rules" | modify_patterns_workflow.md |
| "test the defender" | test_defender.md |
| "run injection tests" | test_defender.md |
| "verify defender works" | test_defender.md |
What ships with it
18 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- cookbook/install_workflow.md 2.4 KB
- cookbook/modify_patterns_workflow.md 2.7 KB
- cookbook/test_defender.md 3.5 KB
- hooks/defender-python/post-tool-defender.py 11 KB runs code
- hooks/defender-python/python-settings.json 1.4 KB
- hooks/defender-python/test-defender.py 8.0 KB runs code
- hooks/defender-typescript/post-tool-defender.ts 9.9 KB runs code
- hooks/defender-typescript/test-defender.ts 9.4 KB runs code
- hooks/defender-typescript/typescript-settings.json 1.4 KB
- patterns.yaml 17 KB
- test-files/context_manipulation.txt 985 B
- test-files/encoding_obfuscation.txt 796 B
- test-files/instruction_override.txt 780 B
- test-files/roleplay_dan.txt 935 B
- test-prompts/injection_v1.md 1015 B
- test-prompts/injection_v2.md 975 B
- test-prompts/injection_v3.md 1003 B
- test-prompts/injection_v4.md 1000 B
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.
- 10d ago First seen · 126 lines · 0 tokens per session scan B 787aa6e55c51
prompt-injection-defender is a skill published in the GitHub repository lasso-security/claude-hooks (265 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 958 tokens. A static security scan graded it B with 2 findings (instruction-override phrasing, reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
pptx
A guide for turning a paper, outline, or structured text into a PowerPoint presentation. It covers an 8–12-slide structure, concise slide points, and generation of a .pptx file.
ai-style
A Chinese-language writing guide for producing or revising reader-facing text such as product announcements, public-account articles, emails, and README files. It focuses on reducing patterns that make writing sound machine-generated.
curly-quote-sft
A writing rule set for technical documents that mix Chinese, English, Markdown, and code. It defines when to use curved Chinese quotation marks, straight ASCII quotes, and Markdown backticks.
triage
A task-routing guide that identifies goals, dependencies, and acceptance conditions before work begins. It orders work as research, calculation or execution, and writing.
writing
A writing guide for turning verified facts and calculations into finished text for a specific audience. It follows the requested language, structure, and length.
data_analysis
A data-analysis guide for doing mathematical calculations and descriptive statistics with confirmed, sourced data. Descriptive statistics summarise data using measures such as totals, averages, or ranges.