Skip to main content
skill Claude Code

rag-architect — Claude Code skill: RAG design

Design a RAG pipeline around your documents, then measure retrieval quality. Use it to explore chunking strategies, embeddings, or vector databases.

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add alirezarezvani/claude-skills
/plugin install engineering-advanced-skills@claude-code-skills
Open on GitHub

What rag-architect does

The skill starts with chunking_optimizer.py on your document corpus, then uses a JSON requirements file with rag_pipeline_designer.py to produce a pipeline design. For evaluation, provide queries and relevant-document labels; retrieval_evaluator.py reports precision@k, recall@k, MRR, and NDCG@k. Poor examples guide the next change, one variable at a time.

The package also includes chunking strategy comparisons, embedding benchmark methodology, and a guide to RAG evaluation metrics. Its tools require python3; evaluation needs queries.json, the documents, and ground_truth.json. Check current provider information before relying on model or pricing recommendations. Install it when you can test against your own corpus and measure results. It is not intended for general LLM cost tuning.

What it helps with

  • choose a chunking strategy for a document corpus
  • design a RAG pipeline from stated requirements
  • compare embedding tiers and vector databases
  • measure precision@k, recall@k, and NDCG@k
  • inspect queries with poor retrieval precision or recall

Example prompts for the agent

  • Design a RAG system for these docs and show me sample chunks.
  • Evaluate my retriever using `queries.json` and `ground_truth.json`.
  • Run `chunking_optimizer.py` on this corpus and recommend a chunking strategy.

How to install rag-architect

1Plugin marketplace

/plugin marketplace add alirezarezvani/claude-skills
/plugin install engineering-advanced-skills@claude-code-skills

This installs the whole engineering-advanced-skills plugin with all its skills

2Skills CLI (Vercel)

npx skills add alirezarezvani/claude-skills --skill rag-architect -a claude-code

3Manually: put the files in place

~/.claude/skills/rag-architect/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/rag-architect/

From the same set349

The whole set →
engineering-skills Alireza Rezvani An engineering skill index for Claude Code that helps you select one specialist SKILL.md for the task at hand. It covers architecture, testing, DevOps, and data work. Claude Code 2,387installs finance-skills Alireza Rezvani Routes ambiguous finance prompts to the right bundled skill: financial-analyst, saas-metrics-coach, or month-end-close. Claude Code 2,312installs marketing-skills Alireza Rezvani A directory and router for marketing skills in Claude Code. It picks the right specialist skill for SEO, content, CRO, channels, and related tasks. Claude Code 2,264installs business-growth-skills Alireza Rezvani Routes growth and revenue prompts to the right specialized skill across customer success, sales engineering, RevOps, and proposals in Claude Code. Claude Code 2,189installs engineering-advanced-skills Alireza Rezvani An index of 37 engineering skills for architecture, automation, reliability, and platform work. Use it when a project needs task-specific engineering workflows. Claude Code 2,019installs product-skills Alireza Rezvani Product work orchestrator for Claude Code. Routes queries across 16 domain lanes and validates discovery trees with deterministic scripts. Claude Code 1,994installs pm-skills Alireza Rezvani Routes project-delivery requests across 8 PM sub-skills for Jira, Confluence, sprints, reporting, and team communication. Useful for controlled delivery work. Claude Code 1,975installs senior-backend Alireza Rezvani Scaffolds backend APIs, detects database bottlenecks, and runs load tests. Useful when designing Express routes, optimizing PostgreSQL, or preparing for production. Claude Code 1,674installs

Similar

Questions about rag-architect

How do I install rag-architect in Claude Code?

Add the marketplace with /plugin marketplace add alirezarezvani/claude-skills, then install the skill with /plugin install engineering-advanced-skills@claude-code-skills. You can also run npx skills add alirezarezvani/claude-skills --skill rag-architect -a claude-code.

What does rag-architect do?

It helps select a chunking strategy, design a RAG pipeline, and evaluate retrieval against labeled queries. The evaluator reports precision@k, recall@k, MRR, and NDCG@k.

What do I need to evaluate retrieval quality?

Provide queries.json with your queries, the documents, and ground_truth.json with relevant document IDs. Run the evaluation with retrieval_evaluator.py.

Source text

