rag-security

rag-security is a skill for Claude Code, Codex from GoldenWing-360/claude-security-skills. It costs 84 tokens per session (3,282 once invoked), scanned A, original, MIT.

A security guide for retrieval-augmented generation (RAG), where an AI app searches a document index and adds the results to its prompt. It focuses on risks created by document retrieval, such as unauthorized access, hidden instructions in documents, and information leaks.

In plain words
What is it for?
Use it when building or reviewing RAG systems with private documents, multiple tenants or permission levels, document ingestion, citations, embeddings, or changing access rights.
Why use it?
Normal API login checks do not automatically protect what a document search can return. This guide helps prevent private documents from crossing users or organizations and helps preserve trustworthy answers.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when building or reviewing RAG systems with private documents, multiple tenants or permission levels, document ingestion, citations, embeddings, or changing access rights.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/goldenwing-360/claude-security-skills/rag-security
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add GoldenWing-360/claude-security-skills --skill rag-security
Clone the repo
git clone --depth 1 https://github.com/GoldenWing-360/claude-security-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for rag-security

README.md
[![agentmods](https://agentmods.dev/badge/skills/goldenwing-360/claude-security-skills/rag-security/github.svg)](https://agentmods.dev/skills/goldenwing-360/claude-security-skills/rag-security)
Your own site
<a href="https://agentmods.dev/skills/goldenwing-360/claude-security-skills/rag-security"><img src="https://agentmods.dev/badge/skills/goldenwing-360/claude-security-skills/rag-security/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.

agentmods 80×15 button for rag-security

Your own site · 80×15
<a href="https://agentmods.dev/skills/goldenwing-360/claude-security-skills/rag-security"><img src="https://agentmods.dev/badge/skills/goldenwing-360/claude-security-skills/rag-security.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,282 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00084 $0.03282
Opus 5 $0.00042 $0.01641
Sonnet 5 $0.00017 $0.00656
Haiku 4.5 $0.00008 $0.00328

Measured 11d ago against content hash 5422284169a5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

rag-security scanned grade A with 0 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 11d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rag-security/SKILL.md · 181 lines

How it starts

The opening of the file, as written. The whole thing — 181 lines — stays where its author put it; the contents beside it link to each section on GitHub.

RAG Security

Retrieval-augmented generation moves the security question from "what can the user type" to "what can the index serve". The moment you embed documents and let similarity search decide what enters the context window, you have created a new authorization surface, a new injection surface, and a new leakage surface — and none of them are covered by your API-layer auth, because retrieval happens after the request was authorized.

The single most common RAG failure is embarrassingly simple: everything gets embedded into one index, and nothing filters at query time. Semantic search does not know about your permission model. If a restricted document is in the searchable set, a well-phrased question will surface it. This skill covers that failure and the rest of the RAG-specific trust boundaries. It pairs with prompt-injection-defense (what retrieved text can trigger) and llm-app-security (operational controls around the model call).

When to invoke

  • Building or reviewing a RAG feature over documents that are not uniformly public
  • Adding a second tenant, team, or permission tier to an existing single-index deployment
  • Designing an ingestion pipeline that accepts user-contributed or externally-fetched documents
  • Investigating a report that the assistant answered with content the user should not see
  • Pre-launch evaluation of any retrieval-backed assistant
  • Handling a GDPR deletion or access request that touches an embedding index

The RAG trust boundaries

Boundary Question to ask Failure if unguarded
Ingestion → index Who can write to the corpus? Poisoned documents steer every future answer
Query → retrieval Is authorization enforced inside the vector query? Cross-user / cross-tenant document leakage
Retrieved chunks → context Is retrieved text treated as untrusted input? Indirect prompt injection at scale
Context → answer Must the answer be grounded in what was retrieved? Hallucinated claims with the authority of citations
Answer → user Do citations reveal more than the answer does? Metadata leaks about restricted documents

Read the full file on GitHub · 181 lines

Changes

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.

  1. 11d ago First seen · 181 lines · 84 tokens per session scan A 5422284169a5

Subscribe to this mod's changes

rag-security is a skill published in the GitHub repository GoldenWing-360/claude-security-skills (17 stars, last pushed 1mo ago), licensed MIT. It adds 84 tokens to every session and 3,282 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

AI & LLM Security

LLM and AI application security testing — prompt injection, jailbreak resistance, OWASP LLM Top 10 (2025), RAG and agent/tool-use security, model supply chain, and AI red teaming for authorized assessments.

Masriyan/Claude-Code-CyberSecurity-Skill · 50 tokens

markitdown

Convert heterogeneous documents and selected URIs to Markdown with Microsoft MarkItDown for text analysis, search, and LLM/RAG ingestion. Covers safe local conversion, streams, Office/PDF/data formats, batch workflows, plugins, vision OCR, Azure extraction, and the official MCP server.

K-Dense-AI/scientific-agent-skills · 61 tokens

rag-architect

Designs and implements production-grade RAG systems by chunking documents, generating embeddings, configuring vector stores, building hybrid search pipelines, applying reranking, and evaluating retrieval quality. Use when building RAG systems, vector databases, or knowledge-grounded AI applications requiring semantic…

Jeffallan/claude-skills · 73 tokens

pgvector-semantic-search

Use this skill for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search. Trigger when user asks to: Store or search vector embeddings in PostgreSQL Set up semantic search, similarity search, or nearest neighbor search Create HNSW or IVFFlat indexes for vectors…

timescale/pg-aiguide · 190 tokens

postgres-hybrid-text-search

Use this skill to implement hybrid search combining BM25 keyword search with semantic vector search using Reciprocal Rank Fusion (RRF). Trigger when user asks to: Combine keyword and semantic search Implement hybrid search or multi-modal retrieval Use BM25/pgtextsearch with pgvector together Implement RRF (Reciprocal…

timescale/pg-aiguide · 162 tokens

bedrock

AWS Bedrock foundation models for generative AI. Use when invoking foundation models, building AI applications, creating embeddings, configuring model access, or implementing RAG patterns.

itsmostafa/aws-agent-skills · 36 tokens