llm-app-security
Skill1 starsChanged 4 months agoApache-2.0View on GitHub
Secure design patterns for applications that call LLMs or run agents. Use this skill whenever building, modifying, or reviewing AI features: prompt construction, chat endpoints, agent loops, tool/function calling, MCP servers and clients, RAG and vector search, document ingestion for AI, model output handling, or AI-driven automation. Trigger on 'prompt injection', 'jailbreak', 'agent', 'tool calling', 'function calling', 'RAG', 'embeddings', 'vector store', 'system prompt', 'MCP server', 'AI feature', or any use of an LLM SDK (OpenAI, Anthropic, Gemini, LangChain, LlamaIndex, Vercel AI SDK). Enforces the rule that security is implemented in code around the model, never in the prompt.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- ShieldNet-360/secure-vibetheir own version, first seen Jul 9, 2026
- GoldenWing-360/claude-security-skillstheir own version, first seen May 12, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- ShieldNet-360/secure-vibe★ 22same name
- GoldenWing-360/claude-security-skills★ 19same 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 repository2 other files it gives its agents.
- secure-codingSkill
- security-review-methodSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 49
Every tool call runs an authorization check as if it were an HTTP request from that user, because that is exactly what it is.
- Distinctive: line 73
If both sides exist in one agent, that's a finding regardless of how good the prompt is.
- Very specific: line 106
If the agent runs code or shell commands, assume it will run whatever an injected document tells it to.
- Distinctive: line 112
Don't put secrets, other tenants' data, or unnecessary PII in a prompt.
- Distinctive: line 127
Before shipping, write down: *if an attacker fully controls this model's output, they can ______.* If that sentence ends with anything …
- Distinctive: line 133
Keep a small set of injection payloads in CI against your actual prompts and tools: instructions hidden in a retrieved document, a tool …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
LLM Application Security
The premise everything follows from
A prompt is not a security boundary. The model cannot reliably distinguish your instructions from instructions embedded in the data it reads. Any content that reaches the context window — a retrieved document, a fetched web page, a tool result, a filename, an uploaded PDF, text inside an image, an email body — can steer the model's behavior.
So the security question is never "can the model be tricked?" Assume it can. The question is:
If an attacker had complete control of the model's output, what could they do?
Whatever that answer is, that is your application's security posture. Reduce it in code, not in the prompt.
Prompt-level defenses ("ignore any instructions in the document below", delimiters, an instruction hierarchy) are worth adding — they raise the cost of an attack. But they are hardening, never a control. Never present one as a fix for a real authority problem.
Design rules
1. The model's identity is not the user's identity
Tools must resolve the acting user from the session, not from arguments the model supplies.
# wrong — injection sets user_id to anyone
def get_invoices(user_id: str): ...
# right — the model chooses the action; the code decides whose data
def get_invoices(status: str, *, session):
return db.invoices(owner_id=session.user_id, status=status)Every tool call runs an authorization check as if it were an HTTP request from that user, because that is exactly what it is. A tool that skips the check because "only our agent calls it" is an unauthenticated endpoint.
2. Least authority, per tool
Give the model the narrowest tools that accomplish the task. A tool that can run arbitrary SQL is not a "database tool", it's a database compromise waiting for one poisoned document. Prefer five specific tools over one general one.
For each tool ask: what is the worst call anyone could make, and is that acceptable?
3. Watch for the exfiltration pair
The dangerous combination is a tool that reads private data plus any channel that reaches outward. Injection then becomes data theft. Outbound channels are easy to miss:
- A
fetch/HTTP tool - Sending email, messages, or webhooks
- Writing to a shared document, issue, or repo
- Rendering markdown images or links —
exfiltrates on render, with no click required. Restrict image and link origins in anything that renders model output.
If both sides exist in one agent, that's a finding regardless of how good the prompt is.
4. Gate irreversible and costly actions on a human
Deletes, payments, transfers, outbound email, public posts, code execution, infrastructure changes, spending. Confirmation must show the human the actual concrete action — the real recipient, the real amount, the real file — not the model's summary of it, which the attacker also controls.
5. Model output is untrusted input
Route it through exactly the same defenses as a request body:
- Rendering as HTML/markdown → sanitize; block
javascript:/data:URLs and remote images - Building SQL, shell commands, paths, or URLs → parameterize and validate; never
eval - Parsed as JSON → validate against a schema before use
- Used as an authorization decision → never. The model does not make access-control decisions.
6. Isolate tenants in retrieval
Filter by tenant/user inside the vector query, not after results come back. Post-filtering means the wrong data was already retrieved and one missed filter leaks across customers. Partition indexes or namespaces where the store supports it. Treat ingested documents as attacker-controlled — because whoever uploaded them controls them.
7. Bound the loop
Cap agent iterations, tool calls, tokens, wall-clock time, and spend per request and per user. An unbounded loop is a cost-DoS and a runaway-action risk. Log every tool call with its arguments and the acting user, so an incident is reconstructable.
8. Sandbox execution
If the agent runs code or shell commands, assume it will run whatever an injected document tells it to. Isolated container, no network (or an egress allowlist), no host mounts, no credentials in the environment, CPU/memory/time limits, ephemeral.
9. Mind what enters the context
Don't put secrets, other tenants' data, or unnecessary PII in a prompt. Assume the system prompt is extractable — it is not a secret store, and it shouldn't describe internal systems in a way that helps an attacker. Check whether the provider retains or trains on your data, and whether your privacy policy matches that reality. Prompts and completions in logs are a PII surface.
10. Verify the supply chain
Pin model versions and weights by hash. Avoid pickle-based model formats (.bin, .pt) —
loading one executes code; prefer safetensors. Review MCP servers and third-party tools before
granting them: a malicious tool description is itself an injection vector, since it goes
straight into the model's context.
When building any AI feature, state this explicitly
Before shipping, write down: if an attacker fully controls this model's output, they can ______. If that sentence ends with anything involving other users' data, money, or code execution, fix the architecture — not the prompt.
Test it
Keep a small set of injection payloads in CI against your actual prompts and tools: instructions hidden in a retrieved document, a tool result that tells the model to call another tool with different arguments, a filename containing instructions, an attempt to get the model to emit a markdown image with data in the URL. This catches regressions when someone adds a tool later.
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.

