prompt-injection-detector
Skill3 starsChanged 4 months agoMITView on GitHub
Detect prompt injection, jailbreak, and adversarial input patterns in user inputs, system prompts, and retrieved context before they reach the LLM pipeline. Use when working on LLM security, OWASP reviews, threat modeling, guardrails, or prompt injection.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- yasdelayu/agent-x-cctheir own version, first seen Oct 13, 2026
- Adarshukumar/skillstheir own version, first seen Sep 22, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- Adarshukumar/skills★ 1same name
- yasdelayu/agent-x-cc★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository59 other files it gives its agents.
- agent-memory-designerSkill
- ai-cost-optimizerSkill
- ai-evaluation-builderSkill
- ai-latency-optimizerSkill
- ai-solution-architectSkill
- ai-workflow-builderSkill
- context-engineeringSkill
- human-in-the-loop-designerSkill
- multi-agent-plannerSkill
- prompt-engineerSkill
- prompt-optimizerSkill
- prompt-reviewerSkill
- adr-generatorSkill
- api-designerSkill
- architecture-reviewSkill
- component-diagram-builderSkill
- container-diagram-builderSkill
- data-flow-analyzerSkill
- integration-plannerSkill
- observability-plannerSkill
- scalability-advisorSkill
- solution-architectureSkill
- system-context-builderSkill
- experiment-designerSkill
- go-to-market-plannerSkill
- pricing-strategy-advisorSkill
- mcp-best-practicesSkill
- mcp-client-generatorSkill
- mcp-security-reviewSkill
- mcp-server-generatorSkill
- mcp-tool-generatorSkill
- acceptance-criteria-generatorSkill
- analytics-instrumentation-plannerSkill
- competitive-analysisSkill
- epic-generatorSkill
- feature-prioritizationSkill
- idea-validatorSkill
- north-star-metric-advisorSkill
- okr-builderSkill
- persona-generatorSkill
- prd-generatorSkill
- problem-statement-builderSkill
- product-discovery-assistantSkill
- product-vision-builderSkill
- sprint-plannerSkill
- story-mappingSkill
- user-story-generatorSkill
- value-proposition-designerSkill
- chunking-strategy-advisorSkill
- embedding-strategy-advisorSkill
- hybrid-search-advisorSkill
- knowledge-ingestion-plannerSkill
- rag-architecture-designerSkill
- retriever-optimizerSkill
- ai-governance-advisorSkill
- ai-threat-modelingSkill
- guardrails-builderSkill
- owasp-llm-reviewerSkill
- skill-nameSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 124
Test with automated red-team payloads and human-crafted edge cases.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Prompt Injection Detector
Purpose
Detect prompt injection, jailbreak, and adversarial input patterns in user inputs, system prompts, and retrieved context before they reach the LLM pipeline.
Input: Sample inputs (user messages, RAG chunks, tool outputs), application flow description, trust boundaries
Output: Injection Detection Report with pattern catalog, risk ratings, test cases, and mitigation recommendations
Examples: See examples.md for worked input/output.
Workflow
Step 1: Map input surfaces
Identify all text entry points:
| Surface | Source | Trust level | Sanitization today |
Include: chat input, file uploads, RAG retrieval, tool/API responses, email/web scraping, multi-turn history.
Step 2: Classify attack vectors
Scan inputs against known categories:
| Category | Examples |
| Direct override | "Ignore previous instructions", "Disregard system prompt" |
| Role hijack | "Pretend to be DAN", persona switching |
| Delimiter escape | Closing tags, markdown/code fence breaks, XML injection |
| Indirect injection | Hidden instructions in documents, emails, web pages |
| Encoding evasion | BaseException, Base64, Unicode homoglyphs, zero-width chars |
| Tool coercion | "Call delete_all with param X", unauthorized function invocation |
| Data exfiltration | "Repeat your system prompt", "List all user emails" |
Step 3: Build pattern catalog
For each detected or anticipated pattern document:
| Pattern ID | Category | Regex/heuristic | Severity | Example payload |
Severity scale: Critical (system override), High (data leak/tool abuse), Medium (behavior drift), Low (noise).
Step 4: Create adversarial test suite
Design test cases per surface:
| Test ID | Surface | Payload | Expected behavior | Pass/Fail criteria |
Include benign false-positive checks (legitimate use of words like "ignore" in domain context).
Step 5: Assess pipeline gaps
Review current defenses:
- Input filtering (regex, ML classifier)
- Prompt structure (role separation, delimiters)
- Output validation
- Tool permission boundaries
Step 6: Recommend mitigations
Prioritize controls by severity × likelihood. Link each gap to a concrete control.
Step 7: Validate
Run Validation checklist.
Decision Rules
| Condition | Action |
| No sample inputs provided | Use OWASP LLM01 attack catalog as baseline; flag as assumed coverage |
| RAG or tool use present | Expand indirect injection and tool coercion tests |
| Multi-agent or chain-of-thought | Add inter-agent instruction smuggling checks |
| High false-positive risk domain (legal, medical) | Tune patterns; prefer semantic classifiers over brittle regex |
| Critical pattern with no control | Stop; mark as blocker before production |
| Inputs in non-English | Include multilingual and homoglyph evasion tests |
Validation
- All input surfaces enumerated with trust levels
- Pattern catalog covers direct, indirect, and encoding evasion
- Each Critical/High pattern has at least one test case
- False-positive scenarios documented for domain-specific language
- Mitigations mapped to specific pipeline stages (pre-LLM, post-LLM, tool gate)
- Severity ratings use consistent scale
- No implementation code (framework-specific)
- Gaps without mitigations flagged as open risks
Anti-patterns
- Regex-only defense — trivially bypassed by paraphrasing and encoding.
- Testing happy path only — missing indirect injection via RAG and tool outputs.
- Ignoring multi-turn context — earlier benign messages used to smuggle instructions later.
- Treating detection as prevention — reporting patterns without pipeline placement for controls.
- Zero false-positive planning — blocking legitimate domain terms without allowlist strategy.
Best Practices
- Apply OWASP LLM01 (Prompt Injection) taxonomy as baseline.
- Separate trusted system instructions from untrusted user/RAG content with explicit delimiters.
- Test with automated red-team payloads and human-crafted edge cases.
- Log detection events with pattern ID for tuning; never log full secrets or PII.
- Layer defenses: input filter → structured prompt → output validator → tool permission gate.
- Re-run detection suite after prompt or RAG schema changes.
Output Structure
# Injection Detection Report: [Application Name]
## Input Surfaces
| Surface | Trust | Current controls |
|---------|-------|------------------|
## Pattern Catalog
| ID | Category | Severity | Detection method | Example |
|----|----------|----------|------------------|---------|
## Test Suite
| Test ID | Surface | Payload | Expected | Status |
|---------|---------|---------|----------|--------|
## Gap Analysis
| Gap | Severity | Affected surface | Recommended control |
|-----|----------|------------------|---------------------|
## False-Positive Notes
- [Domain terms that may trigger filters]
## Open Risks
- [ ] [Unmitigated item]Next Skills
| Outcome | Recommended Skill |
| Design input/output controls | security/guardrails-builder |
| Full threat model needed | security/ai-threat-modeling |
| OWASP compliance review | security/owasp-llm-reviewer |
| Fix prompt structure issues | ai/prompt-engineer |
| Review prompt quality | ai/prompt-reviewer |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

