agentleFS
patonkikhpatonkikh/APES/skills/rag/embedding-strategy-advisor/skill.md

embedding-strategy-advisor

Skill3 starsChanged 4 months agoMITView on GitHub

Select and configure embedding models and indexing strategy for a RAG corpus based on domain, language, and quality requirements. Use when working on RAG pipelines, chunking, embeddings, retrieval, or hybrid search.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When corpus or model changes:

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

Embedding Strategy Advisor

Purpose

Select and configure embedding models and indexing strategy for a RAG corpus based on domain, language, and quality requirements.

Input: Corpus description, languages, domain (general/technical/legal), budget, latency requirements
Output: Embedding strategy document with model recommendation, dimension trade-offs, and index configuration Examples: See examples.md for worked input/output.


Workflow

Step 1: Profile the corpus

  • Languages and multilingual needs
  • Domain specificity (general, code, medical, legal)
  • Corpus size (chunks count)
  • Query-document similarity type (semantic, keyword-hybrid)

Step 2: Evaluate embedding options

ModelDimensionsMultilingualDomain fitCost

Compare API models (OpenAI, Cohere, Voyage) vs open-weight (BGE, E5, GTE).

Step 3: Recommend embedding model

Selection criteria:

  • Retrieval quality on domain sample (MRR, recall@k)
  • Latency for query embedding
  • Cost at projected volume
  • Self-hosting feasibility

Step 4: Define index configuration

  • Distance metric: cosine, dot product, L2
  • Index type: HNSW parameters (ef, M)
  • Quantization if corpus > 1M chunks

Step 5: Plan re-embedding strategy

When corpus or model changes:

  • Version embeddings
  • Batch re-embed pipeline
  • Dual-index migration period

Step 6: Validate

Run Validation checklist.


Decision Rules

ConditionAction
Multilingual corpusRequire multilingual model; avoid English-only
Code-heavy corpusConsider code-specific embeddings
Budget constrainedRecommend open-weight self-hosted with ops cost note
Latency < 100ms for embedPrefer smaller dimension models
Domain highly specializedRecommend fine-tuning or domain-specific model eval

Validation

  • Corpus profile complete
  • ≥2 embedding options compared
  • Recommendation with quality/cost/latency rationale
  • Index configuration specified
  • Re-embedding strategy documented
  • Dimension and metric choices explained
  • Eval method for embedding quality stated

Anti-patterns

  • Default model — using text-embedding-3-small without domain eval.
  • Dimension mismatch — mixing embeddings from different models in one index.
  • No re-embed plan — model lock-in without migration path.
  • Ignoring query embedding cost — only indexing cost considered.
  • Over-quantization — precision loss without quality check.

Best Practices

  • Eval embeddings on domain-specific golden queries.
  • Match embedding model to chunking strategy.
  • Store model version in index metadata.
  • Benchmark query latency at p95, not average.
  • Align with chunking-strategy-advisor output.

Output Structure

# Embedding Strategy: [Corpus Name]

## Corpus Profile
| Attribute | Value |
|-----------|-------|

## Options Compared
| Model | Dims | Quality | Cost | Latency |
|-------|------|---------|------|---------|

## Recommendation
**Model:** [name]
**Rationale:** [why]

## Index Config
| Setting | Value |
|---------|-------|

## Re-embedding Plan
[Strategy]

## Eval Results
| Metric | Score |
|--------|-------|

Next Skills

OutcomeRecommended Skill
Tune retrievalrag/retriever-optimizer
Hybrid searchrag/hybrid-search-advisor
Chunking tuningrag/chunking-strategy-advisor
RAG architecturerag/rag-architecture-designer

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.