Claude Skill

haystack

Build production search and NLP pipelines with Haystack. Pipeline DAG composition, document stores, retrievers, PromptBuilder (Jinja2), generators, evaluation, Hayhooks deployment. Use when building search pipelines or comparing NLP application frameworks. Do not use this skill f

LLM Mart · 0 points · 13 views 0 listing impressions 0 install-command copies
Download magnus919-agent-skills-haystack-addad86.zip · 14 KB

Install

skills CLI npx skills add https://github.com/magnus919/agent-skills/tree/main/haystack
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install magnus919-agent-skills@llmmart
Git git clone https://github.com/magnus919/agent-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole magnus919/agent-skills collection as a plugin from our marketplace. Git is the plain clone.

README

Haystack — Production Search & NLP Pipelines (deepset)

An expert-level skill for building production search and NLP pipelines with Haystack. Pipelines are validated DAGs with typed components and explicit connections.

Why Install This Skill

When your agent loads this skill, it becomes a Haystack expert who can:

  • Design pipeline DAGs — add_component + connect with typed input/output slots
  • Build RAG pipelines — document indexing + query pipelines with embedding retrieval
  • Create agentic systems — tool-using agents with ReAct pattern
  • Integrate generative AI — PromptBuilder (Jinja2) + LLM generators
  • Evaluate pipeline quality — faithfulness, relevancy, and custom metrics
  • Deploy with Hayhooks — REST API deployment for production

What You Get

Directory Purpose
SKILL.md Core paradigm, where-to-start table, framework comparison
references/ Deep dives into pipeline design, RAG, agents, evaluation, Hayhooks, and framework comparisons

Framework Comparison

Haystack uses explicit Pipeline DAGs (add_component + connect) — different from LangChain's LCEL pipe operator and LlamaIndex's query engines. Pipelines are validated at declaration time.

Requirements

Python 3.8+ with haystack-ai package.

Quick Start

Start with the setup and first workflow in SKILL.md, then use the linked resources for the specific task you need to complete.

Triggers

Use this skill for the task types and keywords described in its SKILL.md description.

Skill manifest

Haystack Expert Skill

Haystack (by deepset) is a production-oriented framework for building search and NLP pipelines. Its core abstraction is the Pipeline — a directed acyclic graph of typed components with explicit connections. Unlike LangChain's LCEL (pipe operator) or LlamaIndex's query engines, Haystack pipelines are declared upfront with add_component and connect, giving validated, debuggable DAGs.

Core Paradigm

from haystack import Pipeline
from haystack.components.embedders import SentenceTransformersTextEmbedder
from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
from haystack.components.builders import PromptBuilder
from haystack.components.generators import OpenAIGenerator
from haystack.document_stores.in_memory import InMemoryDocumentStore

# Build a pipeline
document_store = InMemoryDocumentStore()
pipeline = Pipeline()
pipeline.add_component("embedder", SentenceTransformersTextEmbedder())
pipeline.add_component("retriever", InMemoryEmbeddingRetriever(document_store=document_store))
pipeline.add_component("prompt_builder", PromptBuilder(template="Answer using: {{documents}}\n\nQuestion: {{question}}"))
pipeline.add_component("generator", OpenAIGenerator())

# Connect components
pipeline.connect("embedder.embedding", "retriever.query_embedding")
pipeline.connect("retriever.documents", "prompt_builder.documents")
pipeline.connect("prompt_builder", "generator")

# Run
result = pipeline.run({"embedder": {"text": "What is Haystack?"}, "prompt_builder": {"question": "What is Haystack?"}})

Core Principles

  1. Pipelines are validated DAGs. add_component + connect. Pipeline validation catches errors BEFORE execution — leverage this during development.
  2. Components are typed. Each component has input/output slots. Connections must match types. This prevents runtime errors.
  3. PromptBuilder uses Jinja2. Templates are Jinja2 strings, not f-strings. {{documents}}, {{query}}, {{question}} are variable placeholders.
  4. Indexing and query are separate pipelines. One pipeline loads/cleans/embeds/writes documents. Another retrieves/generates answers. They share the DocumentStore.
  5. Evaluation is a pipeline too. Add evaluator components to measure faithfulness, relevancy, or custom metrics.

