• 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
ライセンス
Apache-2.0
ソース
GitHub で見る ↗
説明

MongoDB ユーザーが Atlas Search(フルテキスト検索)、Vector Search(意味的検索)、Hybrid Search(複合検索)を実装・最適化する過程をガイドします。 次のような場合に使用: - テキストベースの検索機能が必要な場合:オートコンプリート(入力補完)、あいまい検索、ファセット検索(カテゴリ別の絞り込み)など - 意味的な類似性を扱う場合:埋め込み表現、RAG(検索拡張生成)アプリケーションなど - 複数の検索方式を組み合わせる必要がある場合 - テキストの部分一致や包含関係の判定、大文字小文字を区別しない検索が必要な場合 - 複数のフィールドにわたる柔軟なフィルタリングが必要な場合 適切な検索タイプの選択、インデックスの作成、クエリの構築、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. 読み取り専用での対応 — 作成・更新・削除機能にアクセスできない場合は読み取り専用モード。ユーザーが自分で(Atlas UIを含む)作成できるよう、完全なインデックス設定をJSON形式で提供する

ワークフロー

1. 初期確認フェーズ

環境を確認:

  • list-databases と list-collections を使ってどのデータが利用可能か把握する
  • ユーザーが特定のコレクション(データの集まり)を言及している場合、collection-schema でフィールド構造を確認する
  • collection-indexes で既存のインデックスを確認する
  • atlas-inspect-cluster でクラスタの MongoDB バージョンを調べる

利用目的を理解: リクエストが曖昧な場合:

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

よくある質問:

  • ユーザーは何を検索したいのか?(商品、映画、ドキュメントなど)
  • どのフィールドに検索対象のコンテンツが含まれているか?
  • 完全一致、綴り間違い対応、または意味的な類似性が必要か?
  • フィルター(価格範囲、カテゴリ、日付)が必要か?
  • オートコンプリート(入力候補の自動表示)機能が必要か?

2. 検索タイプを判定

Atlas Search(キーワード検索): 以下のような場合に使用:

  • キーワードマッチングと関連度スコアリング
  • 綴り間違い対応の検索
  • オートコンプリート機能
  • ファセット検索(複数条件での絞り込み)
  • 言語別のテキスト分析
  • トークン(単語単位)での検索
  • キーワード検索ビューの利用

Vector Search(意味検索): 以下のような場合に使用:

  • 意味的な類似性(「成長物語の映画を探す」など)
  • 自然言語の理解
  • RAG(検索結果を活用した文章生成)アプリケーション
  • 概念的に似た項目を見つける
  • クロスモーダル検索(異なる形式のデータ間での検索)
  • ベクトル検索ビューの利用

Hybrid Search(組み合わせ検索): 以下のような場合に使用:

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

3. バージョン確認(Hybrid Search のみ)

検索タイプが Hybrid で $rankFusion または $scoreFusion を使う場合、先に進む前にクラスタバージョンを確認:

  • $rankFusion は MongoDB 8.0 以上が必要
  • $scoreFusion は MongoDB 8.2 以上が必要

バージョン要件を満たさない場合は進まない — ユーザーに機能が利用不可であることを伝え、アップグレードを提案する。references/hybrid-search.md は参照しない。

検索タイプが Lexical、Vector、または lexical プリフィルターパターン($search 内の vectorSearch オペレーター)の場合は、次のステップに進む。

4. リファレンスファイルを確認

インデックスまたはクエリを推奨する前に、必ず適切なリファレンスファイルを参照:

  • キーワード検索: references/lexical-search-indexing.md(インデックス)と references/lexical-search-querying.md(クエリ)の両方を参照
  • ベクトル検索: references/vector-search.md を参照
  • 組み合わせ検索: references/hybrid-search.md を参照(パイプライン内の個別ステップについては lexical/vector ファイルも参照)

5. 実行と検証

インデックスの作成:

  1. インデックス設定を平易な言葉で説明する
  2. JSON 構造を表示する
  3. ユーザーにインデックスの名前を尋ねる
  4. 明示的な承認を取る:「このインデックスを作成してよろしいですか?」
  5. 承認後、MCP の create-index ツールを使う
  6. 読み取り専用モードの場合は、完全なインデックス JSON を提供し、ユーザーが Atlas UI で作成できるようにする

クエリの実行:

  1. 集計パイプライン(複数ステップの処理)を表示する
  2. MCP の aggregate ツールで実行する
  3. 結果をわかりやすく表示する

既存クエリの改善:

  1. ユーザーの現在のクエリを共有してもらう
  2. 関連するリファレンスファイルのクエリパターンとベストプラクティスと比較する
  3. 改善案を具体的に示す(実行前後の例を含める)
  4. 改良したクエリを aggregate で実行して検証する

避けるべきパターン

$regex や $text を検索用途に推奨しないこと:

  • $regex: 全文検索向けではない。関連度スコアリング、綴り間違い対応、言語認識のトークン化がない。
  • $text: レガシーオペレーター(古い仕様)で、検索ワークロードではスケーラビリティが低い。

ユーザーが 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.

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?
  • Do they need exact matching, fuzzy matching, or semantic similarity?
  • Do they need filters (price ranges, categories, dates)?
  • Do they need autocomplete/typeahead functionality?

2. Determine Search Type

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

Vector Search (Semantic): Use when users need:

  • Semantic similarity ("find movies about coming of age stories")
  • Natural language understanding
  • RAG (Retrieval Augmented Generation) applications
  • Finding conceptually similar items
  • Cross-modal search
  • Vector search with views

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

3. Version Check (Hybrid Search only)

If the search type is Hybrid using $rankFusion or $scoreFusion, verify the cluster version before proceeding:

  • $rankFusion requires MongoDB 8.0+
  • $scoreFusion requires MongoDB 8.2+

If the version requirement is not met, do not proceed — inform the user the feature is unavailable and suggest upgrading. Do not consult references/hybrid-search.md.

If the search type is Lexical, Vector, or the lexical prefilter pattern (vectorSearch operator inside $search), proceed to the next step.

4. Consult Reference Files

Always consult the appropriate reference file(s) before recommending indexes or queries:

  • Lexical: consult both references/lexical-search-indexing.md (index) and references/lexical-search-querying.md (query)
  • Vector: consult references/vector-search.md
  • Hybrid: consult references/hybrid-search.md (and the lexical/vector files for the individual pipeline stages within it)

5. 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:

  • $regex: Not designed for full-text search. Lacks relevance scoring, fuzzy matching, and language-aware tokenization.
  • $text: Legacy operator that doesn't scale well for search workloads.

If a user asks for regex/text for a search use case, 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

Remember

  • Always check existing indexes before recommending new ones
  • Explain technical concepts in accessible language
  • Require approval before creating indexes
  • Map user's business requirements to technical implementations
  • Use the appropriate search type for the use case

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