• 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. 読み取り専用シナリオに対応する - 作成・更新・削除の操作ツールへのアクセスがない場合は、読み取り専用モードです。ユーザーが自分で作成できるよう、完全なインデックス設定をJSON形式で提供します(Atlas UIでの作成を含む)

作業フロー

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 prefilter パターン(vectorSearch オペレータを $search 内で使用)の場合は、次のステップに進みます。

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

インデックスまたはクエリを推奨する前に、常に適切なリファレンスファイルを確認:

  • Lexical: references/lexical-search-indexing.md(インデックス)と references/lexical-search-querying.md(クエリ)の両方を確認
  • Vector: references/vector-search.md を確認
  • Hybrid: references/hybrid-search.md を確認(内部の個別パイプラインステージについては lexical/vector ファイルも確認)

5. 実行と検証

インデックスの作成:

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

クエリの実行:

  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 による自動翻訳です。