dspy-haystack-integration
This skill should be used when the user asks to "integrate DSPy with Haystack", "optimize Haystack prompts using DSPy", "use DSPy to improve Haystack pipeline", mentions "Haystack pipeline optimization", "combining DSPy and Haystack", "extract DSPy prompt for Haystack", or wants to use DSPy's optimization capabilities to automatically improve prompts in existing Haystack pipelines.
npx skills add majiayu000/claude-skill-registry --skill dspy-haystack-integration --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# DSPy + Haystack Integration ## Goal Use DSPy's optimization capabilities to automatically improve prompts in Haystack pipelines. ## When to Use - You have existing Haystack pipelines - Manual prompt tuning is tedious - Need data-driven prompt optimization - Want to combine Haystack components with DSPy optimization ## Inputs | Input | Type | Description | |-------|------|-------------| | `haystack_pipeline` | `Pipeline` | Existing Haystack pipeline | | `trainset` | `list[dspy.Example]` | Training examples | | `metric` | `callable` | Evaluation function | ## Outputs | Output | Type | Description | |--------|------|-------------| | `optimized_prompt` | `str` | DSPy-optimized prompt | | `optimized_pipeline` | `Pipeline` | Updated Haystack pipeline | ## Workflow ### Phase 1: Build Initial Haystack Pipeline ```python from haystack import Pipeline from haystack.components.generators import OpenAIGenerator from haystack.components.builders import PromptBuilder from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.document_stores.in_memory import InMemoryDocumentStore # Setup document store doc_store = InMemoryDocumentStore() doc_store.write_documents(d
- Goal
- When to Use
- Inputs
- Outputs
- Workflow
- Phase 1: Build Initial Haystack Pipeline
- Phase 2: Create DSPy RAG Module
- Phase 3: Define Custom Metric
- Phase 4: Optimize with DSPy
- Phase 5: Extract and Apply Optimized Prompt
- Production Example
- Best Practices
- Limitations
- Official Documentation
What does the dspy-haystack-integration skill do?
This skill should be used when the user asks to "integrate DSPy with Haystack", "optimize Haystack prompts using DSPy", "use DSPy to improve Haystack pipeline", mentions "Haystack pipeline optimization", "combining DSPy and Haystack", "extract DSPy prompt for Haystack", or wants to use DSPy's optimization capabilities to automatically improve prompts in existing Haystack pipelines.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill dspy-haystack-integration --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
