rag-pipeline

rag-pipeline is a skill for Claude Code, Codex from param087/agent-ml-skills. It costs 40 tokens per session (730 once invoked), scanned A, original, MIT.

A guide for building retrieval-augmented generation (RAG) systems, which answer questions by finding relevant passages in your own documents and giving them to a language model.

In plain words
What is it for?
Use it to split documents into searchable parts, create embeddings, store and retrieve them, combine keyword and meaning-based search, rank results, assemble prompts, and evaluate answer quality.
Why use it?
It helps avoid answers based on the wrong document passages, a common cause of inaccurate or unsupported results. It also gives a structured way to improve retrieval and include source citations.

Skill for Claude CodeCodex

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

Good fit Use it to split documents into searchable parts, create embeddings, store and retrieve them, combine keyword and meaning-based search, rank results, assemble prompts, and evaluate answer quality.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/param087/agent-ml-skills/rag-pipeline"><img src="https://agentmods.dev/badge/skills/param087/agent-ml-skills/rag-pipeline.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 730 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.00040 $0.00730
Opus 5.5 $0.00016 $0.00292
Sonnet 5.5 $0.00008 $0.00146
Haiku 4.5 $0.00004 $0.00073

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

Security

Grade A, and why

rag-pipeline 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 2mo 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/rag-pipeline/SKILL.md · 78 lines

How it starts

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

RAG Pipeline

Overview

RAG grounds an LLM in your data by retrieving relevant context at query time. Most RAG quality problems are retrieval problems, not generation problems — if the right chunk isn't retrieved, no prompt can save the answer. Optimize retrieval first.

When to use

  • The model must answer over private/large/changing documents.
  • You need citations and reduced hallucination.
  • Fine-tuning is overkill or data changes too often.

Pipeline stages

  1. Ingest & chunk documents.
  2. Embed chunks → vector store.
  3. Retrieve (dense + sparse) for a query.
  4. Rerank top candidates.
  5. Assemble prompt with context + citations.
  6. Generate and evaluate.

Chunking

  • Start at ~500-1000 tokens with ~10-15% overlap.
  • Prefer semantic/structural boundaries (headings, paragraphs) over fixed char counts.
  • Keep metadata (source, title, section, URL) on every chunk for citations and filtering.

Embeddings & store

  • Choose an embedding model by your domain + the MTEB leaderboard; match it at query and index time.
  • Normalize vectors; use cosine similarity.
  • Vector stores: pgvector (already have Postgres), Qdrant/Weaviate/Milvos (scale), FAISS (local/offline).

Hybrid retrieval + reranking (the biggest quality lever)

# 1. Dense (semantic) + 2. Sparse (BM25 keyword) -> union
dense_hits  = vstore.search(embed(query), k=20)
sparse_hits = bm25.search(query, k=20)
candidates  = dedupe(dense_hits + sparse_hits)

# 3. Cross-encoder rerank for precision
from sentence_transformers import CrossEncoder
reranker = CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2")
ranked = sorted(candidates,
                key=lambda c: reranker.predict([(query, c.text)]),
                reverse=True)[:5]

Prompt assembly

  • Insert only the top-k reranked chunks; respect the context window.
  • Instruct: "Answer only from the context; if it's not there, say you don't know."
  • Require inline citations to chunk metadata so answers are auditable.

Read the full file on GitHub · 78 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. 2mo ago First seen · 78 lines · 40 tokens per session scan A 13a9ed60dd43

Subscribe to this mod's changes

rag-pipeline is a skill published in the GitHub repository param087/agent-ml-skills (13 stars, last pushed 5mo ago), licensed MIT. It adds 40 tokens to every session and 730 once invoked, about $0.0002 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-31.

Related

rag-pipeline compared with skills from other repositories

rag-pipeline next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rag-pipelineparam087/agent-ml-skillsSkill135mo agoMITA40Claude Code, Codex
9router-embeddingsdecolua/9routerSkill32k9d agoMITA66Claude Code, Codex
mongodb-search-and-aifcakyon/claude-codex-settingsSkill1.2kyesterdayApache-2.0A210Claude Code
llm-application-devMoizIbnYousaf/Ai-Agent-SkillsSkill1.2k1mo agoMITA40Claude Code, Codex
qdrant-model-migrationqdrant/skillsSkill267yesterdayApache-2.0A88Claude Code
qdrant-multitenancyqdrant/skillsSkill267yesterdayApache-2.0A109Claude Code
qdrant-search-speed-optimizationqdrant/skillsSkill267yesterdayApache-2.0A78Claude Code