Agent skill

Cloudflare Vectorize

by secondsky in secondsky/claude-skills

Cloudflare Vectorize vector database for semantic search and RAG.

MITAuto-check passedAI & LLM Engineering

Install Cloudflare Vectorize

skills CLI
$ npx skills add secondsky/claude-skills --skill cloudflare-vectorize -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install secondsky/claude-skills cloudflare-vectorize --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/cloudflare-vectorize/skills/cloudflare-vectorize .claude/skills/cloudflare-vectorize && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cloudflare-vectorize
GitHub stars
227
Token cost
~3.3k tokens
SKILL.md length
781 words
Files
12 (incl. references)
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

Cloudflare Vectorize vector database for semantic search and RAG.

  • Works in 4 steps: basic-search.ts - Simple vector search… → rag-chat.ts - Full RAG chatbot with… → document-ingestion.ts - Document… → …
  • Similarity search
  • SKILL.md covers What This Skill Provides, Critical Setup Rules, Wrangler Configuration and TypeScript Types, plus 9 more sections
  • Runs TypeScript scripts from its folder; calls bunx and npm

What it does

Cloudflare Vectorize is an agent skill from secondsky/claude-skills. Cloudflare Vectorize vector database for semantic search and RAG. Use for vector indexes, embeddings, similarity search, or encountering dimension mismatches, filter errors.

Its SKILL.md is about 3.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 13 other files, including reference files (for example `references/embedding-models.md`, `references/index-operations.md` and `references/integration-openai-embeddings.md`).

It sits in AI & LLM Engineering, covering Vector databases, Embeddings and Retrieval-augmented generation. It works with Cloudflare, Cloudflare Workers and Workers AI. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Similarity search
  • Encountering dimension mismatches

Example prompts

  • “/cloudflare-vectorize”

Requirements

  • Node.js

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. basic-search.ts - Simple vector search with Workers AI
  2. rag-chat.ts - Full RAG chatbot with context retrieval
  3. document-ingestion.ts - Document chunking and embedding pipeline
  4. metadata-filtering.ts - Advanced filtering examples

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (TypeScript), which the agent can run.

    Shell commands in SKILL.md call:

    • bunx
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developers.cloudflare.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cloudflare Vectorize loads about 3.3k tokens when it runs, and up to ~20k if it reads all its reference files. Until then it costs about 49 tokens; SKILL.md has 781 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~49
When it runs · the whole SKILL.md, loaded when a task matches
~3.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~20k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 781 words, ~3,262 tokens.

