Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

rag-architecture

БесплатноБез исполняемых скриптовНе проверен

RAG system architecture and design decisions. Covers naive vs advanced vs agentic RAG, decision trees for RAG vs fine-tuning vs long context, production…

claude-dev-suiteот claude-dev-suite★ 51 звезда на GitHub

Об этом скилле

RAG Architecture

Three Architectural Tiers

Tier Components Best For Complexity
Naive RAG Chunk + embed + top-K + stuff Prototype, < 10k docs, homogeneous content Low
Advanced RAG + query rewriting, hybrid search, reranking, metadata filters Production, heterogeneous content, > 10k docs Medium
Agentic RAG + self-reflection, retrieval-as-tool, multi-hop, corrective fallback Complex research, multi-source synthesis, high-stakes answers High

Naive RAG Pipeline

[Docs] -> [Splitter] -> [Embedder] -> [Vector DB]
                                          |
[Query] -> [Embedder] -> [Top-K Search] --+-> [Prompt Stuffer] -> [LLM] -> [Answer]

Single failure mode: bad retrieval = bad answer. No recovery path. Works for well-scoped FAQ bots on small corpora.

Advanced RAG Pipeline

                          pre-retrieval         retrieval              post-retrieval
[Query] -> [Router] -> [Rewrite/HyDE/Multi-Q] -> [Hybrid Search] -> [Rerank] -> [Compress] -> [LLM]
                                                      |
                           [BM25] + [Dense Vector] + [Metadata Filter]

Each stage is independently replaceable and measurable. See query-transformations, hybrid-search, reranking.

Agentic RAG Pipeline

[Query] -> [Planner Agent]
             |
             v
       +-----+-----+-------------------+
       |           |                   |
   [Retrieve]  [Web Search]      [Code Tool]
       |           |                   |
       +-----+-----+-------------------+
             |
        [Critic / Self-reflection]
             |
       +-----+-----+
       |           |
    [Answer]  [Replan / More retrieval]

Dynamic step count, dynamic tool selection, self-correction. See agentic-rag.

Decision Tree: RAG vs Fine-Tuning vs Long Context

Is the knowledge dynamic (changes > monthly)?
  Yes -> RAG
  No  -> Continue
    |
    Is it style/format/persona (not facts)?
      Yes -> Fine-tuning (SFT or DPO)
      No  -> Continue
        |
        Does total corpus fit in 200k-1M tokens?
          Yes -> Long context with prompt caching (cheaper than RAG at small scale)
          No  -> RAG
            |
            Need factual grounding with citations?
              Yes -> RAG (mandatory for auditability)
              No  -> Hybrid: long context for recent + RAG for archive

Rules of thumb:

  • Under 500 KB of content: long context with prompt caching beats RAG on latency and quality.
  • Over 10 MB or changes weekly: RAG wins on cost and freshness.
  • Between: measure both.

Latency Budget (Production Target: < 3s P95)

Stage Budget Optimization
Query embedding 50-150ms Batch + local model for simple queries
Query rewriting (optional) 300-800ms Skip for short factual queries
Vector search (top-50) 20-100ms HNSW with ef_search tuned
BM25 search 10-50ms Parallel with vector search
Fusion (RRF) < 5ms In-memory
Reranking (top-50 -> top-5) 100-400ms Cohere/Voyage API or local BGE
LLM generation 1000-2000ms Streaming, prompt caching
Total 1500-3500ms

Parallelize embedding + BM25. Skip rewriting for short queries. Cache query embeddings for hot terms.

Production Component Diagram

                    +------------------+
                    |   Ingestion API  |
                    +--------+---------+
                             |
                 +-----------v------------+
                 | Chunker + Embedder     |
                 | (batch worker, queue)  |
                 +-----------+------------+
                             |
         +-------------------+---------------------+
         |                                         |
  +------v------+                          +-------v-------+
  |  Vector DB  |                          | Document Store|
  |  (HNSW)     |                          | (Postgres/S3) |
  +------+------+                          +-------+-------+
         |                                         |
         |    +------------------+                 |
         +----> Retrieval Service <----------------+
              | (hybrid + rerank)|
              +--------+---------+
                       |
              +--------v---------+
              |  LLM Gateway     |
              | (Claude/GPT)     |
              +--------+---------+
                       |
              +--------v---------+
              |   API / UI       |
              +------------------+

Separate the ingestion path from the query path. Never block queries on indexing.

Minimal Python Scaffold (Advanced RAG)

from dataclasses import dataclass
from langchain_anthropic import ChatAnthropic
from langchain_openai import OpenAIEmbeddings
from langchain_qdrant import QdrantVectorStore
from langchain_community.retrievers import BM25Retriever
from langchain.retrievers import EnsembleRetriever,
Полный SKILL.md на GitHub

Установить rag-architecture в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Write
Edit

FAQ

Что делает скилл rag-architecture?

RAG system architecture and design decisions. Covers naive vs advanced vs agentic RAG, decision trees for RAG vs fine-tuning vs long context, production topology, latency budgets, and component sequencing. USE WHEN: user mentions "RAG architecture", "RAG design", "naive RAG", "advanced RAG", "agentic RAG", "RAG vs fine-tuning", "RAG vs long context", "production RAG" DO NOT USE FOR: chunking details - use `chunking-strategies`; query rewriting - use `query-transformations`; retrieval algorithms - use `advanced-retrieval`; evaluation - use `rag-evaluation`; agent loops - use `agentic-rag`

Как установить скилл rag-architecture?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл rag-architecture запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить rag-architecture с