Provides best practices and code standards for RAG applications.

Install

mkdir -p .claude/skills/rag-skills && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1723" && unzip -o skill.zip -d .claude/skills/rag-skills && rm skill.zip

Installs to .claude/skills/rag-skills

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

RAG-specific best practices for LlamaIndex, ChromaDB, and Celery workers. Covers ingestion, retrieval, embeddings, and performance.
131 charsno explicit “when” trigger
Advanced

Key capabilities

  • Ingest documents with safety checks
  • Configure vector store retrieval
  • Implement Celery task routing
  • Apply circuit breaker patterns to embedders

How it works

It provides abstract base classes and patterns for document processing, embedding generation with circuit breakers, and task-based retrieval workflows.

Inputs & outputs

You give it
Raw documents or query parameters
You get back
Processed embeddings or retrieval results

When to use rag-skills

  • Ingesting documents
  • Configuring vector store retrieval
  • Optimizing Celery tasks for RAG

About this skill

RAG Skills for LlamaFarm

Framework-specific patterns and code review checklists for the RAG component.

Extends: python-skills - All Python best practices apply here.

Component Overview

AspectTechnologyVersion
PythonPython3.11+
Document ProcessingLlamaIndex0.13+
Vector StorageChromaDB1.0+
Task QueueCelery5.5+
EmbeddingsUniversal/Ollama/OpenAIMultiple

Directory Structure

rag/
├── api.py                 # Search and database APIs
├── celery_app.py          # Celery configuration
├── main.py                # Entry point
├── core/
│   ├── base.py            # Document, Component, Pipeline ABCs
│   ├── factories.py       # Component factories
│   ├── ingest_handler.py  # File ingestion with safety checks
│   ├── blob_processor.py  # Binary file processing
│   ├── settings.py        # Pydantic settings
│   └── logging.py         # RAGStructLogger
├── components/
│   ├── embedders/         # Embedding providers
│   ├── extractors/        # Metadata extractors
│   ├── parsers/           # Document parsers (LlamaIndex)
│   ├── retrievers/        # Retrieval strategies
│   └── stores/            # Vector stores (ChromaDB, FAISS)
├── tasks/                 # Celery tasks
│   ├── ingest_tasks.py    # File ingestion
│   ├── search_tasks.py    # Database search
│   ├── query_tasks.py     # Complex queries
│   ├── health_tasks.py    # Health checks
│   └── stats_tasks.py     # Statistics
└── utils/
    └── embedding_safety.py  # Circuit breaker, validation

Quick Reference

TopicFileKey Points
LlamaIndexllamaindex.mdDocument parsing, chunking, node conversion
ChromaDBchromadb.mdCollections, embeddings, distance metrics
Celerycelery.mdTask routing, error handling, worker config
Performanceperformance.mdBatching, caching, deduplication

Core Patterns

Document Dataclass

from dataclasses import dataclass, field
from typing import Any

@dataclass
class Document:
    content: str
    metadata: dict[str, Any] = field(default_factory=dict)
    id: str = field(default_factory=lambda: str(uuid.uuid4()))
    source: str | None = None
    embeddings: list[float] | None = None

Component Abstract Base Class

from abc import ABC, abstractmethod

class Component(ABC):
    def __init__(
        self,
        name: str | None = None,
        config: dict[str, Any] | None = None,
        project_dir: Path | None = None,
    ):
        self.name = name or self.__class__.__name__
        self.config = config or {}
        self.logger = RAGStructLogger(__name__).bind(name=self.name)
        self.project_dir = project_dir

    @abstractmethod
    def process(self, documents: list[Document]) -> ProcessingResult:
        pass

Retrieval Strategy Pattern

class RetrievalStrategy(Component, ABC):
    @abstractmethod
    def retrieve(
        self,
        query_embedding: list[float],
        vector_store,
        top_k: int = 5,
        **kwargs
    ) -> RetrievalResult:
        pass

    @abstractmethod
    def supports_vector_store(self, vector_store_type: str) -> bool:
        pass

