/rag-skills
RAG-specific best practices for LlamaIndex, ChromaDB, and Celery workers. Covers ingestion, retrieval, embeddings, and performance.
$ npx -y skills add llama-farm/llamafarm --skill rag-skills --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/rag-skills
Context preview
The summary Claude sees to decide when to auto-load this skill.
RAG-specific best practices for LlamaIndex, ChromaDB, and Celery workers. Covers ingestion, retrieval, embeddings, and performance.
SKILL.md
rag-skills.SKILL.mdname: rag-skills
description: RAG-specific best practices for LlamaIndex, ChromaDB, and Celery workers. Covers ingestion, retrieval, embeddings, and performance.
allowed-tools: Read, Grep, Glob
user-invocable: false
RAG Skills for LlamaFarm
Framework-specific patterns and code review checklists for the RAG component.
**Extends**: [python-skills](../python-skills/SKILL.md) - All Python best practices apply here.
Component Overview
| Aspect | Technology | Version | |--------|------------|---------| | Python | Python | 3.11+ | | Document Processing | LlamaIndex | 0.13+ | | Vector Storage | ChromaDB | 1.0+ | | Task Queue | Celery | 5.5+ | | Embeddings | Universal/Ollama/OpenAI | Multiple |
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, validationQuick Reference
| Topic | File | Key Points | |-------|------|------------| | LlamaIndex | [llamaindex.md](llamaindex.md) | Document parsing, chunking, node conversion | | ChromaDB | [chromadb.md](chromadb.md) | Collections, embeddings, distance metrics | | Celery | [celery.md](celery.md) | Task routing, error handling, worker config | | Performance | [performance.md](performance.md) | Batching, 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 = NoneComponent 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:
passRetrieval 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:
passEmbedder 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.
Read more
name: rag-skills description: RAG-specific best practices for LlamaIndex, ChromaDB, and Celery workers. Covers ingestion, retrieval, embeddings, and performance. allowed-tools: Read, Grep, Glob user-invocable: false
RAG Skills for LlamaFarm
Framework-specific patterns and code review checklists for the RAG component.
**Extends**: [python-skills](../python-skills/SKILL.md) - All Python best practices apply here.
Component Overview
| Aspect | Technology | Version | |--------|------------|---------| | Python | Python | 3.11+ | | Document Processing | LlamaIndex | 0.13+ | | Vector Storage | ChromaDB | 1.0+ | | Task Queue | Celery | 5.5+ | | Embeddings | Universal/Ollama/OpenAI | Multiple |
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, validationQuick Reference
| Topic | File | Key Points | |-------|------|------------| | LlamaIndex | [llamaindex.md](llamaindex.md) | Document parsing, chunking, node conversion | | ChromaDB | [chromadb.md](chromadb.md) | Collections, embeddings, distance metrics | | Celery | [celery.md](celery.md) | Task routing, error handling, worker config | | Performance | [performance.md](performance.md) | Batching, 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 = NoneComponent 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:
passRetrieval 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:
passEmbedder 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.
Enterprise AI capabilities on your own hardware. No cloud required. LlamaFarm is an open-source AI platform that runs entirely on your hardware.
Repo: llama-farm/llamafarm
Other skills on llamafarm.
- /cli-skills
CLI best practices for LlamaFarm. Covers Cobra, Bubbletea, Lipgloss patterns for Go CLI development.
Open skill - /code-review
Comprehensive code review for diffs. Analyzes changed code for security vulnerabilities, anti-patterns, and quality issues. Auto-detects domain (frontend/backend) from file paths.
Open skill - /commit-push-pr
Commit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks.
Open skill - /common-skills
Best practices for the Common utilities package in LlamaFarm. Covers HuggingFace Hub integration, GGUF model management, and shared utilities.
Open skill - /config-skills
Configuration module patterns for LlamaFarm. Covers Pydantic v2 models, JSONSchema generation, YAML processing, and validation.
Open skill - /designer-skills
Designer subsystem patterns for LlamaFarm. Covers React 18, TanStack Query, TailwindCSS, and Radix UI.
Open skill

