jpskill.com
🛠️ 開発・MCP コミュニティ

lancedb

AIアプリケーションで、サーバー不要かつ設定不要のベクトル検索を、ローカル環境でファイルのように手軽に実現し、テーブル作成からベクトル・全文・ハイブリッド検索、マルチモーダル埋め込みまで対応するSkill。

📜 元の英語説明(参考)

Embedded vector database with LanceDB — serverless, zero-config vector search for AI applications. Use when someone asks to "vector search without a server", "embedded vector database", "LanceDB", "local vector search", "serverless vector DB", "vector search in a file", or "lightweight RAG storage". Covers table creation, vector search, full-text search, hybrid search, and multimodal embeddings.

🇯🇵 日本人クリエイター向け解説

一言でいうと

AIアプリケーションで、サーバー不要かつ設定不要のベクトル検索を、ローカル環境でファイルのように手軽に実現し、テーブル作成からベクトル・全文・ハイブリッド検索、マルチモーダル埋め込みまで対応するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o lancedb.zip https://jpskill.com/download/15051.zip && unzip -o lancedb.zip && rm lancedb.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15051.zip -OutFile "$d\lancedb.zip"; Expand-Archive "$d\lancedb.zip" -DestinationPath $d -Force; ri "$d\lancedb.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して lancedb.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → lancedb フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

LanceDB

概要

LanceDB は組み込み型のベクトルデータベースです。外部依存関係なしに、アプリケーションプロセス内で実行されます。Docker コンテナも、サーバーも、接続文字列も必要ありません。データは、ローカルディスクまたはオブジェクトストレージ (S3) 上に Lance 形式 (カラム型、ML に最適化) で保存されます。プロトタイピング、エッジデプロイメント、および個別のベクトルデータベースの実行が過剰なアプリケーションに最適です。

どのような時に使うか

  • RAG プロトタイプおよびローカル開発 (セットアップするインフラストラクチャなし)
  • ベクトル検索を必要とするエッジ/組み込みアプリケーション
  • AI 機能を備えたデスクトップアプリおよび CLI ツール
  • Pinecone/Qdrant には小さすぎるが、配列以上のものを必要とするプロジェクト
  • マルチモーダル検索 (同じインデックス内のテキスト + 画像)

手順

セットアップ

npm install @lancedb/lancedb
# オプション: 自動埋め込み生成用
npm install @lancedb/lancedb openai

基本的な使い方

// db.ts — LanceDB テーブルを作成して検索する
import * as lancedb from "@lancedb/lancedb";

// ローカルデータベースに接続する (必要に応じてディレクトリを作成する)
const db = await lancedb.connect("./my-vector-db");

// データでテーブルを作成する
const data = [
  { id: 1, text: "The cat sat on the mat", vector: [0.1, 0.2, 0.3, ...] },
  { id: 2, text: "Dogs are loyal companions", vector: [0.4, 0.5, 0.6, ...] },
  { id: 3, text: "Fish swim in the ocean", vector: [0.7, 0.8, 0.9, ...] },
];

const table = await db.createTable("documents", data);

// ベクトル検索 — 類似アイテムを検索する
const results = await table
  .vectorSearch([0.1, 0.2, 0.3, ...])  // クエリベクトル
  .limit(5)
  .toArray();

// results: [{ id: 1, text: "The cat sat on the mat", _distance: 0.001 }, ...]

自動埋め込みを使用する

// auto-embed.ts — LanceDB が自動的に埋め込みを生成する
import * as lancedb from "@lancedb/lancedb";
import { getRegistry } from "@lancedb/lancedb/embeddings";

const openai = getRegistry().get("openai")!.create({
  model: "text-embedding-3-small",
});

const db = await lancedb.connect("./my-db");

// 埋め込み関数でスキーマを定義する
const schema = lancedb
  .schema([
    lancedb.field("id", new lancedb.Int32()),
    lancedb.field("text", new lancedb.Utf8(), openai.sourceField()),
    lancedb.field("vector", openai.vectorField()),  // 自動生成
  ]);

const table = await db.createTable("docs", [
  { id: 1, text: "How to set up authentication" },
  { id: 2, text: "Database migration guide" },
  { id: 3, text: "Deploying to production" },
], { schema });

// テキストで検索する — 埋め込みが自動的に生成される
const results = await table
  .search("how do I deploy my app?")
  .limit(3)
  .toArray();

フルテキスト + ベクトルハイブリッド検索

// hybrid.ts — キーワード検索とセマンティック検索を組み合わせる
const table = await db.openTable("documents");

// フルテキスト検索インデックスを作成する
await table.createIndex("text", { config: lancedb.Index.fts() });

// ハイブリッド検索: ベクトル類似度 + キーワードマッチングを組み合わせる
const results = await table
  .search("deploy production", { queryType: "hybrid" })
  .limit(10)
  .toArray();

フィルタリング

// filter.ts — メタデータフィルターを使用したベクトル検索
const results = await table
  .vectorSearch(queryVector)
  .where("category = 'docs' AND created_at > '2026-01-01'")
  .limit(10)
  .toArray();

例 1: ローカル RAG チャットボットを構築する

ユーザープロンプト: 「外部サービスなしで、ローカルドキュメントに関する質問に答えるチャットボットを構築してください。」

エージェントは、ローカルにドキュメントの埋め込みを保存するために組み込まれた LanceDB を使用し、検索関数を構築し、生成のためにローカル LLM (Ollama) に接続します。

例 2: CLI ツールのセマンティック検索