Embedder with Circuit Breaker

class Embedder(Component):
    DEFAULT_FAILURE_THRESHOLD = 5
    DEFAULT_RESET_TIMEOUT = 60.0

    def __init__(self, ...):
        super().__init__(...)
        self._circuit_breaker = CircuitBreaker(
            failure_threshold=config.get("failure_threshold", 5),
            reset_timeout=config.get("reset_timeout", 60.0),
        )
        self._fail_fast = config.get("fail_fast", True)

    def embed_text(self, text: str) -> list[float]:
        self.check_circuit_breaker()
        try:
            embedding = self._call_embedding_api(text)
            self.record_success()
            return embedding
        except Exception as e:
            self.record_failure(e)
            if self._fail_fast:
                raise EmbedderUnavailableError(str(e)) from e
            return [0.0] * self.get_embedding_dimension()

Review Checklist Summary

When reviewing RAG code:

  1. LlamaIndex (Medium priority)

    • Proper chunking configuration
    • Metadata preservation during parsing
    • Error handling for unsupported formats
  2. ChromaDB (High priority)

    • Thread-safe client access
    • Proper distance metric selection
    • Metadata type compatibility
  3. Celery (High priority)

    • Task routing to correct queue
    • Error logging with context
    • Proper serialization
  4. Performance (Medium priority)

    • Batch processing for embeddings
    • Deduplication enabled
    • Appropriate caching

See individual topic files for detailed checklists with grep patterns.

When not to use it

  • General Python tasks unrelated to RAG components

Prerequisites

Python 3.11+LlamaIndex 0.13+ChromaDB 1.0+Celery 5.5+

Limitations

  • Strict dependency on specific framework versions
  • Requires adherence to defined directory structure

How it compares

It enforces specific architectural patterns for RAG components, whereas generic Python code lacks the necessary structure for reliable document ingestion and retrieval.

Compared to similar skills

rag-skills side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
rag-skills (this skill)67moNo flagsAdvanced
langchain268moReviewIntermediate
cocoindex69moReviewIntermediate
rag-implementation102moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

langchain

zechenzhangAGI

Framework for building LLM-powered applications with agents, chains, and RAG. Supports multiple providers (OpenAI, Anthropic, Google), 500+ integrations, ReAct agents, tool calling, memory management, and vector store retrieval. Use for building chatbots, question-answering systems, autonomous agents, or RAG applications. Best for rapid prototyping and production deployments.

26138

cocoindex

cocoindex-io

Comprehensive toolkit for developing with the CocoIndex library. Use when users need to create data transformation pipelines (flows), write custom functions, or operate flows via CLI or API. Covers building ETL workflows for AI data processing, including embedding documents into vector databases, building knowledge graphs, creating search indexes, or processing data streams with incremental updates.

6116

rag-implementation

wshobson

Build Retrieval-Augmented Generation (RAG) systems for LLM applications with vector databases and semantic search. Use when implementing knowledge-grounded AI, building document Q&A systems, or integrating LLMs with external knowledge bases.

10101

modal

davila7

Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.

587

senior-computer-vision

davila7

World-class computer vision skill for image/video processing, object detection, segmentation, and visual AI systems. Expertise in PyTorch, OpenCV, YOLO, SAM, diffusion models, and vision transformers. Includes 3D vision, video analysis, real-time processing, and production deployment. Use when building vision AI systems, implementing object detection, training custom vision models, or optimizing inference pipelines.

1256

llamaindex

davila7

Data framework for building LLM applications with RAG. Specializes in document ingestion (300+ connectors), indexing, and querying. Features vector indices, query engines, agents, and multi-modal support. Use for document Q&A, chatbots, knowledge retrieval, or building RAG pipelines. Best for data-centric LLM applications.

357

Search skills

Search the agent skills registry