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

semantic-code-hunter

Use when you need to find code by concept (not just text). Uses Serena MCP for semantic code search across the codebase with minimal token usage. Ideal for understanding architecture, finding authentication flows, or multi-file refactoring.

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して semantic-code-hunter.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → semantic-code-hunter フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Semantic Code Hunter (Serena MCP 搭載)

どのような時に使うか

  • 「X の処理はどこで行っているか?」という疑問
  • 認証フローの発見
  • バリデーションロジックの特定
  • 複数ファイルのリファクタリング
  • コンポーネント間の関係性の理解
  • シンボルのすべての使用箇所の発見
  • 依存関係の追跡

どのような時に使わないか

  • 小規模プロジェクト(10ファイル未満) - 代わりに Grep を使用
  • 単純なテキスト検索 - 代わりに Grep を使用
  • 単一ファイルの編集 - 代わりに Read を使用
  • 既に正確なファイルが分かっている場合

仕組み

Serena MCP ツールを使用して、セマンティックな理解を実現します。

  • find_symbol - 名前だけでなく、概念でシンボルを検索
  • find_referencing_symbols - コードの関係性を追跡
  • find_referencing_code_snippets - コードが使用されている場所を検索
  • get_symbols_overview - まずファイル構造を理解
  • トークン効率が良い(従来の検索と比較して70%の節約)

利用可能な Serena ツール

find_symbol

指定された名前/部分文字列を持つ、またはそれらを含むシンボルをグローバルまたはローカルに検索します。

例: find_symbol("authenticate")
検索結果: authenticateUser, isAuthenticated, AuthenticationService

find_referencing_symbols

別のシンボルを参照するシンボルを検索します。

例: find_referencing_symbols("User", type="function")
検索結果: User モデルを使用するすべての関数

get_symbols_overview

ファイル内のシンボルの概要を取得します。

例: get_symbols_overview("src/services/auth.ts")
戻り値: ファイル内のクラス、関数、エクスポートのリスト

search_for_pattern

プロジェクト全体のパターン検索(セマンティック検索では不十分な場合)。

使用パターン

ステップ 1: 概要から始める

ファイルが分かっている場合:
1. get_symbols_overview("path/to/file.ts")
2. 関連するシンボルを特定
3. find_symbol を使用して詳細を取得

ステップ 2: セマンティック検索

ファイルが分からない場合:
1. find_symbol("concept")
2. 結果を確認
3. find_referencing_symbols を使用して使用箇所を追跡

ステップ 3: ターゲットを絞った取得

必要なものが分かったら:
1. find_symbol を使用して特定のコードを取得
2. 関連するセクションのみをロード(ファイル全体ではない)
3. トークン消費を最小限に抑える

例 1: 認証フローの発見

タスク: 「ユーザー認証の処理はどこで行っているか?」

プロセス:
1. find_symbol("auth") - 認証関連のシンボルを検索
2. authenticateUser, validateToken などを特定
3. find_referencing_symbols("authenticateUser") - どこで呼び出されているか?
4. フローを追跡: ログインルート → 認証サービス → JWT 生成

結果: ファイル全体を読まずに、完全な認証フローをマッピング

例 2: 複数ファイルのリファクタリング

タスク: 「User モデルを Account にリネームする」

プロセス:
1. find_symbol("User") - User モデルを検索
2. find_referencing_symbols("User") - すべての使用箇所を検索
3. 更新が必要なすべてのファイルをリストアップ
4. rename_symbol (Serena ツール) を使用して安全にリファクタリング

結果: すべての参照箇所が見つかり、一貫してリネームされた

例 3: コンポーネント間の関係性の理解

タスク: 「ProjectCard コンポーネントはどのようにデータを取得しているか?」

プロセス:
1. find_symbol("ProjectCard")
2. find_referencing_symbols("ProjectCard") - どこで使用されているか?
3. データソースまで遡って追跡
4. データフローを理解

結果: API → ページ → コンポーネントの完全なデータフロー

ベストプラクティス

  1. 広く始めて、絞り込む

    • まず一般的な用語で find_symbol を使用
    • type (function, class, interface) で結果をフィルタリング
    • 次に、特定のシンボルの詳細を取得
  2. type フィルタを使用する

    • type="function" - 関数のみ
    • type="class" - クラスのみ
    • type="interface" - インターフェースのみ
  3. シンボル間の関係性を活用する

    • find_referencing_symbols は依存関係を示す
    • 変更の影響を理解するのに役立つ
    • アーキテクチャパターンを明らかにする
  4. 従来のツールと組み合わせる

    • セマンティックな理解には Serena を使用
    • 単純なテキストマッチには Grep を使用
    • 設定ファイルやドキュメントには Read を使用

トークン効率

従来のアプローチ (Serena を使用しない場合):

  1. ファイル全体を読み込む → 10,000+ トークン
  2. 複数回の grep 反復 → 5,000+ トークン
  3. 手動分析 → 高い認知負荷