ユーザープロンプト: 「意味でメモを検索できるように、メモ取り CLI にセマンティック検索を追加してください。」

エージェントは、アプリのデータディレクトリに LanceDB データベースを作成し、保存時にメモを埋め込み、意味的に類似したメモを検索する検索コマンドを追加します。

ガイドライン

  • 組み込み = サーバーなし — プロセス内で実行され、データはディレクトリに保存されます
  • Lance 形式 — カラム型、圧縮、ML ワークロードに高速
  • S3 互換ストレージ — クラウドの場合は lancedb.connect("s3://bucket/path")
  • 自動埋め込み — 埋め込み関数を登録すると、手動で埋め込む必要はもうありません
  • ハイブリッド検索 — ベクトル + フルテキストを組み合わせて最適な結果を得る
  • SQL ライクな構文でのフィルタリングwhere("category = 'docs'")
  • スケール用の IVF-PQ インデックス — テーブルが 100K 行を超える場合にインデックスを作成する
  • データバージョニングが組み込み — Lance 形式はタイムトラベルをサポートしています
  • 接続プーリングなし — 組み込みであるため、開いて使用するだけです
  • プロトタイピングに最適 — LanceDB から始めて、必要に応じてホスト型に移行します
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

LanceDB

Overview

LanceDB is an embedded vector database — it runs inside your application process with zero external dependencies. No Docker containers, no servers, no connection strings. Data is stored in Lance format (columnar, optimized for ML) on local disk or object storage (S3). Perfect for prototyping, edge deployments, and applications where running a separate vector database is overkill.

When to Use

  • RAG prototypes and local development (no infrastructure to set up)
  • Edge/embedded applications that need vector search
  • Desktop apps and CLI tools with AI features
  • Projects too small for Pinecone/Qdrant but need more than arrays
  • Multimodal search (text + images in same index)

Instructions

Setup

npm install @lancedb/lancedb
# Optional: for automatic embedding generation
npm install @lancedb/lancedb openai

Basic Usage

// db.ts — Create a LanceDB table and search
import * as lancedb from "@lancedb/lancedb";

// Connect to local database (creates directory if needed)
const db = await lancedb.connect("./my-vector-db");

// Create a table with data
const data = [
  { id: 1, text: "The cat sat on the mat", vector: [0.1, 0.2, 0.3, ...] },
  { id: 2, text: "Dogs are loyal companions", vector: [0.4, 0.5, 0.6, ...] },
  { id: 3, text: "Fish swim in the ocean", vector: [0.7, 0.8, 0.9, ...] },
];

const table = await db.createTable("documents", data);

// Vector search — find similar items
const results = await table
  .vectorSearch([0.1, 0.2, 0.3, ...])  // Query vector
  .limit(5)
  .toArray();

// results: [{ id: 1, text: "The cat sat on the mat", _distance: 0.001 }, ...]

With Automatic Embeddings

// auto-embed.ts — LanceDB generates embeddings automatically
import * as lancedb from "@lancedb/lancedb";
import { getRegistry } from "@lancedb/lancedb/embeddings";

const openai = getRegistry().get("openai")!.create({
  model: "text-embedding-3-small",
});

const db = await lancedb.connect("./my-db");

// Define schema with embedding function
const schema = lancedb
  .schema([
    lancedb.field("id", new lancedb.Int32()),
    lancedb.field("text", new lancedb.Utf8(), openai.sourceField()),
    lancedb.field("vector", openai.vectorField()),  // Auto-generated
  ]);

const table = await db.createTable("docs", [
  { id: 1, text: "How to set up authentication" },
  { id: 2, text: "Database migration guide" },
  { id: 3, text: "Deploying to production" },
], { schema });

// Search with text — embedding generated automatically
const results = await table
  .search("how do I deploy my app?")
  .limit(3)
  .toArray();

Full-Text + Vector Hybrid Search

// hybrid.ts — Combine keyword and semantic search
const table = await db.openTable("documents");

// Create full-text search index
await table.createIndex("text", { config: lancedb.Index.fts() });

// Hybrid search: combines vector similarity + keyword matching
const results = await table
  .search("deploy production", { queryType: "hybrid" })
  .limit(10)
  .toArray();

Filtering

// filter.ts — Vector search with metadata filters
const results = await table
  .vectorSearch(queryVector)
  .where("category = 'docs' AND created_at > '2026-01-01'")
  .limit(10)
  .toArray();

Examples

Example 1: Build a local RAG chatbot

User prompt: "Build a chatbot that answers questions about local documents without any external services."

The agent will use LanceDB embedded to store document embeddings locally, build a search function, and connect to a local LLM (Ollama) for generation.

Example 2: Semantic search for a CLI tool

User prompt: "Add semantic search to my note-taking CLI so I can find notes by meaning."

The agent will create a LanceDB database in the app's data directory, embed notes on save, and add a search command that finds semantically similar notes.

Guidelines

  • Embedded = no server — runs in your process, data in a directory
  • Lance format — columnar, compressed, fast for ML workloads
  • S3-compatible storagelancedb.connect("s3://bucket/path") for cloud
  • Auto-embeddings — register an embedding function, never manually embed again
  • Hybrid search — combine vector + full-text for best results
  • Filtering with SQL-like syntaxwhere("category = 'docs'")
  • IVF-PQ index for scale — create index when table exceeds 100K rows
  • Data versioning built-in — Lance format supports time travel
  • No connection pooling — it's embedded, just open and use
  • Great for prototyping — start with LanceDB, migrate to hosted if needed