rag-architecture

rag-architecture is a skill for Claude Code, Codex from j4flmao/agent-skills. It costs 0 tokens per session (907 once invoked), scanned A, original, MIT.

A guide to building retrieval-augmented generation systems, which let an AI find relevant information from a collection before producing an answer. It covers vector indexes, including graph-based and compressed search methods.

In plain words
What is it for?
Designing vector databases and search indexes for systems that retrieve relevant documents or data before generating responses.
Why use it?
It explains how to organize and search large collections of embedded text so retrieval can be designed around speed, space use, and result quality.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Designing vector databases and search indexes for systems that retrieve relevant documents or data before generating responses.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/rag-architecture"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/rag-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 907 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.00000 $0.00907
Opus 5 $0.00000 $0.00453
Sonnet 5 $0.00000 $0.00181
Haiku 4.5 $0.00000 $0.00091

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

Security

Grade A, and why

rag-architecture 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 10d 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/llm-engineering/rag-architecture/SKILL.md · 56 lines

How it starts

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

Advanced RAG Architecture: Algorithmic Foundations and Compilational Paradigms

1. Vector Database Indexing Mechanics

1.1 Hierarchical Navigable Small World (HNSW) Graphs

HNSW operates as a multi-layered proximity graph where each layer constitutes a skip-list-esque representation of the vector space. The construction involves stochastic insertion with an exponentially decaying probability of promotion to higher layers.

  • Search Complexity: O(log N)
  • Routing Paradigm: Search initiates at the topmost layer $L$, identifying the local minimum (nearest neighbor) using greedy search. This node serves as the entry point for layer $L-1$. The search progresses iteratively down to layer 0 (containing all elements).
  • Edge Heuristics: To prevent exponential edge growth and maintain small-world properties, neighborhood pruning is employed based on distance heuristics rather than strict K-NN, ensuring diverse connectivity.

1.2 Inverted File Index with Product Quantization (IVF-PQ)

IVF-PQ relies on two distinct mechanisms: space partitioning (IVF) and vector compression (PQ).

  • IVF (Coarse Quantization): The vector space is partitioned into $K$ Voronoi cells using k-means clustering. A query is first routed to the nearest $nprobe$ centroids, drastically reducing the search space from $N$ to $N \times (nprobe/K)$.
  • PQ (Fine Quantization): Sub-vector decomposition. A $D$-dimensional vector is split into $M$ sub-vectors of dimension $D/M$. Each sub-space is independently clustered into $2^B$ sub-centroids (typically $B=8$). Distances are approximated using pre-computed lookup tables (Asymmetric Distance Computation), enabling exhaustive search within Voronoi cells at high throughput.

2. Dynamic Retrieval Paradigms: Self-RAG and DSPy

2.1 Self-RAG (Self-Reflective Retrieval-Augmented Generation)

An LM is explicitly trained (or prompted) to output reflection tokens alongside the generative sequence.

  • [Retrieve] Token: Determines necessity of exogenous context (on-demand retrieval).
  • [ISREL] Token: Evaluates the relevance of retrieved passages to the context.
  • [ISSUP] Token: Verifies if the generated proposition is directly entailed by the retrieved passage, preventing hallucination.
  • [ISUSE] Token: Assesses overall utility. Inference involves a critique-guided decoding strategy where trajectories with optimal reflection token probabilities are prioritized.

Read the full file on GitHub · 56 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. 10d ago First seen · 56 lines · 0 tokens per session scan A 816bcd328fa9

Subscribe to this mod's changes

rag-architecture is a skill published in the GitHub repository j4flmao/agent-skills (22 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 907 tokens. 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

agent-platform-rag-engine-management

Manage and query Agent Platform RAG Engine Corpora and retrieve grounded contexts using the Google GenAI SDK. Use when listing RAG corpora or files, inspecting a corpus, retrieving contexts, or generating content grounded in a RAG corpus. Do not use for standard database queries (use SQL/Spanner skills), Google…

google/skills · 85 tokens

llm-app-patterns

Production-ready patterns for building LLM applications. Covers RAG pipelines, agent architectures, prompt IDEs, and LLMOps monitoring. Use when designing AI applications, implementing RAG, building agents, or setting up LLM observability.

davila7/claude-code-templates · 54 tokens

9router-embeddings

Generate vector embeddings via 9Router /v1/embeddings using OpenAI / Gemini / Mistral / Voyage / Nvidia / GitHub embedding models for RAG, semantic search, similarity. Use when the user wants embeddings, vectors, RAG, semantic search, or to embed text.

decolua/9router · 66 tokens

azure-search-documents-dotnet

Azure AI Search SDK for .NET (Azure.Search.Documents). Use for building search applications with full-text, vector, semantic, and hybrid search. Covers SearchClient (queries, document CRUD), SearchIndexClient (index management), and SearchIndexerClient (indexers, skillsets). Triggers: "Azure Search .NET"…

microsoft/skills · 102 tokens

browserwing-admin

Manage and operate BrowserWing — an intelligent browser automation platform. Install dependencies, configure LLM, create/manage/execute automation scripts, use AI-driven exploration to generate scripts, browse the script marketplace, and troubleshoot issues.

MemTensor/MemOS · 47 tokens

embedding-strategies

Select and optimize embedding models for semantic search and RAG applications. Use when choosing embedding models, implementing chunking strategies, or optimizing embedding quality for specific domains.

foryourhealth111-pixel/Vibe-Skills · 37 tokens