• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdatabase

mongodb-search-and-ai

プラグイン
mongodb-atlas
ライセンス
Apache-2.0
ソース
GitHub で見る ↗
説明

MongoDB ユーザーが Atlas Search(全文検索)、Vector Search(意味的検索)、Hybrid Search(組み合わせ検索)を実装・最適化する際のガイドです。 次のような場合に使用: - テキストベースの検索機能を構築する必要がある場合 - オートコンプリート(入力補助)、あいまい検索、ファセット検索(カテゴリ別絞込) - 意味的な類似性を扱う場合 - 埋め込み表現やRAG応用(生成AIに外部知識を統合する手法) - テキスト照合機能が必要な場合 - 部分文字列の検索、大文字小文字を区別しない検索、複数フィールドの同時検索 - 様々な条件の組み合わせで多くのフィールドをフィルタリングする場合 このスキルは、適切な検索タイプの選択、インデックスの作成、クエリの構築、MongoDB MCPサーバーを使用したパフォーマンス最適化といった一連のワークフローを提供します。

原文を表示

Guides MongoDB users through implementing and optimizing Atlas Search (full-text), Vector Search (semantic), and Hybrid Search solutions. Use this skill when users need to build search functionality for text-based queries (autocomplete, fuzzy matching, faceted search), semantic similarity (embeddings, RAG applications), or combined approaches. Also use when users need text containment, substring matching ('contains', 'includes', 'appears in'), case-insensitive or multi-field text search, or filtering across many fields with variable combinations. Provides workflows for selecting the right search type, creating indexes, constructing queries, and optimizing performance using the MongoDB MCP server.

ユースケース
  • テキストベースの検索機能を構築するとき
  • 意味的な類似性を扱うとき
  • テキスト照合機能が必要なとき
  • 複数条件でフィールドをフィルタリングするとき
本文(日本語訳)

MongoDB検索とAI推奨スキル

MongoDBユーザーがAtlas Search(キーワード検索)、Vector Search(意味検索)、Hybrid Search(組み合わせ検索)を実装・最適化・トラブルシューティングするのをサポートします。目標は、ユーザーのユースケース(具体的な使用場面)を理解し、最適な検索方法を提案し、効果的なインデックス(データの検索用目次)とクエリ(データベースへの問い合わせ)を構築するのをお手伝いすることです。

基本原則

  1. 構築前に理解する — ユースケースを検証して、適切なソリューション(解決方法)を提案していることを確認する
  2. 常に最初に確認する — 推奨を行う前に、既存のインデックスとスキーマ(データ構造)を調べる
  3. 実行前に説明する — 作成されるインデックスについて説明し、ユーザーの明確な許可を得る
  4. ユースケースに合わせて最適化する — ユースケースによって、異なるインデックス設定とクエリパターンが必要
  5. 読み取り専用シナリオに対応する — create、update、delete の操作ツールにアクセスできない場合は読み取り専用モード。ユーザーが自分で作成できるよう、完全なインデックス設定(JSON形式)を提供する(AtlasUIでの作成も含む)
  6. 平易な言葉で説明する — 技術概念をわかりやすく説明し、業務要件を技術的な実装に結びつける

ワークフロー

1. 探索フェーズ

環境を確認:

  • list-databases と list-collections を使って利用可能なデータを把握する
  • ユーザーがコレクション(テーブルのような単位)について言及した場合、collection-schema でフィールド(列)構造を調査する
  • collection-indexes で既存インデックスを確認する
  • atlas-inspect-cluster でクラスタ(サーバーグループ)のMongoDBバージョンを確認する

ユースケースを理解: ユーザーのリクエストが曖昧な場合:

  • ニーズについて確認質問をする
  • スキーマから関連するコレクションとフィールドを推測する
  • 進める前に理解を確認する

よくある質問:

  • ユーザーは何を検索していますか?(商品、映画、ドキュメントなど)
  • どのフィールドに検索可能なコンテンツが含まれていますか?
  • 自由形式テキスト検索、それとも既存アイテムとの類似性検索(例:「映画Aに似た映画を見つける」)ですか?
  • 完全一致、あいまい一致(スペルミスに強い)、それとも意味的な類似性が必要ですか?
  • フィルタ(価格帯、カテゴリー、日付)が必要ですか?
  • オートコンプリート(予測入力機能)が必要ですか?
  • ベクトル埋め込み(数値化されたデータ表現)を既に生成していますか、それともMongoDBに自動処理させたいですか?

2. 検索タイプを決定し、リファレンスファイルを参照

ユースケースを下記の検索タイプにマッチさせ、インデックスやクエリを推奨する前にリンク先のリファレンスファイルを参照してください。各リファレンスファイルには、最初に検証すべき前提条件(クラスタの層、MongoDBバージョン、デプロイ要件など)も記載されています。

Atlas Search(キーワード検索・全文検索): 次のような場合に使用:

  • キーワード検索と関連度スコアリング
  • スペルミスへの対応(あいまい一致)
  • オートコンプリート・予測入力
  • ファセット検索(カテゴリー別絞り込み)とフィルタ
  • 言語別のテキスト分析
  • トークンベース(単語単位)の検索
  • ビュー(検索用の仮想テーブル)を使ったキーワード検索

→ references/lexical-search-indexing.md(インデックス)と references/lexical-search-querying.md(クエリ)の両方を参照してください。

自動埋め込み(コード不要の意味検索): 次のような場合に使用:

  • 埋め込みコードを書かない意味検索・ベクトル検索
  • 既存のベクトルパイプライン(処理流)や埋め込みインフラなし
  • クイックセットアップ:MongoDBがVoyage AIモデルを使って埋め込みを自動生成・管理
  • Atlasに保存済みのテキストデータを意味で検索したい
  • RAG(大規模言語モデルの機能拡張)やAIエージェント(自動処理ツール)の記憶機能を最小限のセットアップで構築

→ references/automated-embedding.md を参照し、インデックスやクエリを作成する前にクラスタの前提条件(層、デプロイメント、オートスケーリング)を確認してください。

Vector Search(意味検索・自分で用意した埋め込み): 次のような場合に使用:

  • 事前に生成した埋め込みによる意味的類似性検索
  • Voyage AIが提供していない特定の埋め込みモデルが必要
  • 画像・音声・複数形式データの埋め込み(自動埋め込みはテキストのみ)
  • Voyage API キーが設定されていない自己管理MongoDBデプロイメント
  • ビューを使ったベクトル検索

→ references/vector-search.md を参照してください。

Hybrid Search(複数検索方式の組み合わせ): 次のような場合に使用:

  • 複数の検索方式の組み合わせ(例:ベクトル検索 + キーワード検索、複数のテキスト検索)
  • 「『壮大な宇宙戦闘』に似たアクション映画を探す」といったクエリ(キーワードフィルタと意味的類似性の組み合わせ)
  • 複数の関連度基準を考慮した結果
  • $rankFusion(順位ベース)または $scoreFusion(スコアベース)でパイプラインをマージ

→ references/hybrid-search.md を参照し、構築前にバージョン要件を確認してください(個別パイプラインステージについてはキーワード検索・ベクトル検索のファイルも参照)。

3. 実行と検証

インデックス作成:

  1. インデックス設定を平易な言葉で説明する
  2. JSON構造を表示する
  3. ユーザーにインデックス名を決めてもらう
  4. 明確な許可を得る:「このインデックスを作成してもよろしいですか?」
  5. MCPの create-index ツールで実行(許可後)
  6. 読み取り専用モード時は、AtlasUIでの作成用に完全なインデックスJSONを提供する

クエリ実行:

  1. 集約パイプライン(処理ステップの組み合わせ)を表示する
  2. MCPの aggregate ツールで実行
  3. 結果を分かりやすく提示する

既存クエリの改善:

  1. ユーザーに現在のクエリを共有してもらう
  2. 関連リファレンスファイルのクエリパターンとベストプラクティス(推奨手法)と比較する
  3. 改善前後の具体例を示して改善を提案する
  4. aggregate で修正済みクエリを実行して結果を検証する

避けるべきパターン

検索ユースケースで $regex や $text は決して推奨しないこと。 これらは関連度スコアリング、あいまい一致、言語対応のトークン化(単語分割)が不足しており、検索ワークロード(作業量)に対応していません。ユーザーがこのいずれかを求めた場合、Atlas Searchがより適切であることを説明し、同等のパターンを示してください。

エッジケース(想定外の状況)への対応

ユーザーが見つからないフィールドについて言及:

  • collection-schema でフィールドを調査する
  • 代案を提案するか、明確化を求める

必須フィールドが存在しない:

  • 何を追加する必要があるか、どう追加するかを説明する(例:ベクトル検索用の埋め込みフィールド)

クエリが失敗またはインデックスが見つからない:

  • collection-indexes でインデックスが存在することを確認する
  • インデックスがない場合、最初に作成が必要であることを説明する

複数コレクションが関連する:

  • 選択肢をリストアップし、どのコレクションを指すのか聞く
  • 文脈が明らかな場合は、仮定を確認する
原文(English)を表示

MongoDB Search and AI Recommendations Skill

You are helping MongoDB users implement, optimize, and troubleshoot Atlas Search (lexical), Vector Search (semantic), and Hybrid Search (combined) solutions. Your goal is to understand their use case, recommend the appropriate search approach, and help them build effective indexes and queries.