Download SKILL.mdSave it as .claude/skills/cloudflare-vectorize/SKILL.md (or your agent's skills folder). This skill also uses 11 other files; get the full folder from GitHub.
name
cloudflare-vectorize
description
Cloudflare Vectorize vector database for semantic search and RAG. Use for vector indexes, embeddings, similarity search, or encountering dimension mismatches, filter errors.
metadata.keywords
vectorize, vector database, vector index, vector search, similarity search, semantic search, nearest neighbor, knn search, ann search, RAG, retrieval…
license
MIT

Cloudflare Vectorize

Complete implementation guide for Cloudflare Vectorize - a globally distributed vector database for building semantic search, RAG (Retrieval Augmented Generation), and AI-powered applications with Cloudflare Workers.

Status: Production Ready ✅ Last Updated: 2025-11-21 Dependencies: cloudflare-worker-base (for Worker setup), cloudflare-workers-ai (for embeddings) Latest Versions: wrangler@4.81.0, @cloudflare/workers-types@4.20260408.0 Token Savings: ~65% Errors Prevented: 8 Dev Time Saved: ~3 hours

What This Skill Provides

Core Capabilities
  • ✅ Index Management: Create, configure, and manage vector indexes
  • ✅ Vector Operations: Insert, upsert, query, delete, and list vectors
  • ✅ Metadata Filtering: Advanced filtering with 10 metadata indexes per index
  • ✅ Semantic Search: Find similar vectors using cosine, euclidean, or dot-product metrics
  • ✅ RAG Patterns: Complete retrieval-augmented generation workflows
  • ✅ Workers AI Integration: Native embedding generation with @cf/baai/bge-base-en-v1.5
  • ✅ OpenAI Integration: Support for text-embedding-3-small/large models
  • ✅ Document Processing: Text chunking and batch ingestion pipelines
Templates Included
  1. basic-search.ts - Simple vector search with Workers AI
  2. rag-chat.ts - Full RAG chatbot with context retrieval
  3. document-ingestion.ts - Document chunking and embedding pipeline
  4. metadata-filtering.ts - Advanced filtering examples

Critical Setup Rules

⚠️ MUST DO BEFORE INSERTING VECTORS
bash
# 1. Create the index with FIXED dimensions and metric
bunx wrangler vectorize create my-index \
  --dimensions=768 \
  --metric=cosine

# 2. Create metadata indexes IMMEDIATELY (before inserting vectors!)
bunx wrangler vectorize create-metadata-index my-index \
  --property-name=category \
  --type=string

bunx wrangler vectorize create-metadata-index my-index \
  --property-name=timestamp \
  --type=number

Why: Metadata indexes MUST exist before vectors are inserted. Vectors added before a metadata index was created won't be filterable on that property.

Index Configuration (Cannot Be Changed Later)
bash
# Dimensions MUST match your embedding model output:
# - Workers AI @cf/baai/bge-base-en-v1.5: 768 dimensions
# - OpenAI text-embedding-3-small: 1536 dimensions
# - OpenAI text-embedding-3-large: 3072 dimensions

# Metrics determine similarity calculation:
# - cosine: Best for normalized embeddings (most common)
# - euclidean: Absolute distance between vectors
# - dot-product: For non-normalized vectors

Wrangler Configuration

wrangler.jsonc:

jsonc
{
  "name": "my-vectorize-worker",
  "main": "src/index.ts",
  "compatibility_date": "2025-10-21",
  "vectorize": [
    {
      "binding": "VECTORIZE_INDEX",
      "index_name": "my-index"
    }
  ],
  "ai": {
    "binding": "AI"
  }
}

TypeScript Types

typescript
export interface Env {
  VECTORIZE_INDEX: VectorizeIndex;
  AI: Ai;
}

interface VectorizeVector {
  id: string;
  values: number[] | Float32Array | Float64Array;
  namespace?: string;
  metadata?: Record<string, string | number | boolean | string[]>;
}

interface VectorizeMatches {
  matches: Array<{
    id: string;
    score: number;
    values?: number[];
    metadata?: Record<string, any>;
    namespace?: string;
  }>;
  count: number;
}

Common Operations

Quick Reference
OperationMethodKey Point
Insertinsert([...])Keeps first if ID exists
Upsertupsert([...])Overwrites if ID exists (use for updates)
Queryquery(vector, { topK, filter })Returns similar vectors
DeletedeleteByIds([...])Remove by ID array
GetgetByIds([...])Retrieve specific vectors
Filter Operators
OperatorExampleDescription
$eq{ category: "docs" }Equality (implicit)
$ne{ status: { $ne: "archived" } }Not equal
$in{ category: { $in: ["a", "b"] } }In array
$nin{ category: { $nin: ["x"] } }Not in array
$gte/$lt{ timestamp: { $gte: 123 } }Range queries

📄 Full operations guide: Load references/vector-operations.md for complete insert/upsert/query/delete examples with code.

Embedding Generation

ModelProviderDimensionsBest For
@cf/baai/bge-base-en-v1.5Workers AI768Free, general purpose
text-embedding-3-smallOpenAI1536Balance quality/cost
text-embedding-3-largeOpenAI3072Highest quality

📄 Integration guides:

  • Load references/integration-workers-ai-bge-base.md for Workers AI setup
  • Load references/integration-openai-embeddings.md for OpenAI integration

Metadata Best Practices

Key Limits
LimitValue
Max metadata indexes10 per index
Max metadata size10 KiB per vector
String indexFirst 64 bytes (UTF-8)
Filter sizeMax 2048 bytes
Invalid Key Characters

Keys cannot: be empty, contain . (reserved for nesting), contain ", or start with $.

📄 Complete metadata guide: Load references/metadata-guide.md for cardinality best practices, nested metadata, and advanced filtering patterns.

RAG Pattern (Full Example)

typescript
export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const { question } = await request.json();

    // 1. Generate embedding for user question
    const questionEmbedding = await env.AI.run('@cf/baai/bge-base-en-v1.5', {
      text: question
    });

    // 2. Search vector database for similar content
    const results = await env.VECTORIZE_INDEX.query(
      questionEmbedding.data[0],
      {
        topK: 3,
        returnMetadata: 'all',
        filter: { type: "documentation" }
      }
    );

    // 3. Build context from retrieved documents
    const context = results.matches
      .map(m => m.metadata.content)
      .join('\n\n---\n\n');

    // 4. Generate answer with LLM using context
    const answer = await env.AI.run('@cf/meta/llama-3-8b-instruct', {
      messages: [
        {
          role: "system",
          content: `Answer based on this context:\n\n${context}`
        },
        {
          role: "user",
          content: question
        }
      ]
    });

    return Response.json({
      answer: answer.response,
      sources: results.matches.map(m => m.metadata.title)
    });
  }
};

Document Chunking Strategy

Recommended chunk sizes: 300-500 characters for semantic coherence.

Key metadata for chunks:

  • doc_id: Parent document ID
  • chunk_index: Position in document
  • content: Text for retrieval display

📄 Full chunking implementation: See templates/document-ingestion.ts for complete chunking pipeline.

