rag-patterns
Vertex AI RAG Engine integration patterns for grounding agent responses in private data sources including corpus management, retrieval tool creation, and citation extraction. PROACTIVELY activate for: (1) RAG pipeline integration and Vertex AI RAG Engine setup, (2) corpus creation and document ingestion, (3) retrieval tool configuration and grounding metadata parsing.
npx skills add majiayu000/claude-skill-registry --skill rag-patterns-agentient-vibekit --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.
What it does
Guides the creation and management of a Vertex AI RAG corpus, ingestion of documents from Google Cloud Storage or local files, and the construction of a RAG-enabled agent with grounding capabilities and retrieval parameters. It also covers parsing grounding metadata to extract citations and formatting them for display, plus guidance for chunking and retrieval tuning to optimize RAG quality.
How it works
- Creates a RAG corpus with a display name and description, optionally configuring an embedding model.
- Lists or deletes corpora via provided functions.
- Ingests documents into a RAG corpus by importing files from GCS with configurable chunk_size and chunk_overlap.
- Uploads local files to a GCS bucket, then imports them into the RAG corpus.
- Lists files in a corpus to verify ingestion.
- Creates a RAG tool for an ADK agent by constructing a VertexRagStore with rag_resources, similarity_top_k, and vector_distance_threshold, and attaches it to an LlmAgent with a system_instruction.
- Configures an advanced RAG tool allowing multiple corpora and adjustable top_k and distance_threshold values.
- Queries a RAG-enabled agent and extracts grounding metadata to build citations with uri, text, start_index, end_index, and confidence fields.
- Formats responses with inline citations by appending a Sources section that lists each citation with a file name and an excerpt.
- Provides RAG quality optimization tips for chunking and retrieval, including recommended defaults and scenarios (short docs, long-form content, FAQs).
- Demonstrates a complete end-to-end example: creating a RAG corpus, uploading documents, creating a RAG agent, and testing with queries.
When to use it
Use when you need to ground agent responses in private or domain-specific data using Vertex AI RAG Engine: (1) set up and integrate the RAG pipeline, (2) create and ingest a corpus, (3) configure retrieval tools and grounding metadata parsing.
What it can touch
- Codes and functions for: importing files to a RAG corpus, listing corpora, deleting corpora, uploading local files to GCS, listing corpus files.
- Tools and objects from: google.cloud.aiplatform.rag, google.cloud.aiplatform, google.genai.types, google.genai.Client.
- Resource identifiers used in examples: corpus_name (full resource name), gcs_uris, chunk_size, chunk_overlap, top_k, distance_threshold, and various corpus/resource names.
Caveats
- The material contains example code snippets that assume environment variables (GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION) and proper Google Cloud access.
- It specifies parameters like similarity_top_k and vector_distance_threshold with example values, but real-world results depend on data and model configuration.
- No guarantees of indexing duration; notes suggest wait times (e.g., 2-5 minutes) for indexing in examples.
# RAG Patterns: Vertex AI RAG Engine Integration ## Core Principles Retrieval-Augmented Generation (RAG) grounds AI agent responses in authoritative data sources, dramatically reducing hallucinations and enabling agents to answer questions about private, domain-specific information not in their training data. **Vertex AI RAG Engine** provides a managed service for the complete RAG pipeline: ingestion, embedding, indexing, retrieval, and citation generation. ## RAG Process Overview ### The 5-Stage RAG Pipeline ``` 1. INGEST └─> Upload documents (PDF, TXT, HTML, etc.) to GCS 2. TRANSFORM & CHUNK └─> Split documents into semantic chunks (typically 500-1000 tokens) 3. EMBED └─> Generate vector embeddings for each chunk using embedding model 4. INDEX └─> Store embeddings in vector database (Vertex AI RAG Corpus) 5. RETRIEVE & GENERATE └─> At query time: a. Embed user query b. Find semantically similar chunks (vector search) c. Pass chunks to LLM as context d. Generate grounded response with citations ``` ## Corpus Management (Required Pattern) ### Creating a RAG Corpus ```python """ Create and manage Vertex AI RAG corpus for private knowledge base. """ import os from google.cloud import
- Core Principles
- RAG Process Overview
- The 5-Stage RAG Pipeline
- Corpus Management (Required Pattern)
- Creating a RAG Corpus
- Listing Existing Corpora
- Deleting a Corpus
- Document Ingestion (Required Pattern)
- Upload Documents from Google Cloud Storage
- Upload Local Files (via GCS)
- Listing Files in Corpus
- ADK Agent Integration (Production Pattern)
- Creating RAG Tool for Agent
- Configuring Retrieval Parameters
What does the rag-patterns skill do?
Vertex AI RAG Engine integration patterns for grounding agent responses in private data sources including corpus management, retrieval tool creation, and citation extraction. PROACTIVELY activate for: (1) RAG pipeline integration and Vertex AI RAG Engine setup, (2) corpus creation and document ingestion, (3) retrieval tool configuration and grounding metadata parsing.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill rag-patterns-agentient-vibekit --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.
