rag

rag is a skill for Claude Code from skillmds/skillmd. It costs 44 tokens per session (1,489 once invoked), scanned A, a copy of rag, MIT.

A guide for building retrieval-augmented generation systems, which find relevant external documents before an AI model writes an answer. It covers splitting documents, creating embeddings, storing vectors, and retrieving matching information.

In plain words
What is it for?
Use it to build document question-answering tools, semantic search, documentation assistants, and chatbots grounded in retrieved sources.
Why use it?
It helps AI applications use a knowledge base or private documents instead of relying only on information in the model's training.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the data-ml plugin — 17 skills shipped together

Good fit Use it to build document question-answering tools, semantic search, documentation assistants, and chatbots grounded in retrieved sources.

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

Made for: Claude Code.

Or install data-ml, the plugin that ships this one along with the rest of its 17 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/skillmds/skillmd/rag/github.svg)](https://agentmods.dev/skills/skillmds/skillmd/rag)
Your own site
<a href="https://agentmods.dev/skills/skillmds/skillmd/rag"><img src="https://agentmods.dev/badge/skills/skillmds/skillmd/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/skillmds/skillmd/rag"><img src="https://agentmods.dev/badge/skills/skillmds/skillmd/rag.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,489 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 100% copy Near-identical to another mod 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.00044 $0.01489
Opus 5.5 $0.00018 $0.00596
Sonnet 5 $0.00009 $0.00298
Haiku 4.5 $0.00004 $0.00149

Measured 4d ago against content hash d9b018ad958b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-23, 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 4d 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.

Origin

This is a copy

100% identical to rag — 1 line differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/data-ml/skills/rag/SKILL.md · 209 lines

How it starts

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

RAG Implementation

Build Retrieval-Augmented Generation systems that extend AI capabilities with external knowledge sources.

Overview

This skill covers: document processing, embedding generation, vector storage, retrieval configuration, and RAG pipeline implementation.

When to Use

  • Building Q&A systems over proprietary documents
  • Creating chatbots with factual information from knowledge bases
  • Implementing semantic search with natural language queries
  • Reducing hallucinations with grounded, sourced responses
  • Building documentation assistants and research tools
  • Enabling AI systems to access domain-specific knowledge

Instructions

Step 1: Choose Vector Database

Select based on your requirements:

Requirement Recommended
Production scalability Pinecone, Milvus
Open-source Weaviate, Qdrant
Local development Chroma, FAISS
Hybrid search Weaviate with BM25

Step 2: Select Embedding Model

Use Case Model
General purpose text-embedding-ada-002
Fast and lightweight all-MiniLM-L6-v2
Multilingual e5-large-v2
Best performance bge-large-en-v1.5

Step 3: Implement Document Processing Pipeline

  1. Load documents from source (file system, database, API)
  2. Clean and preprocess (remove formatting, normalize text)
  3. Split documents into chunks with appropriate strategy
  4. Generate embeddings for each chunk
  5. Store embeddings in vector database with metadata

Validation: Verify embeddings were generated successfully:

List<Embedding> embeddings = embeddingModel.embedAll(segments);
if (embeddings.isEmpty() || embeddings.get(0).dimension() != expectedDim) {
    throw new IllegalStateException("Embedding generation failed");
}

Step 4: Configure Retrieval Strategy

Choose the appropriate strategy:

  • Dense Retrieval: Semantic similarity via embeddings (default for most cases)
  • Hybrid Search: Dense + sparse retrieval for better coverage
  • Metadata Filtering: Filter by document attributes
  • Reranking: Cross-encoder reranking for high-precision requirements

Read the full file on GitHub · 209 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago First seen · 209 lines · 44 tokens per session scan A d9b018ad958b

Subscribe to this mod's changes

rag is a skill published in the GitHub repository skillmds/skillmd (1 stars, last pushed yesterday), licensed MIT. It adds 44 tokens to every session and 1,489 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to rag, differing in 1 line, and is treated as a copy.

Related

Other skills, from other repositories

molecular-rag

Retrieve structurally similar compounds with known properties from ChEMBL/ZINC to ground predictions and inform optimization. Based on MolRAG (Xian 2025, ACL).

synthetic-sciences/openscience · 40 tokens

bailian-cli

A command-line hub for Alibaba Cloud Bailian and DashScope resources. It covers applications, models, knowledge bases, usage, authentication, files, MCP services, pipelines, and installing or updating related agent skills.

modelstudioai/cli · 350 tokens

bailian-kb

A command-line manager for Alibaba Cloud Bailian knowledge bases, which are collections of documents prepared for search and question answering. It handles the stored documents, search services, text chunks, and data-centre files rather than everyday searches.

modelstudioai/cli · 234 tokens

sqlite-vec-skilld

ALWAYS use when writing code importing "sqlite-vec". Consult for debugging, best practices, or modifying sqlite-vec, sqlite vec.

skilld-dev/skilld · 35 tokens

llm-application-dev

Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration. Use for AI-powered features, chatbots, or LLM-based automation.

MoizIbnYousaf/Ai-Agent-Skills · 40 tokens

gno

Search local documents, files, notes, and knowledge bases. Index directories, search with BM25/vector/hybrid, get AI answers with citations. Use when user wants to search files, find documents, query notes, look up information in local folders, index a directory, set up document search, build a knowledge base, needs…

gmickel/gno · 86 tokens