Rag builder

From oyi77/1ai-skills · View interactive version

Rag builder is an AI agent skill from the GitHub repository oyi77/1ai-skills. Use when rAG pipeline design — document chunking, embedding strategies, retrieval optimization, and answer generation. Use when working with rag builder.

How to use this skill

Skill file

Overview

Retrieval-Augmented Generation (RAG) is the standard pattern for grounding LLMs in your data. This skill covers the full pipeline: document loading, chunking strategies, embedding, vector storage, retrieval, and answer synthesis.

Capabilities

When to Use

Trigger phrases:

When NOT to Use

Pseudo Code

# Example workflow for this skill
def execute(input_data):
    # Step 1: Validate input
    if not input_data:
        raise ValueError("Input data is required")

    # Step 2: Process core logic
    result = process(input_data)

    # Step 3: Validate output
    validate_output(result)

    return result

Chunking Strategy

def chunk_document(doc, strategy="recursive", chunk_size=512, overlap=50):
    if strategy == "fixed":
        return split_by_chars(doc, chunk_size, overlap)
    elif strategy == "recursive":
        return recursive_split(doc, separators=["\n\n", "\n", ". ", " "], chunk_size=chunk_size)
    elif strategy == "semantic":
        return semantic_split(doc, similarity_threshold=0.8)

RAG Pipeline

def rag_query(question, vector_store, llm):
    # 1. Retrieve relevant chunks
    chunks = vector_store.similarity_search(question, k=5)
    
    # 2. Re-rank by relevance
    ranked = rerank(chunks, question, top_k=3)
    
    # 3. Synthesize answer with sources
    context = "\n\n".join([c.text for c in ranked])
    prompt = f"""Answer based on context. Cite sources.

Context:
{context}

Question: {question}

Answer with citations:"""
    
    return llm.generate(prompt)

Common Patterns

How to Use

  1. Invoke the skill when relevant domain keywords appear in the request
  2. Provide required inputs as specified in the skill definition
  3. Review the output for correctness before delivering to the user
  4. Combine with related skills for complex multi-step workflows

Verification

After completing this skill, confirm:

Process

  1. Analyze the task requirements
  2. Apply domain expertise
  3. Verify output quality

Anti-Rationalization Table

| Rationalization | Reality |

|---|---|

| "I will add monitoring later" | Without monitoring, you cannot detect failures. Add it from day one. |

| "One model is enough" | Different tasks need different models. Route intelligently. |

| "Premature optimization" | Infrastructure decisions are hard to change later. Design for scale early. |

Sub-Skills & Specialized Playbooks

| Sub-skill | File | Use when |

|---|---|---|

| ruvector | SKILL.md | Use when generating and managing vector embeddings for semantic search and RAG retrieval across knowledge bases. |

| zvec | SKILL.md | Use when performing zero-copy vector operations for efficient similarity search and embedding storage in agent memory systems. |

| vector-db-ops | SKILL.md | Use when indexing, querying, filtering, or managing embeddings in Pinecone, Weaviate, Qdrant, or ChromaDB. |

| llamaindex-patterns | SKILL.md | Use when building LlamaIndex ingestion, indexing, query engines, chat engines, or agents. |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.