Back to Skills

google-gemini-file-search

verified

Build document Q&A with Gemini File Search - fully managed RAG with automatic chunking, embeddings, and citations. Upload 100+ file formats, query with natural language. Use when: document Q&A, searchable knowledge bases, semantic search. Troubleshoot: document immutability, storage quota (3x), chunking config, metadata limits (20 max), polling timeouts.

View on GitHub

Marketplace

claude-skills

jezweb/claude-skills

Plugin

frontend

Repository

jezweb/claude-skills
211stars

skills/google-gemini-file-search/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/jezweb/claude-skills/blob/main/skills/google-gemini-file-search/SKILL.md -a claude-code --skill google-gemini-file-search

Installation paths:

Claude
.claude/skills/google-gemini-file-search/
Powered by add-skill CLI

Instructions

# Google Gemini File Search Setup

## Overview

Google Gemini File Search is a fully managed RAG system. Upload documents (100+ formats: PDF, Word, Excel, code) and query with natural language—automatic chunking, embeddings, semantic search, and citations.

**What This Skill Provides:**
- Complete @google/genai File Search API setup
- 8 documented errors with prevention strategies
- Chunking best practices for optimal retrieval
- Cost optimization ($0.15/1M tokens indexing, 3x storage multiplier)
- Cloudflare Workers + Next.js integration templates

## Prerequisites

### 1. Google AI API Key

Create an API key at https://aistudio.google.com/apikey

**Free Tier Limits:**
- 1 GB storage (total across all file search stores)
- 1,500 requests per day
- 1 million tokens per minute

**Paid Tier Pricing:**
- Indexing: $0.15 per 1M input tokens (one-time)
- Storage: Free (Tier 1: 10 GB, Tier 2: 100 GB, Tier 3: 1 TB)
- Query-time embeddings: Free (retrieved context counts as input tokens)

### 2. Node.js Environment

**Minimum Version:** Node.js 18+ (v20+ recommended)

```bash
node --version  # Should be >=18.0.0
```

### 3. Install @google/genai SDK

```bash
npm install @google/genai
# or
pnpm add @google/genai
# or
yarn add @google/genai
```

**Current Stable Version:** 1.30.0+ (verify with `npm view @google/genai version`)

**⚠️ Important:** File Search API requires **@google/genai v1.29.0 or later**. Earlier versions do not support File Search. The API was added in v1.29.0 (November 5, 2025).

### 4. TypeScript Configuration (Optional but Recommended)

```json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true
  }
}
```

## Common Errors Prevented

This skill prevents 8 common errors encountered when implementing File Search:

### Error 1: Document Immutability

**Symptom:**
```
Error: Documents cannot be modified after indexing
```

**Cause:** 

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
23861 chars