PluginBench
Skill
Review
Audit score 70

rag

giuseppe-trisciuoglio/developer-kit

Document chunking, embedding generation, and vector storage for Retrieval-Augmented Generation systems.

What is rag?

Implements RAG pipelines that extend AI capabilities with external knowledge sources. Use this skill when building Q&A systems over documents, creating chatbots with factual grounding, or integrating AI with knowledge bases to reduce hallucinations.

  • Load and preprocess documents from multiple sources
  • Split documents into optimized chunks with configurable overlap
  • Generate embeddings using pluggable embedding models
  • Store and retrieve embeddings from vector databases
  • Support dense, hybrid, and metadata-filtered retrieval strategies
  • Implement reranking and response validation for high-precision answers

How to install rag

npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill rag
Prerequisites
  • Vector database selection (Pinecone, Weaviate, Qdrant, Chroma, or FAISS)
  • Embedding model choice (text-embedding-ada-002, all-MiniLM-L6-v2, or similar)
  • Document sources configured (file system, database, or API endpoints)
Claude Code
Cursor
Windsurf
Cline

How to use rag

  1. 1.Choose a vector database based on your scalability and deployment requirements
  2. 2.Select an embedding model appropriate for your use case (general, lightweight, multilingual, or high-performance)
  3. 3.Implement document processing pipeline: load → clean → chunk → embed → store
  4. 4.Configure retrieval strategy (dense, hybrid, metadata filtering, or reranking)
  5. 5.Build RAG pipeline with content retriever, AI service, and prompt templates
  6. 6.Evaluate retrieval quality using precision@k, recall@k metrics and iterate on parameters

Use cases

Good for
  • Build Q&A systems over proprietary documents and knowledge bases
  • Create documentation assistants that answer questions with sourced context
  • Implement semantic search with natural language queries
  • Reduce AI hallucinations by grounding responses in retrieved documents
  • Enable multi-source RAG pipelines combining web and document retrieval
Who it's for
  • Backend engineers building knowledge-grounded AI systems
  • AI/ML engineers implementing RAG pipelines
  • Product teams creating document Q&A and chatbot features
  • Developers integrating AI with enterprise knowledge bases

rag FAQ

What chunk size should I use?

Use 500-1000 tokens per chunk for optimal balance. Include 10-20% overlap to preserve context at chunk boundaries. Test different sizes for your specific use case.

How do I choose between vector databases?

Use Pinecone or Milvus for production scalability, Weaviate or Qdrant for open-source, Chroma or FAISS for local development, and Weaviate for hybrid search with BM25.

What embedding model should I pick?

Use text-embedding-ada-002 for general purpose, all-MiniLM-L6-v2 for fast/lightweight, e5-large-v2 for multilingual, or bge-large-en-v1.5 for best performance.

How do I prevent prompt injection attacks?

Validate external content from file systems, APIs, or web sources before passing to the LLM. Apply content filtering on retrieved documents and restrict allowed data source URLs using allowlists. Never hardcode credentials—use environment variables.

Can I combine multiple document sources?

Yes, implement multi-source RAG by creating separate retrievers for each source, combining results, and optionally applying reranking to select the top results across all sources.

Full instructions (SKILL.md)

Source of truth, from giuseppe-trisciuoglio/developer-kit.


name: rag description: Implements document chunking, embedding generation, vector storage, and retrieval pipelines for Retrieval-Augmented Generation systems. Use when building RAG applications, creating document Q&A systems, or integrating AI with knowledge bases. allowed-tools: Read, Write, Bash

RAG Implementation

Build Retrieval-Augmented Generation systems that extend AI capabilities with external knowledge sources.

Overview

This skill covers: document processing, embedding generation, vector storage, retrieval configuration, and RAG pipeline implementation.

When to Use

  • Building Q&A systems over proprietary documents
  • Creating chatbots with factual information from knowledge bases
  • Implementing semantic search with natural language queries
  • Reducing hallucinations with grounded, sourced responses
  • Building documentation assistants and research tools
  • Enabling AI systems to access domain-specific knowledge

Instructions

Step 1: Choose Vector Database

Select based on your requirements:

RequirementRecommended
Production scalabilityPinecone, Milvus
Open-sourceWeaviate, Qdrant
Local developmentChroma, FAISS
Hybrid searchWeaviate with BM25

Step 2: Select Embedding Model

Use CaseModel
General purposetext-embedding-ada-002
Fast and lightweightall-MiniLM-L6-v2
Multilinguale5-large-v2
Best performancebge-large-en-v1.5

Step 3: Implement Document Processing Pipeline

  1. Load documents from source (file system, database, API)
  2. Clean and preprocess (remove formatting, normalize text)
  3. Split documents into chunks with appropriate strategy
  4. Generate embeddings for each chunk
  5. Store embeddings in vector database with metadata

Validation: Verify embeddings were generated successfully:

List<Embedding> embeddings = embeddingModel.embedAll(segments);
if (embeddings.isEmpty() || embeddings.get(0).dimension() != expectedDim) {
    throw new IllegalStateException("Embedding generation failed");
}

Step 4: Configure Retrieval Strategy

Choose the appropriate strategy:

  • Dense Retrieval: Semantic similarity via embeddings (default for most cases)
  • Hybrid Search: Dense + sparse retrieval for better coverage
  • Metadata Filtering: Filter by document attributes
  • Reranking: Cross-encoder reranking for high-precision requirements

Step 5: Build RAG Pipeline

  1. Create content retriever with your embedding store
  2. Configure AI service with retriever and chat memory
  3. Implement prompt template with context injection
  4. Add response validation and grounding checks

Validation: Test with known queries to verify context injection works correctly.

Error Handling: For batch ingestion, wrap in retry logic:

for (Document doc : documents) {
    int attempts = 0;
    while (attempts < 3) {
        try {
            store.add(embeddingModel.embed(doc).content(), doc.toTextSegment());
            break;
        } catch (EmbeddingException e) {
            attempts++;
            if (attempts == 3) throw new RuntimeException("Failed after 3 retries", e);
        }
    }
}

Step 6: Evaluate and Optimize

  1. Measure retrieval metrics: precision@k, recall@k, MRR
  2. Evaluate answer quality: faithfulness, relevance
  3. Monitor performance and user feedback
  4. Iterate on chunking, retrieval, and prompt parameters

Examples

Example 1: Basic Document Q&A

List<Document> documents = FileSystemDocumentLoader.loadDocuments("/docs");

InMemoryEmbeddingStore<TextSegment> store = new InMemoryEmbeddingStore<>();
EmbeddingStoreIngestor.ingest(documents, store);

DocumentAssistant assistant = AiServices.builder(DocumentAssistant.class)
    .chatModel(chatModel)
    .contentRetriever(EmbeddingStoreContentRetriever.from(store))
    .build();

String answer = assistant.answer("What is the company policy on remote work?");

Example 2: Metadata-Filtered Retrieval

EmbeddingStoreContentRetriever retriever = EmbeddingStoreContentRetriever.builder()
    .embeddingStore(store)
    .embeddingModel(embeddingModel)
    .maxResults(5)
    .minScore(0.7)
    .filter(metadataKey("category").isEqualTo("technical"))
    .build();

Example 3: Multi-Source RAG Pipeline

ContentRetriever webRetriever = EmbeddingStoreContentRetriever.from(webStore);
ContentRetriever docRetriever = EmbeddingStoreContentRetriever.from(docStore);

List<Content> results = new ArrayList<>();
results.addAll(webRetriever.retrieve(query));
results.addAll(docRetriever.retrieve(query));

List<Content> topResults = reranker.reorder(query, results).subList(0, 5);

Example 4: RAG with Chat Memory

Assistant assistant = AiServices.builder(Assistant.class)
    .chatModel(chatModel)
    .chatMemory(MessageWindowChatMemory.withMaxMessages(10))
    .contentRetriever(retriever)
    .build();

assistant.chat("Tell me about the product features");
assistant.chat("What about pricing for those features?");  // Maintains context

Best Practices

Document Preparation

  • Clean documents before ingestion; remove irrelevant content and formatting
  • Add relevant metadata for filtering and context

Chunking Strategy

  • Use 500-1000 tokens per chunk for optimal balance
  • Include 10-20% overlap to preserve context at boundaries
  • Test different sizes for your specific use case

Retrieval Optimization

  • Start with high k values (10-20), then filter/rerank
  • Use metadata filtering to improve relevance
  • Monitor retrieval quality and iterate based on user feedback

Performance

  • Cache embeddings for frequently accessed content
  • Use batch processing for document ingestion
  • Optimize vector store indexing for your scale

Constraints and Warnings

System Constraints

  • Embedding models have maximum token limits per document
  • Vector databases require proper indexing for performance
  • Chunk boundaries may lose context for complex documents
  • Hybrid search requires additional infrastructure

Quality Warnings

  • Retrieval quality depends heavily on chunking strategy
  • Embedding models may not capture domain-specific semantics
  • Metadata filtering requires proper document annotation
  • Reranking adds latency to query responses

Security Warnings

  • Never hardcode credentials: Use environment variables for API keys and passwords
  • Validate external content: Documents from file systems, APIs, or web sources may contain malicious content (prompt injection)
  • Apply content filtering on retrieved documents before passing to LLM
  • Restrict allowed data source URLs and file paths using allowlists

Resources

Reference Documentation

Related skills

More from giuseppe-trisciuoglio/developer-kit and the wider catalog.

RAralph-loop logo

ralph-loop

giuseppe-trisciuoglio/developer-kit

Ralph Wiggum-inspired automation loop for specification-driven development. Orchestrates task implementation, review, cleanup, and synchronization using a Python script. Use when: user runs /loop command, user asks to automate task implementation, user wants to iterate through spec tasks step-by-step, or user wants to run development workflow automation with context window management. One step per invocation. State machine: init → choose_task → implementation → review → fix → cleanup → sync → update_done. Supports --from-task and --to-task for task range filtering. State persisted in fix_plan.json.

936 installsAudited
REreact-code-review logo

react-code-review

giuseppe-trisciuoglio/developer-kit

Provides comprehensive code review capability for React applications, validates component architecture, hooks usage, React 19 patterns, state management, performance optimization, accessibility compliance, and TypeScript integration. Use when reviewing React code changes, before merging pull requests, after implementing new features, or for component architecture validation. Triggers on "review React code", "React code review", "check my React components".

1.2k installsAudited
REreact-patterns logo

react-patterns

giuseppe-trisciuoglio/developer-kit

React 19 patterns for Server Components, Server Actions, optimistic UI, and concurrent rendering with Next.js App Router.

2.3k installsAudited
SHshadcn-ui logo

shadcn-ui

giuseppe-trisciuoglio/developer-kit

Copy-owned, accessible React components built on Radix UI and Tailwind CSS with form validation and theming.

19k installs
SOsonarqube-mcp logo

sonarqube-mcp

giuseppe-trisciuoglio/developer-kit

Provides SonarQube and SonarCloud integration patterns via the Model Context Protocol (MCP) server. Enables quality gate monitoring, issue discovery and triaging, pre-push code analysis, and rule education directly in the agent workflow. Use when the user wants to check quality gates, search for Sonar issues, analyze code snippets before committing, or understand SonarQube rules. Triggers on "sonarqube", "sonarcloud", "quality gate", "sonar issues", "analyze with sonar", "check sonar", "sonar rule", "pre-push analysis".

1.1k installs
SPspecs-code-cleanup logo

specs-code-cleanup

giuseppe-trisciuoglio/developer-kit

Provides final code cleanup after task review approval. Removes debug logs, temporary comments, dead code, optimizes imports, and improves readability. Use when asked to clean up code, polish, finalize, tidy up, remove technical debt, or prepare code for completion after review. Not for refactoring logic or fixing bugs—focused solely on cosmetic and hygiene cleanup.

960 installsAudited