rag-patterns
Chunking strategies, embedding model selection, hybrid search, reranking, eval metrics
Skill by vibeeval
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/vibeeval-rag-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/rag-patterns
What's inside
- Skill name
rag-patterns- Description
- Chunking strategies, embedding model selection, hybrid search, reranking, eval metrics
- License
- MIT
- Instructions
- 164 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# RAG Patterns
## Chunking Strategies
```python
from langchain.text_splitter import RecursiveCharacterTextSplitter
# Strategy 1: Recursive character splitting (general purpose)
splitter = RecursiveCharacterTextSplitter(
chunk_size=512,
chunk_overlap=64,
separators=["\n\n", "\n", ". ", " ", ""],
length_function=len,
)
# Strategy 2: Semantic chunking (better coherence)
from langchain_experimental.text_splitter import SemanticChunker
from langchain_openai import OpenAIEmbeddings
semantic_splitter = SemanticChunker(
OpenAIEmbeddings(),
breakpoint_threshold_type="percentile",
breakpoint_threshold_amount=95,
)
# Strategy 3: Parent-child chunking (preserves context)
parent_splitter = RecursiveCharacterTextSplitter(chunk_size=2000, chunk_overlap=200)
child_splitter = RecursiveCharacterTextSplitter(chunk_size=400, chunk_overlap=50)
parent_docs = parent_splitter.split_documents(documents)
for parent in parent_docs:
children = child_splitter.split_documents([parent])
for child in children:
child.metadata["parent_id"] = parent.metadata["id"]
```
## Embedding Model Selection
```yaml
Models by Use Case:
General (English):
- text-embedding-3-small (OpenAI, 1536d, cheap)
- text-embedding-3-large (OpenAI, 3072d, best quality)
- all-MiniLM-L6-v2 (local, 384d, fast)
Code:
- text-embedding-3-large with code-tuned prompts
- voyage-code-2 (Voyage AI)
Multilingual:
- multilingual-e5-large (local)
- text-embedding-3-large (OpenAI)
Selection Criteria:
- Latency requirement < 50ms → local model
- Quality critical → text-embedding-3-large
- Budget constrained → text-embedding-3-small
- Air-gapped → all-MiniLM-L6-v2
```
## Hybrid Search (Vector + BM25)
```python
from rank_bm25 import BM25Okapi
import numpy as np
class HybridRetriever:
def __init__(self, vector_store, documents, alpha=0.5):
self.vector_store = vector_store
self.alpha = alpha # 0=BM25 only, 1=vector only
tokenized = [doc.page_content.lower().split() for doc in documents]
self.bm25 = BM25Okapi(tokenized)
self.documents = documents
def search(self, query: str, k: int = 10) -> list:
# Vector search
vector_results = self.vector_store.similarity_search_with_score(query, k=k)
vector_scores = {doc.metadata["id"]: score for doc, score in vector_results}
# BM25 search
bm25_scores_raw = self.bm25.get_scores(query.lower().split())
bm25_max = max(bm25_scores_raw) if max(bm25_scores_raw) > 0 else 1
bm25_scores = {
self.documents[i].metadata["id"]: score / bm25_max
for i, score in enumerate(bm25_scores_raw)
}
# Reciprocal Rank Fusion
all_ids = set(vector_scores) | set(bm25_scores)
fused = {}
for doc_id in all_ids:
v_score = vector_scores.get(doc_id, 0)
b_score = bm25_scores.get(doc_id, 0)
fused[doc_id] = self.alpha * v_score + (1 - self.alpha) * b_score
sorted_ids = sorted(fused, key=fused.get, reverse=True)[:k]
return [self._get_doc(did) for did in sorted_ids]
```
## Reranking
```python
from sentence_transformers import CrossEncoder
reranker = CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2")
def rerank(query: str, documents: list, top_k: int = 5) -> list:
pairs = [(query, doc.page_content) for doc in documents]
scores = reranker.predict(pairs)
ranked = sorted(zip(documents, scores), key=lambda x: x[1], reverse=True)
return [doc for doc, _ in ranked[:top_k]]
# Pipeline: retrieve 20 → rerank to 5
candidates = hybrid_retriever.search(query, k=20)
final = rerank(query, candidates, top_k=5)
```
## Evaluation Metrics
```python
def evaluate_rag(queries, expected_answers, retriever, generator):From vibeeval/vibecosystem, MIT.
More from vibeeval/vibecosystem
- 0.565score
codex-orchestration
vibeeval
OpenAI Codex CLI + Claude Code (Hizir) birlikte kullanim rehberi.
SkillBFreshness: B★ 540Claude Code +9 - 0.562score
plan-agent
vibeeval
Planning agent that creates implementation plans and handoffs from conversation context
SkillBFreshness: B★ 540Claude Code +9 - 0.559score
help
vibeeval
Interactive workspace discovery - learn what tools, workflows, agents, and hooks are available
SkillBFreshness: B★ 540Claude Code +9 - 0.559score
explore
vibeeval
Meta-skill for internal codebase exploration at varying depths (quick/deep/architecture)
SkillBFreshness: B★ 540Claude Code +9 - 0.559score
cli-reference
vibeeval
Claude Code CLI commands, flags, headless mode, and automation patterns
SkillBFreshness: B★ 540Claude Code +9 - 0.524score
tdd-workflow
vibeeval
Use this skill when writing new features, fixing bugs, or refactoring code.
SkillCFreshness: C★ 540Claude Code +9 - 0.522score
kotlin-patterns
vibeeval
Coroutine patterns, Flow operators, Jetpack Compose state management, Ktor routing, and Kotlin Multiplatform shared code.
SkillCFreshness: C★ 540Claude Code +9 - 0.522score
compliance-patterns
vibeeval
GDPR data handling, audit logging, data classification, retention policies, and consent management for regulatory compliance.
SkillCFreshness: C★ 540Claude Code +9 - 0.522score
feature-flag-patterns
vibeeval
Gradual rollout strategies, kill switches, A/B testing integration, flag lifecycle management, and technical debt prevention.
SkillCFreshness: C★ 540Claude Code +9 - 0.522score
aws-patterns
vibeeval
Lambda best practices, S3 event patterns, SQS/SNS fanout, and DynamoDB access patterns for serverless AWS architectures.
SkillCFreshness: C★ 540Claude Code +9 - 0.522score
experiment-engine
vibeeval
Otonom deney dongusu.
SkillCFreshness: C★ 540Claude Code +9 - 0.522score
grpc-patterns
vibeeval
Protobuf schema design, streaming patterns, interceptor chains, deadline propagation, and error handling for gRPC services.
SkillCFreshness: C★ 540Claude Code +9
Signals
- Stars
- 540
- Forks
- 44
- Open issues
- 5
- Last commit (this folder)
- Jun 10, 2026 (4 months ago)
- Last release
- Apr 12, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/vibeeval/vibecosystem
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from vibeeval
- 0.565score
codex-orchestration
vibeeval
OpenAI Codex CLI + Claude Code (Hizir) birlikte kullanim rehberi.
SkillBFreshness: B★ 540Claude Code +9 - 0.562score
plan-agent
vibeeval
Planning agent that creates implementation plans and handoffs from conversation context
SkillBFreshness: B★ 540Claude Code +9 - 0.559score
help
vibeeval
Interactive workspace discovery - learn what tools, workflows, agents, and hooks are available
SkillBFreshness: B★ 540Claude Code +9 - 0.559score
cli-reference
vibeeval
Claude Code CLI commands, flags, headless mode, and automation patterns
SkillBFreshness: B★ 540Claude Code +9 - 0.559score
explore
vibeeval
Meta-skill for internal codebase exploration at varying depths (quick/deep/architecture)
SkillBFreshness: B★ 540Claude Code +9 - 0.524score
tdd-workflow
vibeeval
Use this skill when writing new features, fixing bugs, or refactoring code.
SkillCFreshness: C★ 540Claude Code +9
Cite this page
rag-patterns skill. Agent Mart. https://agentmart.dev/skills/vibeeval-rag-patterns (last updated 2026-10-24)