JPeetz/agent-skills / skills/security/prompt-injection-defense
prompt-injection-defense
FlaggedUse this skill when designing, reviewing, or hardening an LLM application or agent against prompt injection (OWASP LLM01:2025) — direct and indirect injection, tool-output and RAG-borne payloads, memory poisoning, and exfiltration through tool calls or rendered markdown. Covers trust boundary enumeration, context isolation and spotlighting, system prompt hardening, input screening, tool-boundary gating, output validation with canary tokens, adversarial test suites, and runtime monitoring. Produces an enforceable defense matrix and stdlib screening scripts, not prompt-only advice.
| File | Kind | Size |
|---|---|---|
| CHANGELOG.md | markdown | 2.0 KB |
| LICENSE | other | 666 B |
| SKILL.md | skill md | 27.6 KB |
| evals/evals.json | config | 10.5 KB |
| references/attack-catalog.md | markdown | 16.3 KB |
| references/defense-matrix.md | markdown | 11.2 KB |
| scripts/scan_agent_output.py | script | 21.6 KB |
| scripts/screen_input.py | script | 29.3 KB |
CHANGELOG.md
View on GitHub# Changelog
## [1.0.0] — 2026-11-14
- Initial release
- Trust boundary enumeration across eight channels (system, user, retrieved,
tool output, memory, peer agent, model output, rendered surface)
- Seven-layer defense pipeline from boundary mapping through monitoring, with
the tool boundary (L4) as the only hard enforcement point
- Context isolation: nonce-delimited provenance blocks, datamarking, and the
dual-LLM quarantined-extraction pattern
- System prompt hardening template with an explicit instruction hierarchy
- Input screening with normalization-first matching (NFKC, confusables,
zero-width, bidi/Trojan Source, Unicode tags, ANSI, entity/percent, base64/hex)
- Tool-boundary enforcement: argument validation, argument provenance/tainting,
per-task capability scoping, reversibility-based approval gates, sandboxing
- Output validation: canary tokens, secret/PII scanning, exfil-URL detection,
markdown/HTML/terminal render sanitizing
- Adversarial testing methodology measuring ASR per family and FPR on benign input
- Monitoring, detection signals, kill switches, and an incident response sequence
- 3 worked examples (RAG document assistant, coding agent on untrusted issues,
inbox triage with send authority)
- 13 anti-patterns
- `scripts/screen_input.py` — stdlib-only screener with classifier hook
(subprocess or HTTP), fail-closed option, source-aware scoring, and
nonce-wrapped context emission
- `scripts/scan_agent_output.py` — stdlib-only output scanner with canary
detection, Luhn-validated card detection, entropy+keyword secret heuristics,
and per-mode sanitizers
- `references/attack-catalog.md` — 15 attack families with payload examples
- `references/defense-matrix.md` — 26 controls × 15 families, strength ratings,
failure modes, minimum viable defense per deployment archetype, and a
15-item verification checklist
- Aligned to OWASP LLM01:2025 and Anthropic guardrails guidance; complements
`agentic-security-scanner` (install-time), `threat-modeling` (design-time)
and `vulnerability-management` (remediation)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |