本文へスキップ
Skillpedia
一般的なプログラミング101k · #1279

smart-explore

できること

プログラムのコードを全部読まなくても、特定の部分を探して理解するのに役立ちます。コードの「地図」を作成してくれます。

使う場面

  • ✓大きなコードの中から特定の関数や部分を見つけたいとき。
  • ✓コードファイルの構造を理解する必要があるとき。
  • ✓すべてを読まずに、プログラムのプロジェクトをすばやく確認したいとき。

スキルのリンク

https://github.com/thedotmack/claude-mem/blob/main/plugin/skills/smart-explore/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedotmack/claude-mem/blob/main/plugin/skills/smart-explore/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“./src フォルダ内にある「login」に関連するすべての関数を探してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

まず、コードの構造を分析して索引(インデックス)を作成します。その後、特定の部分やファイルの構造を表示するように頼むことができ、時間と処理能力を節約できます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Smart Explore

Structural code exploration using AST parsing. This skill overrides your default exploration behavior. While this skill is active, use smart_search/smart_outline/smart_unfold as your primary tools instead of Read, Grep, and Glob.

Core principle: Index first, fetch on demand. Give yourself a map of the code before loading implementation details. The question before every file read should be: "do I need to see all of this, or can I get a structural overview first?" The answer is almost always: get the map.

Your Next Tool Call

This skill only loads instructions. You must call the MCP tools yourself. Your next action should be one of:

smart_search(query="<topic>", path="./src")    -- discover files + symbols across a directory
smart_outline(file_path="<file>")              -- structural skeleton of one file
smart_unfold(file_path="<file>", symbol_name="<name>")  -- full source of one symbol

Do NOT run Grep, Glob, Read, or find to discover files first. smart_search walks directories, parses all code files, and returns ranked symbols in one call. It replaces the Glob → Grep → Read discovery cycle.

3-Layer Workflow

Step 1: Search -- Discover Files and Symbols

smart_search(query="shutdown", path="./src", max_results=15)

Returns: Ranked symbols with signatures, line numbers, match reasons, plus folded file views (~2-6k tokens)

-- Matching Symbols --
  function performGracefulShutdown (services/infrastructure/GracefulShutdown.ts:56)
  function httpShutdown (services/infrastructure/HealthMonitor.ts:92)
  method WorkerService.shutdown (services/worker-service.ts:846)

-- Folded File Views --
  services/infrastructure/GracefulShutdown.ts (7 symbols)
  services/worker-service.ts (12 symbols)

This is your discovery tool. It finds relevant files AND shows their structure. No Glob/find pre-scan needed.

Parameters:

  • query (string, required) -- What to search for (function name, concept, class name)
  • path (string) -- Root directory to search (defaults to cwd)
  • max_results (number) -- Max matching symbols, default 20, max 50
  • file_pattern (string, optional) -- Filter to specific files/paths

Step 2: Outline -- Get File Structure

smart_outline(file_path="services/worker-service.ts")

Returns: Complete structural skeleton -- all functions, classes, methods, properties, imports (~1-2k tokens per file)

Skip this step when Step 1's folded file views already provide enough structure. Most useful for files not covered by the search results.

Parameters:

  • file_path (string, required) -- Path to the file

Step 3: Unfold -- See Implementation

Review symbols from Steps 1-2. Pick the ones you need. Unfold only those:

smart_unfold(file_path="services/worker-service.ts", symbol_name="shutdown")

Returns: Full source code of the specified symbol including JSDoc, decorators, and complete implementation (~400-2,100 tokens depending on symbol size). AST node boundaries guarantee completeness regardless of symbol size — unlike Read + agent summarization, which may truncate long methods.

Parameters:

  • file_path (string, required) -- Path to the file (as returned by search/outline)
  • symbol_name (string, required) -- Name of the function/class/method to expand

When to Use Standard Tools Instead

Use these only when smart_* tools are the wrong fit:

  • Grep: Exact string/regex search ("find all TODO comments", "where is ensureWorkerStarted defined?")
  • Read: Small files under ~100 lines, non-code files (JSON, markdown, config)
  • Glob: File path patterns ("find all test files")
  • Explore agent: When you need synthesized understanding across 6+ files, architecture narratives, or answers to open-ended questions like "how does this entire system work end-to-end?" Smart-explore is a scalpel — it answers "where is this?" and "show me that." It doesn't synthesize cross-file data flows, design decisions, or edge cases across an entire feature.

For code files over ~100 lines, prefer smart_outline + smart_unfold over Read.

Workflow Examples

Discover how a feature works (cross-cutting):

1. smart_search(query="shutdown", path="./src")
   -> 14 symbols across 7 files, full picture in one call
2. smart_unfold(file_path="services/infrastructure/GracefulShutdown.ts", symbol_name="performGracefulShutdown")
   -> See the core implementation

Navigate a large file:


…
よくある質問

「smart_search」「smart_outline」「smart_unfold」の違いは何ですか?

「smart_search」はプロジェクト全体からファイルやコードの部分を探します。「smart_outline」は特定のファイルの構造を表示します。「smart_unfold」は見つけた特定の部分の完全なコードを表示します。

「Read」や「Grep」などの通常のツールはいつ使うべきですか?

小さなファイル(100行未満)、JSONやテキストなどコード以外のファイル、または正確な文字列やパターンの検索が必要な場合に、通常のツールを使います。

ファイル全体を読むのではなく、このツールを使う理由は何ですか?

大きなファイルを丸ごと読むと多くのリソースを消費します。このツールは索引を作成し、必要な部分だけを表示するので、コードの構造を理解するのにはるかに速く効率的です。

詳細

作者による元の説明

Token-optimized structural code search using tree-sitter AST parsing. Use instead of reading full files when you need to understand code structure, find functions, or explore a codebase efficiently.

repo: thedotmack/claude-mem

人気

GitHubのスター
101k
ランキング
#1279
ライセンス
Apache-2.0
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル