context-tools
Context management tools for Claude Code - provides intelligent codebase mapping with Python, Rust, and C++ parsing, duplicate detection, and MCP-powered symbol queries. Use this skill when working with large codebases that need automated indexing and context management.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o context-tools.zip https://jpskill.com/download/17831.zip && unzip -o context-tools.zip && rm context-tools.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17831.zip -OutFile "$d\context-tools.zip"; Expand-Archive "$d\context-tools.zip" -DestinationPath $d -Force; ri "$d\context-tools.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
context-tools.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
context-toolsフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 10
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[Skill 名] context-tools
このスキルは、以下を通じて大規模なコードベースに対するインテリジェントなコンテキスト管理を提供します。
- リポジトリマッピング: Python、Rust、C++のコードを解析して、クラス、関数、メソッドを抽出します。
- 重複検出: ファジーマッチングを使用して類似のコードパターンを識別します。
- MCPシンボルサーバー:
search_symbolsおよびget_file_symbolsツールを介して高速なシンボル検索を可能にします。 - 自動インデックス作成: ファイルの変更に応じてバックグラウンドでインクリメンタルな更新を行います。
MCPツールの使用 - 主要なコード探索方法
⚡ 意思決定ツリー - Grep/Search/Bashを使用する前に自問してください:
コードシンボル(関数、クラス、enum、構造体、型)を検索していますか?
├─ はい → MCPツールを使用します(search_symbols / get_symbol_content / get_file_symbols)
│ 例: "enum InstructionData" を検索する場合 → search_symbols("InstructionData")
│ 例: "Phi" バリアントを検索する場合 → get_symbol_content("InstructionData")
│
└─ いいえ → テキスト/コメント/文字列/設定値を検索していますか?
└─ はい → Grep/Searchを使用します
例: 文字列リテラル、ドキュメント、JSON値を検索する場合
重要: 次のような場合は、最初にリポジトリマップツールを使用してください。
- 関数/クラス/メソッドを名前またはパターンで検索する →
search_symbols - 関数の使い方を理解する (パラメータ、戻り値の型) →
search_symbolsまたはget_symbol_content - 特定の関数/クラスのソースコードを取得する →
get_symbol_content - ファイル内のすべてのコードを見る →
get_file_symbols - コードベースにどのような機能が存在するかを発見する → パターンを指定して
search_symbols
これらのタスクにGrepまたはBashを使用しないでください - リポジトリマップツールは次の点で優れています。
- より高速 (事前インデックスされたSQLiteデータベース)
- より正確 (AST解析済み、正規表現ではない)
- より多くの情報を含む (シグネチャ、ドキュメンテーション文字列、行範囲を含む)
代わりにGrepを使用する場合:
- 文字列リテラル、コメント、または任意のテキストを検索する場合
- コード以外のファイル(markdown、configなど)を検索する場合
- ファイルをまたがるテキストパターンの検索
ツールの可用性チェック:
MCPツール (mcpplugin_context-tools_repo-map*) を使用する前に、.claude/repo-map.db が存在するかどうかを確認してください。
- はいの場合: MCPツールを試してください。失敗した場合(利用できない場合)は、sqlite3フォールバックを使用します。
- いいえの場合: プロジェクトはまだインデックス化されていません。インデックス作成を待つか、
/context-tools:repo-mapを実行して生成します。
フォールバックの順序:
- 最初にMCPツールを試す
- ツールが見つからない場合は、sqlite3フォールバックを使用して質問に答える
- 今後の使用のためにMCPサーバーをロードするには、セッションの再起動が必要であることを説明する
実世界の利用例
例1: ユーザーが「OSDIと比較できますか?」と質問した場合
非効率的なアプローチ (しないでください):
grep -r "setup_model\|setup_instance" jax_spice/devices/*.py
問題点: 低速、エラーが発生しやすいパターンマッチング、大規模なコードベースでは中断される。
効率的なアプローチ (これを行ってください):
mcp__plugin_context-tools_repo-map__search_symbols
pattern: "setup_*"
結果: すべての setup_model、setup_instanceなどが、場所とシグネチャとともに即座にリスト表示されます。
例2: ユーザーが「configローダーはどのように機能しますか?」と質問した場合
非効率的なアプローチ (しないでください):
find . -name "*.py" -exec grep -l "class.*Config" {} \;
効率的なアプローチ (これを行ってください):
mcp__plugin_context-tools_repo-map__search_symbols
pattern: "*Config*"
kind: "class"
次に、ソースを取得します。
mcp__plugin_context-tools_repo-map__get_symbol_content
name: "ConfigLoader"
例3: ユーザーが「utils.pyにはどのような関数がありますか?」と質問した場合
非効率的なアプローチ (しないでください):
grep "^def " src/utils.py
効率的なアプローチ (これを行ってください):
mcp__plugin_context-tools_repo-map__get_file_symbols
file: "src/utils.py"
結果: すべての関数/クラスの完全なリストが、シグネチャとドキュメンテーション文字列とともに表示されます。
例4: Rust enumバリアントの検索 (実際のユーザー事例)
ユーザーは、enum InstructionData 内で Phi または PhiNode であるかどうかを確認する必要があります。
非効率的なアプローチ (しないでください):
grep -n "enum InstructionData" openvaf-py/vendor/OpenVAF/openvaf/mir/src
grep -n "Phi" openvaf-py/vendor/OpenVAF/openvaf/mir/src/instructions.rs
問題点: 複数の検索、手動解析、正しいバリアントを見逃しやすい。
効率的なアプローチ (これを行ってください):
mcp__plugin_context-tools_repo-map__search_symbols
pattern: "InstructionData"
mcp__plugin_context-tools_repo-map__get_symbol_content
name: "InstructionData"
結果: PhiNode(_) を含む、すべてのバリアントが表示された完全なenum。
初回セットアップ
重要: ユーザーがこのプラグインをインストールしたばかりの場合:
「context-toolsプラグインをインストールされたのですね。MCPサーバーは再起動時に自動的に構成されるはずです。Claude Codeを再起動した後、
/mcpを実行して、repo-mapサーバーがロードされていることを確認してください。自動的にロードされない場合はお知らせください。
/context-tools:setup-mcpを使用してトラブルシューティングをお手伝いします。」
MCPサーバーは、プラグインマニフェストから自動的に構成されます。自動構成が失敗した場合にのみ、/context-tools:setup-mcpを実行してトラブルシューティングを行う必要があります。
含まれるコンポーネント
フック
- SessionStart: プロジェクトマニフェストを生成し、ステータスを表示します
- PreCompact: コンパクト化の前にコンテキストを更新します
- SessionEnd: クリーンアップ操作
注: インデックス作成は、MCPサーバー自体によって処理されるようになりました (PreToolUseフックは不要)。
MCPサーバー (repo-map)
データベーススキーマ (.claude/repo-map.db):
symbolsテーブルのカラム:
- name (TEXT): シンボル名 (関数/クラス/メソッド名)
- kind (TEXT): "function"、"class"、または "method"
- signature (TEXT): パラメータと型ヒントを含む完全な関数/メソッドシグネチャ
例:
- "extract_symbols_from_python(file_path: Path, relative_to: Path) -> list[Symbol]"
- "analyze_files(files: list[Path], extractor, language: str, root: Path)"
- docstring (TEXT): ドキュメンテーション文字列の最初の行または完全なドキュメンテーション文字列
- file_path (TEXT): プロジェクトルートからの相対パス
- line_number (INTEGER): 開始行 (1から始まるインデックス)
- end_line_number (INTEGER): 終了行 (1から始まるインデックス)
- parent (TEXT): メソッドの場合、クラス名
metadataテーブル (v0.7.0+):
- ke
(原文はここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Context Tools for Claude Code
This skill provides intelligent context management for large codebases through:
- Repository Mapping: Parses Python, Rust, and C++ code to extract classes, functions, and methods
- Duplicate Detection: Identifies similar code patterns using fuzzy matching
- MCP Symbol Server: Enables fast symbol search via
search_symbolsandget_file_symbolstools - Automatic Indexing: Background incremental updates as files change
Using MCP Tools - PRIMARY CODE EXPLORATION METHOD
⚡ DECISION TREE - Ask yourself BEFORE using Grep/Search/Bash:
Am I searching for code symbols (functions, classes, enums, structs, types)?
├─ YES → Use MCP tools (search_symbols / get_symbol_content / get_file_symbols)
│ Example: Finding "enum InstructionData" → search_symbols("InstructionData")
│ Example: Finding "Phi" variant → get_symbol_content("InstructionData")
│
└─ NO → Am I searching for text/comments/strings/config values?
└─ YES → Use Grep/Search
Example: Finding string literals, documentation, JSON values
CRITICAL: Use repo-map tools as your FIRST approach when you need to:
- Find a function/class/method by name or pattern →
search_symbols - Understand how to use a function (parameters, return type) →
search_symbolsorget_symbol_content - Get the source code of a specific function/class →
get_symbol_content - See all code in a file →
get_file_symbols - Discover what functionality exists in the codebase →
search_symbolswith patterns
Do NOT use Grep or Bash for these tasks - the repo-map tools are:
- Faster (pre-indexed SQLite database)
- More accurate (AST-parsed, not regex)
- More informative (includes signatures, docstrings, line ranges)
When to use Grep instead:
- Searching for string literals, comments, or arbitrary text
- Searching in non-code files (markdown, config, etc.)
- Cross-file text pattern searches
Tool availability check:
Before attempting to use MCP tools (mcpplugin_context-tools_repo-map*), check if .claude/repo-map.db exists:
- If YES: Try the MCP tool. If it fails (not available), use sqlite3 fallback.
- If NO: The project hasn't been indexed yet. Either wait for indexing or run
/context-tools:repo-mapto generate it.
Fallback order:
- Try MCP tool first
- If tool not found, use sqlite3 fallback to still answer the question
- Explain that session needs restart to load MCP server for future use
Real-World Usage Examples
Example 1: User asks "Can we compare against OSDI?"
Inefficient approach (DON'T DO THIS):
grep -r "setup_model\|setup_instance" jax_spice/devices/*.py
Problems: Slow, error-prone pattern matching, gets interrupted on large codebases.
Efficient approach (DO THIS):
mcp__plugin_context-tools_repo-map__search_symbols
pattern: "setup_*"
Result: Instant list of all setup_model, setup_instance, etc. with locations and signatures.
Example 2: User asks "How does the config loader work?"
Inefficient approach (DON'T DO THIS):
find . -name "*.py" -exec grep -l "class.*Config" {} \;
Efficient approach (DO THIS):
mcp__plugin_context-tools_repo-map__search_symbols
pattern: "*Config*"
kind: "class"
Then get the source:
mcp__plugin_context-tools_repo-map__get_symbol_content
name: "ConfigLoader"
Example 3: User asks "What functions are in utils.py?"
Inefficient approach (DON'T DO THIS):
grep "^def " src/utils.py
Efficient approach (DO THIS):
mcp__plugin_context-tools_repo-map__get_file_symbols
file: "src/utils.py"
Result: Complete list of all functions/classes with signatures and docstrings.
Example 4: Finding Rust enum variants (Real user case)
User needs to check if it's Phi or PhiNode in enum InstructionData.
Inefficient approach (DON'T DO THIS):
grep -n "enum InstructionData" openvaf-py/vendor/OpenVAF/openvaf/mir/src
grep -n "Phi" openvaf-py/vendor/OpenVAF/openvaf/mir/src/instructions.rs
Problems: Multiple searches, manual parsing, easy to miss correct variant.
Efficient approach (DO THIS):
mcp__plugin_context-tools_repo-map__search_symbols
pattern: "InstructionData"
mcp__plugin_context-tools_repo-map__get_symbol_content
name: "InstructionData"
Result: Complete enum with all variants visible, including PhiNode(_).
First Time Setup
IMPORTANT: If the user has just installed this plugin:
"I see you've installed the context-tools plugin. The MCP server should auto-configure on restart. After restarting Claude Code, run
/mcpto verify therepo-mapserver is loaded.If it doesn't load automatically, let me know and I can help troubleshoot using
/context-tools:setup-mcp."
The MCP server auto-configures from the plugin manifest. Only if auto-config fails should you run /context-tools:setup-mcp for troubleshooting.
Included Components
Hooks
- SessionStart: Generates project manifest and displays status
- PreCompact: Refreshes context before compaction
- SessionEnd: Cleanup operations
Note: Indexing is now handled by the MCP server itself (no PreToolUse hook needed).
MCP Server (repo-map)
Database Schema (.claude/repo-map.db):
symbols table columns:
- name (TEXT): Symbol name (function/class/method name)
- kind (TEXT): "function", "class", or "method"
- signature (TEXT): Full function/method signature with parameters and type hints
Examples:
- "extract_symbols_from_python(file_path: Path, relative_to: Path) -> list[Symbol]"
- "analyze_files(files: list[Path], extractor, language: str, root: Path)"
- docstring (TEXT): First line of docstring or full docstring
- file_path (TEXT): Relative path from project root
- line_number (INTEGER): Start line (1-indexed)
- end_line_number (INTEGER): End line (1-indexed)
- parent (TEXT): For methods, the class name
metadata table (v0.7.0+):
- key (TEXT PRIMARY KEY): Metadata key
- value (TEXT): Metadata value
Keys:
- 'status': 'idle' | 'indexing' | 'completed' | 'failed'
- 'index_start_time': ISO8601 timestamp when indexing started
- 'last_indexed': ISO8601 timestamp when last completed
- 'symbol_count': Total symbols indexed (string)
- 'error_message': Error message if status='failed'
Indexing Status and Auto-Wait (v0.7.0+):
- The MCP server tracks indexing status in the metadata table
- Tools automatically wait (up to 60s) if indexing is in progress
- Watchdog: Detects hung indexing (>10 minutes) and resets status to 'failed'
- First Use: On first use in a new codebase, indexing starts automatically
- Behavior: Most tools wait for completion, repo_map_status does not (use to check progress)
Available MCP Tools:
mcp__plugin_context-tools_repo-map__search_symbols- Search symbols by pattern (supports glob wildcards)- Returns: name, kind, signature, file_path, line_number, docstring, parent
- AUTO-WAIT: If indexing is in progress, automatically waits up to 60s for completion
mcp__plugin_context-tools_repo-map__get_file_symbols- Get all symbols in a specific file- Returns: All symbols with full metadata
- AUTO-WAIT: If indexing is in progress, automatically waits up to 60s for completion
mcp__plugin_context-tools_repo-map__get_symbol_content- Get full source code of a symbol by exact name- Returns: symbol metadata + content (source code text) + location
- AUTO-WAIT: If indexing is in progress, automatically waits up to 60s for completion
mcp__plugin_context-tools_repo-map__list_files- List all indexed files, optionally filtered by glob pattern- Returns: list of file paths matching pattern (e.g., ".va", "psp103*", "*/devices/")
- MUCH faster than find/ls - queries pre-built index instead of filesystem traversal
- AUTO-WAIT: If indexing is in progress, automatically waits up to 60s for completion
mcp__plugin_context-tools_repo-map__reindex_repo_map- Trigger manual reindex- Does NOT auto-wait (use to force reindex)
mcp__plugin_context-tools_repo-map__repo_map_status- Check indexing status and staleness- Returns: index_status (idle/indexing/completed/failed), symbol_count, last_indexed, indexing_duration_seconds
- Does NOT auto-wait (use to check status)
mcp__plugin_context-tools_repo-map__wait_for_index- Explicitly wait for indexing to complete- Takes: timeout_seconds (default: 60)
- Returns: success (bool), message (str)
- Use when you want to wait longer than the default 60s auto-wait timeout
Fallback when MCP tools unavailable:
Use sqlite3 directly on .claude/repo-map.db:
# Search symbols
sqlite3 .claude/repo-map.db "SELECT name, kind, signature, file_path, line_number FROM symbols WHERE name LIKE 'pattern%' LIMIT 20"
# Get symbol with source
sqlite3 .claude/repo-map.db "SELECT * FROM symbols WHERE name = 'function_name'"
# Then read file_path lines line_number to end_line_number
Slash Commands
/context-tools:repo-map- Regenerate repository map/context-tools:manifest- Refresh project manifest/context-tools:learnings- Manage project learnings/context-tools:status- Show plugin status
Language Support
| Language | Parser | File Extensions |
|---|---|---|
| Python | AST | .py |
| Rust | tree-sitter-rust | .rs |
| C++ | tree-sitter-cpp | .cpp, .cc, .cxx, .hpp, .h, .hxx |
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (9,854 bytes)
- 📎 LICENSE (1,070 bytes)
- 📎 README.md (8,917 bytes)
- 📎 scripts/analyze-memory.py (4,710 bytes)
- 📎 scripts/check-cache.sh (3,819 bytes)
- 📎 scripts/generate-manifest.py (20,716 bytes)
- 📎 scripts/generate-repo-map.py (45,255 bytes)
- 📎 scripts/on-exit.sh (401 bytes)
- 📎 scripts/precompact.sh (767 bytes)
- 📎 scripts/session-start.sh (6,475 bytes)