Serena のアプローチ:

  1. find_symbol → 200 トークン
  2. ターゲットを絞った取得 → 500 トークン
  3. 合計: ~700 トークン (93% の節約)

トラブルシューティング

Serena が多すぎる結果を返す場合:

  • type フィルタを追加: type="function"
  • より具体的な検索語を使用
  • まず get_symbols_overview で特定のファイルを確認

Serena が結果を返さない場合:

  • スペルを確認 (大文字と小文字を区別)
  • より広範な検索語を試す
  • テキスト検索のために Grep にフォールバック
  • Serena がインデックスされていることを確認 (実行: serena project index)

シンボルが見つからない場合:

  • プロジェクトを再インデックス: serena project index
  • ファイルが .gitignore に含まれていないか確認
  • 言語サーバーがファイルタイプをサポートしているか確認
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Semantic Code Hunter (Powered by Serena MCP)

When to Use

  • "Where do we handle X?" questions
  • Finding authentication flows
  • Locating validation logic
  • Multi-file refactoring
  • Understanding component relationships
  • Finding all usages of a symbol
  • Tracing dependencies

When NOT to Use

  • Small projects (< 10 files) - use Grep instead
  • Simple text searches - use Grep instead
  • Single-file edits - use Read instead
  • You already know the exact file

How It Works

Uses Serena MCP tools for semantic understanding:

  • find_symbol - Find symbols by concept, not just name
  • find_referencing_symbols - Trace code relationships
  • find_referencing_code_snippets - Find where code is used
  • get_symbols_overview - Understand file structure first
  • Token-efficient (70% savings vs traditional search)

Serena Tools Available

find_symbol

Find symbols globally or locally with/containing a given name/substring.

Example: find_symbol("authenticate")
Finds: authenticateUser, isAuthenticated, AuthenticationService

find_referencing_symbols

Find symbols that reference another symbol.

Example: find_referencing_symbols("User", type="function")
Finds: All functions that use the User model

get_symbols_overview

Get high-level overview of symbols in a file.

Example: get_symbols_overview("src/services/auth.ts")
Returns: List of classes, functions, exports in file

search_for_pattern

Pattern search across project (when semantic search not sufficient).

Usage Pattern

Step 1: Start with Overview

If you know the file:
1. get_symbols_overview("path/to/file.ts")
2. Identify relevant symbols
3. Use find_symbol to get details

Step 2: Semantic Search

If you don't know the file:
1. find_symbol("concept")
2. Review results
3. Use find_referencing_symbols to trace usage

Step 3: Targeted Retrieval

Once you know what you need:
1. Use find_symbol to get specific code
2. Only loads relevant sections (not entire files)
3. Minimal token consumption

Examples

Example 1: Find Authentication Flow

Task: "Where do we handle user authentication?"

Process:
1. find_symbol("auth") - Find auth-related symbols
2. Identify: authenticateUser, validateToken, etc.
3. find_referencing_symbols("authenticateUser") - Where is it called?
4. Trace the flow: Login route → Auth service → JWT generation

Result: Complete authentication flow mapped without reading full files

Example 2: Multi-file Refactoring

Task: "Rename User model to Account"

Process:
1. find_symbol("User") - Find User model
2. find_referencing_symbols("User") - Find all usages
3. List all files that need updating
4. Use rename_symbol (Serena tool) for safe refactoring

Result: All references found and renamed consistently

Example 3: Understanding Component Relationships

Task: "How does ProjectCard component get data?"

Process:
1. find_symbol("ProjectCard")
2. find_referencing_symbols("ProjectCard") - Where is it used?
3. Trace backwards to data source
4. Understand the data flow

Result: Complete data flow from API → Page → Component

Best Practices

  1. Start broad, narrow down

    • Use find_symbol with general terms first
    • Filter results by type (function, class, interface)
    • Then get specific symbol details
  2. Use type filters

    • type="function" - Only functions
    • type="class" - Only classes
    • type="interface" - Only interfaces
  3. Leverage symbol relationships

    • find_referencing_symbols shows dependencies
    • Helps understand impact of changes
    • Reveals architectural patterns
  4. Combine with traditional tools

    • Serena for semantic understanding
    • Grep for simple text matches
    • Read for config files, documentation

Token Efficiency

Traditional approach (without Serena):

  1. Read entire files → 10,000+ tokens
  2. Multiple grep iterations → 5,000+ tokens
  3. Manual analysis → High cognitive load

Serena approach:

  1. find_symbol → 200 tokens
  2. Targeted retrieval → 500 tokens
  3. Total: ~700 tokens (93% savings)

Troubleshooting

If Serena returns too many results:

  • Add type filter: type="function"
  • Use more specific search term
  • Check specific file with get_symbols_overview first

If Serena returns no results:

  • Check spelling (case-sensitive)
  • Try broader search term
  • Fall back to Grep for text search
  • Ensure Serena is indexed (run: serena project index)

If symbols missing:

  • Re-index project: serena project index
  • Check if file is in .gitignore
  • Verify language server supports file type