Where to Start

You already have... Start here
Nothing — exploring Haystack Build a basic indexing + query pipeline
Documents to index Build an indexing pipeline (converters, splitter, embedder, writer)
A search use case Build a query pipeline (embedder, retriever, prompt, generator)
A production deployment Add Hayhooks + evaluation pipeline

Quick Reference

Task Approach Reference
Build indexing pipeline add_component -> connect -> run references/pipeline-design.md
Build query pipeline retriever -> prompt_builder -> generator references/pipeline-design.md
Choose document store InMemory (dev), Elasticsearch/Pinecone (prod) references/document-stores.md
Embedding retrieval SentenceTransformersTextEmbedder + EmbeddingRetriever references/retrievers.md
Hybrid retrieval BM25 + Embedding in parallel, DocumentJoiner references/retrievers.md
Prompt templates Jinja2 in PromptBuilder references/pipeline-design.md
Evaluation DeepEvalEvaluator, SASEvaluator references/evaluation.md
Deploy Hayhooks REST API references/deployment.md

Framework Routing Guide

Scenario Reach for Why
Search / NLP pipelines Haystack Pipeline DAG model is most mature for retrieval-heavy workloads
Documents to query / RAG LlamaIndex Data ingestion is the primary primitive
Chain/agent composition LangChain LCEL pipe operator for general chain building
Compiled prompt programs DSPy Auto-optimizes prompts against a metric
Role-based multi-agent CrewAI Higher-level agent abstraction

Reference Files

Reference Load when File
Pipeline Design Building indexing and query pipelines references/pipeline-design.md
Document Stores Store selection and configuration references/document-stores.md
Retrievers Embedding, BM25, hybrid retrieval references/retrievers.md
Validation Audit Research validation of all API claims references/validation-audit.md
File Converters Multi-format indexing, YAML serialization, component types references/file-converters.md
Evaluation Metrics, evaluators, pipeline evaluation references/evaluation.md
Deployment Hayhooks, containerization, production references/deployment.md
FAQ & Troubleshooting Common errors and fixes references/faq-and-troubleshooting.md

Templates

Template When to use File
Indexing Pipeline Load, split, embed, write to store templates/indexing-pipeline.py
Query Pipeline Retrieve, prompt, generate answer templates/query-pipeline.py
Hybrid RAG BM25 + embedding in parallel templates/hybrid-rag.py

Troubleshooting