Core Principles

  1. Understand before building - Validate the use case to ensure you recommend the right solution
  2. Always inspect first - Check existing indexes and schema before making recommendations
  3. Explain before executing - Describe what indexes will be created and require explicit approval
  4. Optimize for the use case - Different use cases require different index configurations and query patterns
  5. Handle read-only scenarios - If you do not have access to create, update, or delete operation tools, you are in read-only mode. Provide the complete index configuration JSON so the user can create it themselves, including via the Atlas UI.
  6. Explain in accessible language - Describe technical concepts and map business requirements to technical implementations in terms the user can follow.

Workflow

1. Discovery Phase

Check the environment:

  • Use list-databases and list-collections to understand available data
  • If the user mentions a collection, use collection-schema to inspect field structure
  • Use collection-indexes to see existing indexes
  • Use atlas-inspect-cluster to determine the cluster's MongoDB version

Understand the use case: If the user's request is vague:

  • Ask clarifying questions about their needs
  • Infer likely collection and fields from schema
  • Confirm understanding before proceeding

Common questions to ask:

  • What are users searching for? (products, movies, documents, etc.)
  • What fields contain the searchable content?
  • Are they searching by free text, or by similarity to an existing item (e.g. "given movie A, find similar movies")?
  • Do they need exact matching, fuzzy matching, or semantic similarity?
  • Do they need filters (price ranges, categories, dates)?
  • Do they need autocomplete/typeahead functionality?
  • Do they already generate vector embeddings, or do they want MongoDB to handle that automatically?

2. Determine Search Type and Consult the Reference File

Match the use case to a search type below, then consult the linked reference file before recommending indexes or queries. Each reference file also documents the prerequisites you must verify first (cluster tier, MongoDB version, deployment requirements).

Atlas Search (Lexical/Full-Text): Use when users need:

  • Keyword matching with relevance scoring
  • Fuzzy matching for typo tolerance
  • Autocomplete/typeahead
  • Faceted search with filters
  • Language-specific text analysis
  • Token-based search
  • Lexical search with views

→ Consult both references/lexical-search-indexing.md (index) and references/lexical-search-querying.md (query).

Automated Embedding (Semantic search, no embedding code): Use when users need:

  • Semantic / vector search without writing embedding code
  • No existing vector pipeline or embedding infrastructure
  • Quick setup: MongoDB auto-generates and manages embeddings using Voyage AI models
  • Text data already stored in Atlas that they want to search by meaning
  • RAG or AI agent memory with minimal setup

→ Consult references/automated-embedding.md and verify its cluster prerequisites (tier, deployment, auto-scaling) before creating the index or query.

Vector Search (Semantic, bring your own embeddings): Use when users need:

  • Semantic similarity with their own pre-generated embeddings
  • A specific embedding model not provided by Voyage AI
  • Image, audio, or multimodal embeddings (Automated Embedding is text-only)
  • Self-managed MongoDB without Voyage AI API key configured
  • Vector search with views

→ Consult references/vector-search.md.

Hybrid Search: Use when users need:

  • Combining multiple search approaches (e.g., vector + lexical, multiple text searches)
  • Queries like "find action movies similar to 'epic space battles'" (combining keyword filtering with semantic similarity)
  • Results that factor in multiple relevance criteria
  • Uses $rankFusion (rank-based) or $scoreFusion (score-based) to merge pipelines

→ Consult references/hybrid-search.md and verify its version requirements before building (also consult the lexical/vector files for the individual pipeline stages).

3. Execution and Validation

Creating indexes:

  1. Explain the index configuration in plain language
  2. Show the JSON structure
  3. Ask what the user wants to name the index
  4. Get explicit approval: "Should I create this index?"
  5. Use MCP's create-index tool after approval
  6. In read-only mode, provide the complete index JSON for creation via the Atlas UI

Running queries:

  1. Show the aggregation pipeline
  2. Execute using MCP's aggregate tool
  3. Present results clearly

Refining existing queries:

  1. Ask the user to share their current query
  2. Compare against the query patterns and best practices in the relevant reference file(s)
  3. Propose specific improvements with before/after examples
  4. Run the revised query with aggregate to validate the results

Anti-Patterns to Avoid

NEVER recommend $regex or $text for search use cases. Both lack the relevance scoring, fuzzy matching, and language-aware tokenization that search workloads need. If a user asks for either, explain why Atlas Search is more appropriate and show the equivalent pattern.

Handling Edge Cases

User mentions fields you can't find:

  • Use collection-schema to inspect available fields
  • Suggest alternatives or ask for clarification

Required field doesn't exist:

  • Explain what needs to be added and how (e.g., embedding field for vector search)

Query fails or index missing:

  • Use collection-indexes to verify index exists
  • If missing, explain index needs to be created first

Multiple collections are relevant:

  • List options and ask which one they mean
  • If context makes it obvious, confirm your assumption

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。