Common Errors & Solutions

Error 1: Metadata Index Created After Vectors Inserted
Problem: Filtering doesn't work on existing vectors
Solution: Delete and re-insert vectors OR create metadata indexes BEFORE inserting
Error 2: Dimension Mismatch
Problem: "Vector dimensions do not match index configuration"
Solution: Ensure embedding model output matches index dimensions:
  - Workers AI bge-base: 768
  - OpenAI small: 1536
  - OpenAI large: 3072
Error 3: Invalid Metadata Keys
Problem: "Invalid metadata key"
Solution: Keys cannot:
  - Be empty
  - Contain . (dot)
  - Contain " (quote)
  - Start with $ (dollar sign)
Error 4: Filter Too Large
Problem: "Filter exceeds 2048 bytes"
Solution: Simplify filter or split into multiple queries
Error 5: Range Query on High Cardinality
Problem: Slow queries or reduced accuracy
Solution: Use lower cardinality fields for range queries, or use seconds instead of milliseconds for timestamps
Error 6: Insert vs Upsert Confusion
Problem: Updates not reflecting in index
Solution: Use upsert() to overwrite existing vectors, not insert()
Error 7: Missing Bindings
Problem: "VECTORIZE_INDEX is not defined"
Solution: Add [[vectorize]] binding to wrangler.jsonc
Show full SKILL.md (311 more words)Show less
Error 8: Namespace vs Metadata Confusion
Problem: Unclear when to use namespace vs metadata filtering
Solution:
  - Namespace: Partition key, applied BEFORE metadata filters
  - Metadata: Flexible key-value filtering within namespace

Wrangler CLI Reference

Essential commands:

bash
# Create index (dimensions/metric are PERMANENT)
bunx wrangler vectorize create <name> --dimensions=768 --metric=cosine

# Create metadata index (MUST be before inserting vectors!)
bunx wrangler vectorize create-metadata-index <name> --property-name=category --type=string

# Get index info
bunx wrangler vectorize info <name>

📄 Full CLI reference: Load references/wrangler-commands.md for all vectorize commands.

Performance Tips

  1. Batch Operations: Insert/upsert in batches of 100-1000 vectors
  2. Selective Return: Only use returnValues: true when needed (saves bandwidth)
  3. Metadata Cardinality: Keep indexed metadata fields low cardinality for range queries
  4. Namespace Filtering: Apply namespace filter before metadata filters (processed first)
  5. Query Optimization: Use topK=3-10 for best latency (larger values increase search time)

When to Use This Skill

✅ Use Vectorize when:

  • Building semantic search over documents, products, or content
  • Implementing RAG chatbots with context retrieval
  • Creating recommendation engines based on similarity
  • Building multi-tenant applications (use namespaces)
  • Need global distribution and low latency

❌ Don't use Vectorize for:

  • Traditional relational data (use D1)
  • Key-value lookups (use KV)
  • Large file storage (use R2)
  • Real-time collaborative state (use Durable Objects)

When to Load References

Reference FileLoad When...
references/vector-operations.mdNeed full insert/upsert/query/delete code examples
references/metadata-guide.mdSetting up metadata indexes, filtering best practices
references/wrangler-commands.mdUsing Vectorize CLI commands
references/integration-workers-ai-bge-base.mdIntegrating Workers AI embeddings
references/integration-openai-embeddings.mdIntegrating OpenAI embeddings
references/embedding-models.mdComparing embedding model options
references/index-operations.mdIndex lifecycle management

Templates

TemplatePurpose
templates/basic-search.tsSimple vector search
templates/rag-chat.tsComplete RAG chatbot
templates/document-ingestion.tsDocument chunking pipeline
templates/metadata-filtering.tsAdvanced filtering

Secure Installation

When installing vector database packages, follow supply chain security best practices:

  • Block post-install scripts — npm config set ignore-scripts true (or Bun: disabled by default)
  • Cooldown period — Wait 7 days for new package versions to be vetted by the community
  • Audit before installing — Run socket package score npm <pkg> or use socket npm install <pkg> to check packages

Load the dependency-upgrade skill for full security configuration including Socket CLI integration, cooldown setup, lockfile validation, and CI enforcement.

Official Documentation


Version: 1.0.0 Status: Production Ready ✅ Token Savings: ~65% Errors Prevented: 8 major categories Dev Time Saved: ~2.5 hours per implementation

© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 11 other files (references) in plugins/cloudflare-vectorize/skills/cloudflare-vectorize of secondsky/claude-skills.

  • SKILL.md
  • references/embedding-models.md
  • references/index-operations.md
  • references/integration-openai-embeddings.md
  • references/integration-workers-ai-bge-base.md
  • references/metadata-guide.md
  • references/vector-operations.md
  • references/wrangler-commands.md
  • templates/basic-search.ts
  • templates/document-ingestion.ts
  • templates/metadata-filtering.ts
  • templates/rag-chat.ts

Open the folder on GitHubat commit 8837836

Compare with similar skills

Cloudflare Vectorize next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cloudflare Vectorize compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cloudflare Vectorize this skillsecondsky/claude-skills227—~3.3kAutomated safety check: PassMIT
Chroma Vector DatabaseOrchestra-Research/AI-Research-SKILLs13k8 repos~2.3kAutomated safety check: PassMIT
AI SDK Developmenttrypostit/trypost6762 repos~3.5kAutomated safety check: PassMIT
Retail Product Search Agentgoogle/adk-recipes10k—~3kAutomated safety check: PassApache-2.0
Pgvector Semantic Searchtimescale/pg-aiguide1.9k1 repos~3.8kAutomated safety check: PassApache-2.0
RAG ArchitectJeffallan/claude-skills12k1 repos~2kAutomated safety check: PassMIT

Similar skills

  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 8 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • AI SDK Development

    trypostit/trypost

    TRIGGER when working with ai-sdk which is Laravel official first-party AI SDK.

    676 GitHub starsUsed in 2 repos~3.5k tokens
    AI & LLM EngineeringAuto-check passed
  • Retail Product Search Agent

    google/adk-recipes

    Official

    Builds a retail product search agent on Google Cloud, from catalog ingestion into BigQuery and Vector Search to ADK scaffolding, evaluation and Cloud Run deployment.

    10k GitHub stars~3k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Pgvector Semantic Search

    timescale/pg-aiguide

    A skill your agent uses for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search.

    1.9k GitHub starsUsed in 1 repo~3.8k tokens
    AI & LLM EngineeringAuto-check passed
  • RAG Architect

    Jeffallan/claude-skills

    Designs retrieval-augmented generation systems: document chunking, embeddings, vector store setup, hybrid search, reranking and retrieval evaluation, with checks at each step.

    12k GitHub starsUsed in 1 repo~2k tokens
    AI & LLM EngineeringAuto-check passed
  • RAG Implementation

    wshobson/agents

    Build retrieval-augmented generation systems: pick a vector database and embedding model, choose retrieval and reranking strategies, and start from a LangGraph pipeline.

    40k GitHub starsUsed in 9 repos~1.1k tokens
    AI & LLM EngineeringAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Questions about Cloudflare Vectorize

What does Cloudflare Vectorize do?

Cloudflare Vectorize vector database for semantic search and RAG. Cloudflare Vectorize is an agent skill from secondsky/claude-skills. Cloudflare Vectorize vector database for semantic search and RAG.

When should I use Cloudflare Vectorize?

Cloudflare Vectorize fits situations like: similarity search; encountering dimension mismatches.

How do I install Cloudflare Vectorize in Claude Code?

Run `npx skills add secondsky/claude-skills --skill cloudflare-vectorize -a claude-code`. Or copy the skill folder (plugins/cloudflare-vectorize/skills/cloudflare-vectorize in secondsky/claude-skills) into .claude/skills/cloudflare-vectorize in your project. Claude Code loads it when a task matches its description.

How do I install Cloudflare Vectorize in Codex?

Run `npx skills add secondsky/claude-skills --skill cloudflare-vectorize -a codex`. Or copy the skill folder (plugins/cloudflare-vectorize/skills/cloudflare-vectorize in secondsky/claude-skills) into .agents/skills/cloudflare-vectorize in your project. Codex loads it when a task matches its description.

Can I use Cloudflare Vectorize in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add secondsky/claude-skills --skill cloudflare-vectorize -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cloudflare-vectorize, .gemini/skills/cloudflare-vectorize, .github/skills/cloudflare-vectorize and .opencode/skills/cloudflare-vectorize in your project.

What does Cloudflare Vectorize need to run?

Going by SKILL.md and its folder, Cloudflare Vectorize needs TypeScript for the scripts in its folder and the command-line tools its instructions call (bunx and npm). Our summary lists: Node.js.

Does Cloudflare Vectorize access the network?

SKILL.md names 1 domain. As links in the text: developers.cloudflare.com. This is read from the text; nothing was executed.

Is Cloudflare Vectorize safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Cloudflare Vectorize use?

Cloudflare Vectorize is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cloudflare Vectorize use?

About 3.3k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 17k tokens, read only when the agent opens those files.

What are the alternatives to Cloudflare Vectorize?

Skills that share tags, products or a category with Cloudflare Vectorize: Chroma Vector Database (Orchestra-Research/AI-Research-SKILLs, 13k stars), AI SDK Development (trypostit/trypost, 676 stars), Retail Product Search Agent (google/adk-recipes, 10k stars) and Pgvector Semantic Search (timescale/pg-aiguide, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cloudflare Vectorize?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.