Symptom Likely cause Fix Reference
Pipeline run errors Component connection mismatch Check component input/output slot types references/pipeline-design.md
No documents retrieved Empty document store Run indexing pipeline first references/pipeline-design.md
Prompt not rendering Wrong variable name in Jinja2 template Check {{variables}} match pipeline input references/pipeline-design.md
Slow retrieval Full scan instead of ANN Configure approximate nearest neighbor index references/retrievers.md
Embedding mismatch Different models for indexing vs query Use same model in both pipelines references/retrievers.md
Hayhooks not starting Port conflict or missing config Check port, run with --help for options references/deployment.md
Files (agent-skills)
  • evals
    • evals.json 2.7 KB
      Loading…
  • references
    • deployment.md 1.1 KB
      Loading…
    • document-stores.md 1.7 KB
      Loading…
    • evaluation.md 1.7 KB
      Loading…
    • faq-and-troubleshooting.md 1.6 KB
      Loading…
    • file-converters.md 3.2 KB
      Loading…
    • pipeline-design.md 2.7 KB
      Loading…
    • retrievers.md 2 KB
      Loading…
    • validation-audit.md 1.1 KB
      Loading…
  • scripts
    • check-setup.py 732 B
      Loading…
  • templates
    • hybrid-rag.py 1.7 KB
      Loading…
    • indexing-pipeline.py 1.1 KB
      Loading…
    • query-pipeline.py 1.3 KB
      Loading…
  • README.md 1.5 KB
    # Haystack — Production Search & NLP Pipelines (deepset)
    
    An expert-level skill for building **production search and NLP pipelines** with Haystack. Pipelines are validated DAGs with typed components and explicit connections.
    
    ## Why Install This Skill
    
    When your agent loads this skill, it becomes a Haystack expert who can:
    
    - **Design pipeline DAGs** — add_component + connect with typed input/output slots
    - **Build RAG pipelines** — document indexing + query pipelines with embedding retrieval
    - **Create agentic systems** — tool-using agents with ReAct pattern
    - **Integrate generative AI** — PromptBuilder (Jinja2) + LLM generators
    - **Evaluate pipeline quality** — faithfulness, relevancy, and custom metrics
    - **Deploy with Hayhooks** — REST API deployment for production
    
    ## What You Get
    
    | Directory | Purpose |
    |-----------|---------|
    | `SKILL.md` | Core paradigm, where-to-start table, framework comparison |
    | `references/` | Deep dives into pipeline design, RAG, agents, evaluation, Hayhooks, and framework comparisons |
    
    ## Framework Comparison
    
    Haystack uses explicit Pipeline DAGs (add_component + connect) — different from LangChain's LCEL pipe operator and LlamaIndex's query engines. Pipelines are validated at declaration time.
    
    ## Requirements
    
    Python 3.8+ with `haystack-ai` package.
    
    
    ## Quick Start
    
    Start with the setup and first workflow in SKILL.md, then use the linked resources for the specific task you need to complete.
    
    
    ## Triggers
    
    Use this skill for the task types and keywords described in its SKILL.md description.
    
  • SKILL.md 6.4 KB
    ---
    name: haystack
    description: >-
      Build production search and NLP pipelines with Haystack. Pipeline DAG composition,
      document stores, retrievers, PromptBuilder (Jinja2), generators, evaluation, Hayhooks
      deployment. Use when building search pipelines or comparing NLP application frameworks.
      Do not use this skill for unrelated requests; route to the nearest named specialist.
    license: MIT
    metadata:
      author: Magnus Hedemark
      version: 1.1.0
      source: https://docs.haystack.deepset.ai
    ---
    
    # Haystack Expert Skill
    
    Haystack (by deepset) is a production-oriented framework for building search and NLP pipelines. Its core abstraction is the **Pipeline** — a directed acyclic graph of typed components with explicit connections. Unlike LangChain's LCEL (pipe operator) or LlamaIndex's query engines, Haystack pipelines are **declared upfront with add_component and connect**, giving validated, debuggable DAGs.
    
    ## Core Paradigm
    
    ```python
    from haystack import Pipeline
    from haystack.components.embedders import SentenceTransformersTextEmbedder
    from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
    from haystack.components.builders import PromptBuilder
    from haystack.components.generators import OpenAIGenerator
    from haystack.document_stores.in_memory import InMemoryDocumentStore
    
    # Build a pipeline
    document_store = InMemoryDocumentStore()
    pipeline = Pipeline()
    pipeline.add_component("embedder", SentenceTransformersTextEmbedder())
    pipeline.add_component("retriever", InMemoryEmbeddingRetriever(document_store=document_store))
    pipeline.add_component("prompt_builder", PromptBuilder(template="Answer using: {{documents}}\n\nQuestion: {{question}}"))
    pipeline.add_component("generator", OpenAIGenerator())
    
    # Connect components
    pipeline.connect("embedder.embedding", "retriever.query_embedding")
    pipeline.connect("retriever.documents", "prompt_builder.documents")
    pipeline.connect("prompt_builder", "generator")
    
    # Run
    result = pipeline.run({"embedder": {"text": "What is Haystack?"}, "prompt_builder": {"question": "What is Haystack?"}})
    ```
    
    ## Core Principles
    
    1. **Pipelines are validated DAGs.** add_component + connect. Pipeline validation catches errors BEFORE execution — leverage this during development.
    2. **Components are typed.** Each component has input/output slots. Connections must match types. This prevents runtime errors.
    3. **PromptBuilder uses Jinja2.** Templates are Jinja2 strings, not f-strings. `{{documents}}`, `{{query}}`, `{{question}}` are variable placeholders.
    4. **Indexing and query are separate pipelines.** One pipeline loads/cleans/embeds/writes documents. Another retrieves/generates answers. They share the DocumentStore.
    5. **Evaluation is a pipeline too.** Add evaluator components to measure faithfulness, relevancy, or custom metrics.
    
    ## Where to Start
    
    | You already have... | Start here |
    |---|---|
    | Nothing — exploring Haystack | Build a basic indexing + query pipeline |
    | Documents to index | Build an indexing pipeline (converters, splitter, embedder, writer) |
    | A search use case | Build a query pipeline (embedder, retriever, prompt, generator) |
    | A production deployment | Add Hayhooks + evaluation pipeline |
    
    ## Quick Reference
    
    | Task | Approach | Reference |
    |------|----------|-----------|
    | Build indexing pipeline | add_component -> connect -> run | `references/pipeline-design.md` |
    | Build query pipeline | retriever -> prompt_builder -> generator | `references/pipeline-design.md` |
    | Choose document store | InMemory (dev), Elasticsearch/Pinecone (prod) | `references/document-stores.md` |
    | Embedding retrieval | SentenceTransformersTextEmbedder + EmbeddingRetriever | `references/retrievers.md` |
    | Hybrid retrieval | BM25 + Embedding in parallel, DocumentJoiner | `references/retrievers.md` |
    | Prompt templates | Jinja2 in PromptBuilder | `references/pipeline-design.md` |
    | Evaluation | DeepEvalEvaluator, SASEvaluator | `references/evaluation.md` |
    | Deploy | Hayhooks REST API | `references/deployment.md` |
    
    ## Framework Routing Guide
    
    | Scenario | Reach for | Why |
    |----------|-----------|-----|
    | Search / NLP pipelines | **Haystack** | Pipeline DAG model is most mature for retrieval-heavy workloads |
    | Documents to query / RAG | **LlamaIndex** | Data ingestion is the primary primitive |
    | Chain/agent composition | **LangChain** | LCEL pipe operator for general chain building |
    | Compiled prompt programs | **DSPy** | Auto-optimizes prompts against a metric |
    | Role-based multi-agent | **CrewAI** | Higher-level agent abstraction |
    
    ## Reference Files
    
    | Reference | Load when | File |
    |-----------|-----------|------|
    | Pipeline Design | Building indexing and query pipelines | `references/pipeline-design.md` |
    | Document Stores | Store selection and configuration | `references/document-stores.md` |
    | Retrievers | Embedding, BM25, hybrid retrieval | `references/retrievers.md` |
    | Validation Audit | Research validation of all API claims | `references/validation-audit.md` |
    | File Converters | Multi-format indexing, YAML serialization, component types | `references/file-converters.md` |
    | Evaluation | Metrics, evaluators, pipeline evaluation | `references/evaluation.md` |
    | Deployment | Hayhooks, containerization, production | `references/deployment.md` |
    | FAQ & Troubleshooting | Common errors and fixes | `references/faq-and-troubleshooting.md` |
    
    ## Templates
    
    | Template | When to use | File |
    |----------|-------------|------|
    | Indexing Pipeline | Load, split, embed, write to store | `templates/indexing-pipeline.py` |
    | Query Pipeline | Retrieve, prompt, generate answer | `templates/query-pipeline.py` |
    | Hybrid RAG | BM25 + embedding in parallel | `templates/hybrid-rag.py` |
    
    ## Troubleshooting
    
    | Symptom | Likely cause | Fix | Reference |
    |---------|-------------|-----|-----------|
    | Pipeline run errors | Component connection mismatch | Check component input/output slot types | `references/pipeline-design.md` |
    | No documents retrieved | Empty document store | Run indexing pipeline first | `references/pipeline-design.md` |
    | Prompt not rendering | Wrong variable name in Jinja2 template | Check {{variables}} match pipeline input | `references/pipeline-design.md` |
    | Slow retrieval | Full scan instead of ANN | Configure approximate nearest neighbor index | `references/retrievers.md` |
    | Embedding mismatch | Different models for indexing vs query | Use same model in both pipelines | `references/retrievers.md` |
    | Hayhooks not starting | Port conflict or missing config | Check port, run with --help for options | `references/deployment.md` |
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.