Agent skill

Dspy Embedding Retrieval

by OmidZamani in OmidZamani/dspy-skills

A skill your agent uses for DSPy retrieval with dspy.Embedder, dspy.Embeddings, FAISS indexes, semantic search, and local or hosted embedding models.

MITAuto-check passedAI & LLM Engineering

Install Dspy Embedding Retrieval

skills CLI
$ npx skills add OmidZamani/dspy-skills --skill dspy-embedding-retrieval -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install OmidZamani/dspy-skills dspy-embedding-retrieval --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/OmidZamani/dspy-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/dspy-embedding-retrieval .claude/skills/dspy-embedding-retrieval && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
dspy-embedding-retrieval
GitHub stars
123
Token cost
~720 tokens
SKILL.md length
139 words
Files
2
Skills in repo
17
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses for DSPy retrieval with dspy.Embedder, dspy.Embeddings, FAISS indexes, semantic search, and local or hosted embedding models.

  • Works in 5 steps: Evaluate retrieval quality separately… → Keep corpus chunking deterministic and… → Persist expensive indexes. → …
  • DSPy retrieval with dspy.Embedder
  • SKILL.md covers Goal, Basic Hosted Embedder, Use in RAG and Custom Local Embeddings, plus 4 more sections
  • Runs Python scripts from its folder; calls pip

What it does

Dspy Embedding Retrieval is an agent skill from OmidZamani/dspy-skills. Use for DSPy retrieval with dspy.Embedder, dspy.Embeddings, FAISS indexes, semantic search, and local or hosted embedding models.

Its SKILL.md is about 720 tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `example.py`).

It sits in AI & LLM Engineering, covering Embeddings and Vector databases. The repository describes itself as: Collection of Claude Skills for DSPy framework - program language models, optimize prompts, and build RAG pipelines systematically. The licence is MIT.

When your agent uses it

  • DSPy retrieval with dspy.Embedder
  • Dspy.Embeddings
  • Semantic search
  • Hosted embedding models

Example prompts

  • “/dspy-embedding-retrieval”

Requirements

  • Python 3
  • Pre-approved tools (allowed-tools): Read, Write, Glob, Grep

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Evaluate retrieval quality separately from answer quality.
  2. Keep corpus chunking deterministic and versioned.
  3. Persist expensive indexes.
  4. Use EmbeddingsWithScores when debugging relevance.
  5. Measure memory and latency before enabling FAISS for large corpora.

What it can do on your machine

Read from SKILL.md and the folder at commit f5db3b7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • dspy.ai

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Dspy Embedding Retrieval loads about 720 tokens when it runs. Until then it costs about 39 tokens; SKILL.md has 139 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~39
When it runs · the whole SKILL.md, loaded when a task matches
~720

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from OmidZamani/dspy-skills at commit f5db3b7, republished under its MIT licence (© OmidZamani). 139 words, ~720 tokens.

Download SKILL.mdSave it as .claude/skills/dspy-embedding-retrieval/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
dspy-embedding-retrieval
description
Use for DSPy retrieval with dspy.Embedder, dspy.Embeddings, FAISS indexes, semantic search, and local or hosted embedding models.
allowed-tools
Read, Write, Glob, Grep
version
1.0.0
dspy-compatibility
3.2.1
tags
retrieval
requires-extras
faiss-cpu

DSPy Embedding Retrieval

Goal

Build semantic retrieval over an application-owned text corpus with dspy.Embedder and dspy.Embeddings.

Basic Hosted Embedder

python
import dspy

corpus = [
    "DSPy programs are composed from modules.",
    "MIPROv2 optimizes instructions and demonstrations.",
    "RLM explores large contexts with a sandboxed REPL.",
]

embedder = dspy.Embedder("openai/text-embedding-3-small")
search = dspy.Embeddings(corpus=corpus, embedder=embedder, k=2)

result = search("Which optimizer tunes prompts?")
print(result.passages)
print(result.indices)

Use in RAG