SKILL.md · MIT
---
name: "rag-architect"
description: "Use when the user asks to design a RAG pipeline, choose a chunking strategy or embedding model, pick a vector database, or evaluate retrieval quality (precision@k, recall@k, NDCG). Examples: 'design a RAG system for our docs', 'what chunk size should I use for this corpus', 'evaluate my retriever against ground truth'. NOT for general LLM cost tuning (use llm-cost-optimizer) or agent loops over retrieval (use agenthub)."
---

# RAG Architect

Design, tune, and evaluate production RAG pipelines with three deterministic tools. Run the tools against the actual corpus and requirements — do not pick chunk sizes or databases by intuition.

## Hard rules

1. **Never present model names or vendor prices as current facts.** Embedding models and vector-DB pricing rot in months. Recommend a *tier* (see table below), name a current-generation candidate, and tell the user to verify against the provider's live pricing page.
2. **Every design ends with an evaluation run.** A RAG design without `retrieval_evaluator.py` numbers is a hypothesis, not a deliverable.
3. **Chunking is corpus-driven.** Run `chunking_optimizer.py` on the real documents before choosing a strategy.

## Embedding model tiers (pattern, not price list)

| Tier | Current-generation examples (verify before use) | When |
|---|---|---|
| Fast / self-hosted | `all-MiniLM-L6-v2`, `bge-small` | Cost-sensitive, small scale, real-time |
| Balanced open | `all-mpnet-base-v2`, `bge-large`, `e5-large` | Quality without API dependency |
| Quality API | `text-embedding-3-large`, `voyage-3-large` | Accuracy-priority general retrieval |
| Code | `voyage-code-3`, CodeBERT-family | Code search corpora |

**Pricing discipline:** build the cost model with a placeholder table — columns `model | $/1M tokens (verify) | dims | as-of date` — and have the user fill in live numbers. Same for vector DBs (Pinecone/Weaviate/Qdrant/Chroma/pgvector): the selection criteria (managed vs self-hosted, scale, filtering, existing Postgres) are durable; the dollar figures are not.

## Workflow

All paths relative to this skill folder. Outputs chain: corpus analysis → design → evaluation.

### 1. Analyze the corpus and pick chunking

```bash
python3 chunking_optimizer.py /path/to/docs --extensions .md .txt -o chunking.json
```

Emits `chunking.json` with `corpus_info`, per-strategy `strategy_results`, a `recommendation`, and `sample_chunks`. Use `recommendation.strategy` and its config; show the user 2-3 `sample_chunks` so they can sanity-check boundaries.

### 2. Design the pipeline from requirements

Write a requirements JSON with these keys (all required): `document_types[]`, `document_count`, `avg_document_size` (chars), `queries_per_day`, `query_patterns[]`, `latency_requirement`, `budget_monthly`, `accuracy_priority` (0-1), `cost_priority` (0-1), `maintenance_complexity`.

```bash
python3 rag_pipeline_designer.py requirements.json -o design.json
```

Emits `design.json` with `chunking`, `embedding`, `vector_db`, `retrieval`, `reranking`, `evaluation`, `total_cost`, `architecture_diagram` (mermaid), and `config_templates`. Present the diagram; label every `cost_monthly` figure as an estimate to verify (rule 1).

### 3. Evaluate retrieval quality

Prepare `queries.json` (list of `{id, text}` or `{"queries": [...]}`) and `ground_truth.json` (`{query_id: [relevant_doc_ids]}`), then:

```bash
python3 retrieval_evaluator.py queries.json /path/to/docs ground_truth.json --k-values 3 5 10 -o eval.json
```

Reports precision@k, recall@k, MRR, NDCG@k, plus `poor_precision_examples` / `poor_recall_examples` for failure analysis.

### 4. Verification loop

The design is done only when:

1. `eval.json` meets targets — typical floors: precision@5 ≥ 0.8, recall@10 ≥ 0.85 (set per use case with the user).
2. If below target: inspect the poor-example lists, then change **one** variable (chunking strategy → re-run step 1; embedding tier; add reranking; hybrid retrieval) and re-run step 3. Repeat.
3. Every recommended model/price in the deliverable carries a "verify current pricing/model availability" note with an as-of date.

## References

- `references/chunking_strategies_comparison.md` — strategy trade-offs the optimizer implements
- `references/embedding_model_benchmark.md` — benchmark *methodology* (dated snapshot; staleness warning at top)
- `references/rag_evaluation_framework.md` — metric definitions (faithfulness, relevance, precision/recall/NDCG)

© Alireza Rezvani · MIT · alirezarezvani/claude-skills

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor