rag

rag is a skill for Claude Code from nimadorostkar/Claude-Skills-collection. It costs 97 tokens per session (1,504 once invoked), scanned A, original, MIT.

A guide to retrieval-augmented generation, a way to answer questions by first finding relevant passages in a document collection. It covers splitting documents, searching, ranking results, citations, and testing answer quality.

In plain words
What is it for?
Use it when building document question-answering, adding citations, improving search, or evaluating whether an AI answer is grounded in evidence.
Why use it?
It helps separate errors caused by finding the wrong information from errors caused by using the information incorrectly, reducing unsupported answers.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the ai plugin — 12 skills shipped together

Good fit Use it when building document question-answering, adding citations, improving search, or evaluating whether an AI answer is grounded in evidence.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nimadorostkar/claude-skills-collection/rag
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 nimadorostkar/Claude-Skills-collection --skill rag
Clone the repo
git clone --depth 1 https://github.com/nimadorostkar/Claude-Skills-collection

Made for: Claude Code.

Or install ai, the plugin that ships this one along with the rest of its 12 skills.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/rag"><img src="https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/rag.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 97 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,504 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00097 $0.01504
Opus 5.5 $0.00039 $0.00602
Sonnet 5.5 $0.00019 $0.00301
Haiku 4.5 $0.00010 $0.00150

Measured 1mo ago against content hash 6c160619cafa, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rag 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 1mo 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.

skills/ai/rag/SKILL.md · 131 lines

How it starts

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

Retrieval-Augmented Generation

Purpose

Build a RAG system whose answers are grounded in retrieved evidence, and be able to tell — when an answer is wrong — whether the retriever failed to find the right document or the generator failed to use it.

When to Use

  • Building question answering over a document corpus.
  • A RAG system that returns confident, wrong answers.
  • Choosing chunking, embedding, and retrieval strategy.
  • Adding citation and grounding to a generative feature.

Capabilities

  • Chunking strategies and their trade-offs.
  • Embedding selection and hybrid (dense + sparse) retrieval.
  • Reranking and query rewriting.
  • Grounding, citation, and refusal when evidence is absent.
  • Component-wise evaluation.

Inputs

  • The corpus: its size, structure, and update frequency.
  • The query patterns: factual lookup, comparison, summarization, multi-hop.
  • Accuracy requirements and the cost of a wrong answer.

Outputs

  • A retrieval pipeline with a measured recall figure.
  • Answers with citations to the retrieved passages.
  • Separate evaluation of retrieval quality and generation quality.

Workflow

  1. Evaluate retrieval separately — Before touching the prompt. If the correct passage is not in the top-k, no amount of prompt engineering will produce a correct answer. Measure recall@k first.
  2. Chunk on semantic boundaries — Sections, paragraphs, or logical units. Fixed-size chunking splits a table in half and produces two useless chunks. Add overlap so a fact spanning a boundary is not lost.
  3. Retrieve hybrid — Dense embeddings find semantic matches; BM25 finds exact terms, product codes, and names. Neither alone is sufficient; the combination materially outperforms both.
  4. Rerank the candidates — Retrieve 50, rerank with a cross-encoder, pass the top 5. Reranking is the single highest-value addition to a naive RAG pipeline.
  5. Ground the generation — Instruct the model to answer only from the provided context, to cite the passage for each claim, and to say it does not know when the context does not contain the answer.
  6. Diagnose failures by component — For each wrong answer: was the right passage retrieved? If no, it is a retrieval problem. If yes, it is a generation problem. These have completely different fixes.

Read the full file on GitHub · 131 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. 1mo ago Changed · +55 tokens per session 6c160619cafa
  2. 3mo ago First seen · 131 lines · 42 tokens per session scan A 1951b5c8b310

Subscribe to this mod's changes

rag is a skill published in the GitHub repository nimadorostkar/Claude-Skills-collection (41 stars, last pushed today), licensed MIT. It adds 97 tokens to every session and 1,504 once invoked, about $0.0004 per session on Opus 5.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

rag compared with skills from other repositories

rag next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
ragnimadorostkar/Claude-Skills-collectionSkill41todayMITA97Claude Code
rag-design-docmohitagw15856/pm-claude-skillsSkill1.6ktodayMITA92Claude Code
rag-architecture-reviewmohitagw15856/pm-claude-skillsSkill1.6ktodayMITA89Claude Code
ai-productlingxling/awesome-skills-cnSkill3411mo agoMITA28Claude Code
speckit.ai-engineerwedabro/bro-skillsSkill31mo agoMITB35Claude Code, Codex
ai-pipeline-orchestrationlingxling/awesome-skills-cnSkill3411mo agoMITA39Claude Code
ai-engineering-toolkitlingxling/awesome-skills-cnSkill3411mo agoMITA47Claude Code