python
class LocalRAG(dspy.Module):
    def __init__(self, retriever):
        super().__init__()
        self.retriever = retriever
        self.answer = dspy.ChainOfThought("context: list[str], question -> answer")

    def forward(self, question: str):
        context = self.retriever(question).passages
        return self.answer(context=context, question=question)

Custom Local Embeddings

Wrap any callable that accepts list[str] and returns a 2D numeric array:

python
from sentence_transformers import SentenceTransformer
import dspy

model = SentenceTransformer("sentence-transformers/static-retrieval-mrl-en-v1")
embedder = dspy.Embedder(model.encode)
search = dspy.Embeddings(corpus=corpus, embedder=embedder, k=5)

Scores, FAISS, and Persistence

Use dspy.EmbeddingsWithScores when downstream logic needs similarity thresholds or reranking.

For corpora at or above the brute_force_threshold default of 20_000, DSPy builds a FAISS index. Install FAISS first:

bash
pip install faiss-cpu

Persist the index when embedding the corpus is expensive:

python
search.save("./retrieval-index")
loaded = dspy.Embeddings.from_saved("./retrieval-index", embedder=embedder)

Best Practices

  1. Evaluate retrieval quality separately from answer quality.
  2. Keep corpus chunking deterministic and versioned.
  3. Persist expensive indexes.
  4. Use EmbeddingsWithScores when debugging relevance.
  5. Measure memory and latency before enabling FAISS for large corpora.

Official Documentation

© OmidZamani, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in skills/dspy-embedding-retrieval of OmidZamani/dspy-skills.

  • SKILL.md
  • example.py

Open the folder on GitHubat commit f5db3b7

Compare with similar skills

Dspy Embedding Retrieval next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Dspy Embedding Retrieval compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Dspy Embedding Retrieval this skillOmidZamani/dspy-skills123—~720Automated safety check: PassMIT
Chroma Vector DatabaseOrchestra-Research/AI-Research-SKILLs13k7 repos~2.3kAutomated safety check: PassMIT
Codebase Managementgiancarloerra/SocratiCode3.3k1 repos~1.8kAutomated safety check: PassAGPL-3.0
Ms Agent Framework RAGshuyu-labs/WebCode278—~1.1kAutomated safety check: PassCustom licence
Pgvector Semantic Searchtimescale/pg-aiguide1.9k—~3.8kAutomated safety check: PassApache-2.0
RAG Implementationwshobson/agents40k9 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 7 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Codebase Management

    giancarloerra/SocratiCode

    Set up, index, and manage SocratiCode codebase indexing. An agent skill from giancarloerra/SocratiCode.

    3.3k GitHub starsUsed in 1 repo~1.8k tokens
    AI & LLM EngineeringAuto-check passed
  • Ms Agent Framework RAG

    shuyu-labs/WebCode

    Comprehensive guide for building Agentic RAG systems using Microsoft Agent Framework in C.

    278 GitHub stars~1.1k tokensUpdated 3 mo ago
    AI & LLM EngineeringAuto-check passed
  • Pgvector Semantic Search

    timescale/pg-aiguide

    A skill your agent uses for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search.

    1.9k GitHub stars~3.8k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • RAG Implementation

    wshobson/agents

    Build retrieval-augmented generation systems: pick a vector database and embedding model, choose retrieval and reranking strategies, and start from a LangGraph pipeline.

    40k GitHub starsUsed in 9 repos~1.1k tokens
    AI & LLM EngineeringAuto-check passed
  • RAG Engineer

    davila7/claude-code-templates

    Expert in building Retrieval-Augmented Generation systems. An agent skill from davila7/claude-code-templates.

    33k GitHub starsUsed in 5 repos~729 tokens
    AI & LLM EngineeringAuto-check passed

More from OmidZamani/dspy-skills

