Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
Claude Skills Maintainers avatar

Google Gemini File Search

  • 196 repo stars
  • Updated July 25, 2026
  • secondsky/claude-skills

Add managed RAG with Google Gemini File Search across 100+ file formats for document Q&A and knowledge bases on Gemini 3 Pro/Flash.

About

A skill for using Google Gemini File Search to add managed retrieval-augmented generation across 100+ file formats. Developers use it for document Q&A and knowledge bases on Gemini 3 Pro/Flash, and to handle immutability errors, quota issues, and polling failures.

  • Managed RAG
  • 100+ file formats
  • Document Q&A & knowledge bases
  • Gemini 3 Pro/Flash

Google Gemini File Search by the numbers

  • Data as of Jul 28, 2026 (Skillselion catalog sync)
/plugin marketplace add secondsky/claude-skills
/plugin install google-gemini-file-search@claude-skills

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
repo stars196
Last updatedJuly 25, 2026
Repositorysecondsky/claude-skills

What it does

Add managed RAG with Google Gemini File Search across 100+ file formats for document Q&A and knowledge bases on Gemini 3 Pro/Flash.

README.md

Google Gemini File Search Skill

Fully managed RAG (Retrieval-Augmented Generation) for document Q&A, knowledge bases, and semantic search using Google Gemini's File Search API

Auto-Trigger Keywords

This skill automatically activates when you mention:

Primary Keywords:

  • file search
  • gemini rag
  • document search
  • knowledge base
  • semantic search
  • google embeddings
  • file upload gemini
  • managed rag
  • automatic citations
  • document qa
  • retrieval augmented generation
  • vector search gemini
  • grounding
  • file indexing

Use Case Keywords:

  • customer support knowledge base
  • internal documentation search
  • legal document analysis
  • research paper search
  • code documentation search
  • product information retrieval
  • FAQ search
  • manual indexing

Technical Keywords:

  • @google/genai
  • gemini file search api
  • gemini embeddings
  • document chunking
  • metadata filtering
  • file search store
  • grounding metadata

What This Skill Does

This skill provides complete setup guidance for Google Gemini File Search—a fully managed RAG system that eliminates the need for separate vector databases or custom embedding code. Simply upload documents (PDFs, Word, Excel, code files, etc.) and query them using natural language.

Key Capabilities:

  • 🗂️ 100+ File Formats: Automatic text extraction from PDFs, Word, Excel, PowerPoint, Markdown, JSON, CSV, code files
  • 🧠 Semantic Search: Vector-based search understands meaning and context, not just keywords
  • 📑 Built-in Citations: Grounding metadata automatically points to specific document sections
  • ⚙️ Configurable Chunking: Control chunk size and overlap for optimal retrieval
  • 🏷️ Metadata Filtering: Filter queries by up to 20 custom key-value pairs per document
  • 💰 Cost-Effective: $0.15/1M tokens for one-time indexing, free storage (up to limits)

When to Use This Skill

✅ Use Gemini File Search when:

  • Building document Q&A systems (customer support, internal docs)
  • Creating searchable knowledge bases (wikis, policies, manuals)
  • Implementing semantic search over custom data
  • Need automatic citations for compliance/transparency
  • Want managed RAG without vector DB setup
  • Cost predictability matters (pay-per-indexing, not storage)

❌ Use alternatives when:

  • Need custom embedding models → Use Cloudflare Vectorize
  • Documents update frequently → Consider streaming alternatives
  • Building conversational AI agents → Use OpenAI Assistants or Claude MCP
  • Need global edge performance → Use Cloudflare AutoRAG

Errors Prevented (8 Total)

This skill prevents common implementation errors:

  1. Document Immutability - Documents can't be edited after indexing (must delete+re-upload)
  2. Storage Quota Calculation - Storage = 3x input size (includes embeddings)
  3. Incorrect Chunking Config - Default settings may not be optimal (500 tokens/chunk recommended)
  4. Metadata Limits - Max 20 custom key-value pairs per document
  5. Indexing Cost Surprises - One-time $0.15/1M tokens can add up for large corpora
  6. Operation Polling - Must poll operation status until done: true
  7. Force Delete Required - Stores with documents require force: true to delete
  8. Unsupported Models - Only Gemini 2.5 Pro/Flash supported (not 1.5 models)

What's Included

📖 Comprehensive Documentation

  • Complete setup guide with TypeScript/JavaScript examples
  • 8 documented common errors with prevention strategies
  • Chunking best practices for different content types
  • Metadata schema design patterns
  • Cost optimization techniques
  • Comparison guide (vs Vectorize, OpenAI Files API, Claude MCP)

🛠️ CLI Scripts

  • scripts/create-store.ts - Create and manage file search stores
  • scripts/upload-batch.ts - Batch document upload with progress tracking
  • scripts/query-store.ts - Interactive query tool with citation display
  • scripts/cleanup.ts - Delete stores and documents

📦 Working Templates

  1. basic-node-rag/ - Minimal Node.js/TypeScript example (learning, prototyping)
  2. cloudflare-worker-rag/ - Edge deployment with Cloudflare Workers + R2 integration
  3. nextjs-docs-search/ - Full-stack Next.js app with upload UI and search interface

📚 Reference Documentation

  • references/api-reference.md - Complete API documentation
  • references/chunking-best-practices.md - Detailed chunking strategies
  • references/pricing-calculator.md - Cost estimation guide
  • references/migration-from-openai.md - Migration from OpenAI Files API

Quick Start

import { GoogleGenAI } from '@google/genai'
import fs from 'fs'

// 1. Initialize client
const ai = new GoogleGenAI({
  apiKey: process.env.GOOGLE_API_KEY
})

// 2. Create file search store
const fileStore = await ai.fileSearchStores.create({
  config: { displayName: 'my-knowledge-base' }
})

// 3. Upload documents
const operation = await ai.fileSearchStores.uploadToFileSearchStore({
  name: fileStore.name,
  file: fs.createReadStream('./docs/manual.pdf'),
  config: {
    displayName: 'Installation Manual',
    customMetadata: {
      doc_type: 'manual',
      version: '1.0'
    },
    chunkingConfig: {
      whiteSpaceConfig: {
        maxTokensPerChunk: 500,
        maxOverlapTokens: 50
      }
    }
  }
})

// 4. Poll until indexing complete
while (!operation.done) {
  await new Promise(resolve => setTimeout(resolve, 1000))
  operation = await ai.operations.get({ name: operation.name })
}

// 5. Query with natural language
const response = await ai.models.generateContent({
  model: 'gemini-2.5-flash',
  contents: 'What are the safety precautions for installation?',
  config: {
    tools: [{
      fileSearch: { fileSearchStoreNames: [fileStore.name] }
    }]
  }
})

console.log('Answer:', response.text)

// 6. Access citations
const grounding = response.candidates[0].groundingMetadata
console.log('Sources:', grounding.groundingChunks)

Prerequisites

Supported File Formats

Documents: PDF, Word (.docx), Excel (.xlsx), PowerPoint (.pptx), Text (.txt), Markdown (.md), RTF

Code: JavaScript (.js), TypeScript (.ts), Python (.py), Java (.java), C++ (.cpp), Go (.go), Rust (.rs), Ruby (.rb), PHP (.php), Swift (.swift), Kotlin (.kt), and 50+ more

Data: JSON (.json), CSV (.csv), XML (.xml), YAML (.yaml)

Max File Size: 100 MB per file

Comparison with Alternatives

Feature Gemini File Search Cloudflare Vectorize OpenAI Files API
Setup Simple Moderate Simple
File Formats 100+ Manual 20+
Max File Size 100 MB N/A 512 MB
Custom Embeddings No Yes No
Citations Yes Manual Yes
Pricing Pay-per-index Usage-based Storage-based
Free Tier 1 GB Developer 1 GB

Examples

Customer Support Knowledge Base

// Upload support docs
await ai.fileSearchStores.uploadToFileSearchStore({
  name: fileStore.name,
  file: fs.createReadStream('./support/faq.pdf'),
  config: {
    customMetadata: {
      doc_type: 'faq',
      product: 'widget-pro',
      language: 'en'
    }
  }
})

// Query with metadata filtering
const response = await ai.models.generateContent({
  model: 'gemini-2.5-flash',
  contents: 'How do I reset the device?',
  config: {
    tools: [{
      fileSearch: {
        fileSearchStoreNames: [fileStore.name],
        metadataFilter: 'doc_type="troubleshooting" AND product="widget-pro"'
      }
    }]
  }
})

Code Documentation Search

// Upload API docs and examples
await ai.fileSearchStores.uploadToFileSearchStore({
  name: fileStore.name,
  file: fs.createReadStream('./docs/api-reference.md'),
  config: {
    customMetadata: {
      doc_type: 'api-reference',
      language: 'typescript',
      version: '1.0'
    },
    chunkingConfig: {
      whiteSpaceConfig: {
        maxTokensPerChunk: 500,  // Smaller chunks for code precision
        maxOverlapTokens: 50
      }
    }
  }
})

Legal Document Analysis

// Upload contracts with fine-grained chunking
await ai.fileSearchStores.uploadToFileSearchStore({
  name: fileStore.name,
  file: fs.createReadStream('./legal/contract.pdf'),
  config: {
    customMetadata: {
      doc_type: 'contract',
      jurisdiction: 'US',
      effective_date: '2025-01-01'
    },
    chunkingConfig: {
      whiteSpaceConfig: {
        maxTokensPerChunk: 300,  // Very small chunks for high precision
        maxOverlapTokens: 30
      }
    }
  }
})

Official Documentation

Version Information

  • Skill Version: 1.0.0
  • Last Verified: 2025-11-10
  • Package Version: @google/genai ^0.21.0
  • Supported Models: gemini-2.5-pro, gemini-2.5-flash
  • Node.js: >=18.0.0

License

MIT License - See LICENSE file for details

Maintainer

Jeremy Dawes (Jezweb)


Production Tested | Token Savings: ~65% | 8 Errors Prevented

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.