All 17 skills in this repo
  • Skill Perfection

    OmidZamani/dspy-skills

    A skill your agent uses when you need to QA audit and fix a plugin skill file.

    123 GitHub stars~1.6k tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Haystack Integration

    OmidZamani/dspy-skills

    A skill your agent uses for integrating DSPy with Haystack, optimizing Haystack prompts, improving retrieval pipelines, and extracting DSPy prompts.

    123 GitHub stars~1.4k tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Adapters Multimodal

    OmidZamani/dspy-skills

    A skill your agent uses for DSPy adapter selection, JSONAdapter, XMLAdapter, ChatAdapter, native function calling, structured outputs, and multimodal inputs like dspy.Image or dspy.Audio.

    123 GitHub stars~864 tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Advanced Module Composition

    OmidZamani/dspy-skills

    A skill your agent uses for composing DSPy modules with Ensemble, MultiChainComparison, ensemble voting, sequential pipelines, and multi-program workflows.

    123 GitHub stars~2.2k tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Better Together

    OmidZamani/dspy-skills

    A skill your agent uses for BetterTogether, prompt plus weight optimization, fine-tuning sequences, and strategy chains like p - w - p.

    123 GitHub stars~756 tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Bootstrap Fewshot

    OmidZamani/dspy-skills

    A skill your agent uses for BootstrapFewShot, bootstrapped demonstrations, teacher-model demos, and low-data DSPy prompt optimization.

    123 GitHub stars~1.3k tokensUpdated 3 mo ago
    Auto-check passed

Questions about Dspy Embedding Retrieval

What does Dspy Embedding Retrieval do?

A skill your agent uses for DSPy retrieval with dspy.Embedder, dspy.Embeddings, FAISS indexes, semantic search, and local or hosted embedding models. Dspy Embedding Retrieval is an agent skill from OmidZamani/dspy-skills.Embeddings, FAISS indexes, semantic search, and local or hosted embedding models.

When should I use Dspy Embedding Retrieval?

Dspy Embedding Retrieval fits situations like: DSPy retrieval with dspy.Embedder; dspy.Embeddings; semantic search; hosted embedding models.

How do I install Dspy Embedding Retrieval in Claude Code?

Run `npx skills add OmidZamani/dspy-skills --skill dspy-embedding-retrieval -a claude-code`. Or copy the skill folder (skills/dspy-embedding-retrieval in OmidZamani/dspy-skills) into .claude/skills/dspy-embedding-retrieval in your project. Claude Code loads it when a task matches its description.

How do I install Dspy Embedding Retrieval in Codex?

Run `npx skills add OmidZamani/dspy-skills --skill dspy-embedding-retrieval -a codex`. Or copy the skill folder (skills/dspy-embedding-retrieval in OmidZamani/dspy-skills) into .agents/skills/dspy-embedding-retrieval in your project. Codex loads it when a task matches its description.

Can I use Dspy Embedding Retrieval in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add OmidZamani/dspy-skills --skill dspy-embedding-retrieval -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/dspy-embedding-retrieval, .gemini/skills/dspy-embedding-retrieval, .github/skills/dspy-embedding-retrieval and .opencode/skills/dspy-embedding-retrieval in your project.

What does Dspy Embedding Retrieval need to run?

Going by SKILL.md and its folder, Dspy Embedding Retrieval needs Python for the scripts in its folder and the command-line tools its instructions call (pip). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Glob, Grep.

Does Dspy Embedding Retrieval access the network?

SKILL.md names 1 domain. As links in the text: dspy.ai. This is read from the text; nothing was executed.

Is Dspy Embedding Retrieval safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Dspy Embedding Retrieval use?

Dspy Embedding Retrieval is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Dspy Embedding Retrieval use?

About 720 tokens (SKILL.md is roughly 2.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Dspy Embedding Retrieval?

Skills that share tags, products or a category with Dspy Embedding Retrieval: Chroma Vector Database (Orchestra-Research/AI-Research-SKILLs, 13k stars), Codebase Management (giancarloerra/SocratiCode, 3.3k stars), Ms Agent Framework RAG (shuyu-labs/WebCode, 278 stars) and Pgvector Semantic Search (timescale/pg-aiguide, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Dspy Embedding Retrieval?

OmidZamani (a GitHub user) maintains it in OmidZamani/dspy-skills, which has 123 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on June 23, 2026.

Source: OmidZamani/dspy-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.