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

understand-explain

コード全体の知識を活用し、ファイルや機能、モジュールについて詳細な説明を提供することで、不慣れなコードの理解や機能の実装方法の解明、過去のコード資産の学習などを支援するSkill。

📜 元の英語説明(参考)

Get a deep-dive explanation of any file, function, or module using the codebase knowledge graph. Use when: understanding unfamiliar code, explaining how a feature is implemented, learning a legacy codebase.

🇯🇵 日本人クリエイター向け解説

一言でいうと

コード全体の知識を活用し、ファイルや機能、モジュールについて詳細な説明を提供することで、不慣れなコードの理解や機能の実装方法の解明、過去のコード資産の学習などを支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

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

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

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

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

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

/understand-explain

概要

ナレッジグラフのコンテキストとソースコード解析を組み合わせることで、ファイル、関数、またはモジュールの詳細な説明を取得します。このスキルは、グラフ内の対象コンポーネントを特定し、その接続とアーキテクチャレイヤーをマッピングし、実際のソースコードを読み取り、それがどのように機能し、なぜ存在するのかを明確に説明します。

グラフ構造の参照

ナレッジグラフの JSON は次の構造を持ちます。

  • project — {name, description, languages, frameworks, analyzedAt, gitCommitHash}
  • nodes[] — 各ノードは {id, type, name, filePath, summary, tags[], complexity, languageNotes?} を持ちます
    • ノードタイプ: file, function, class, module, concept
    • ID: file:path, func:path:name, class:path:name
  • edges[] — 各エッジは {source, target, type, direction, weight} を持ちます
    • 主要なタイプ: imports, contains, calls, depends_on
  • layers[] — 各レイヤーは {id, name, description, nodeIds[]} を持ちます
  • tour[] — 各ツアーは {order, title, description, nodeIds[]} を持ちます

効率的な読み方

  1. JSON 全体を読み込む前に、Grep を使用して関連するエントリを検索します
  2. 必要なセクションのみを読みます — グラフ全体をコンテキストにダンプしないでください
  3. ノード名とサマリーは、理解する上で最も役立つフィールドです
  4. エッジはコンポーネントがどのように接続されているかを示します — 依存関係の連鎖については、imports と calls を追跡します

手順

  1. .understand-anything/knowledge-graph.json が存在することを確認します。存在しない場合は、最初に /understand を実行するようにユーザーに指示します。

  2. ターゲットノードを見つけるGrep を使用して、コンポーネントのナレッジグラフを検索します: "$ARGUMENTS"

    • ファイルパスの場合 (例: src/auth/login.ts): "filePath" の一致を検索します
    • 関数表記の場合 (例: src/auth/login.ts:verifyToken): ファイルパスでフィルタリングされた "name" フィールドで関数名を検索します
    • 正確なノードの idtypesummarytags、および complexity をメモします
  3. 接続されているすべてのエッジを見つける — エッジセクションでターゲットノードの ID を Grep で検索します:

    • "source" の一致 → このノードが呼び出す/インポートする/依存するもの (発信)
    • "target" の一致 → このノードを呼び出す/インポートする/依存するもの (着信)
    • 接続されているノード ID とエッジタイプをメモします
  4. 接続されているノードを読み取る — ステップ 3 の各接続ノード ID について、ノードセクションでそれらの ID を Grep で検索して、namesummary、および type を取得します。これにより、コンポーネントの近傍が構築されます。

  5. レイヤーを特定する"layers" セクションでターゲットノードの ID を Grep で検索して、それが属するアーキテクチャレイヤーとそのレイヤーの説明を見つけます。

  6. 実際のソースファイルを読み取る — 詳細な分析のために、ノードの filePath でソースファイルを読み取ります。

  7. コンテキスト内でコンポーネントを説明する:

    • アーキテクチャにおけるその役割 (どのレイヤーか、なぜ存在するのか)
    • 内部構造 (それが含む関数、クラス — contains エッジから)
    • 外部接続 (それがインポートするもの、それを呼び出すもの、それが依存するもの — エッジから)
    • データフロー (入力 → 処理 → 出力 — ソースコードから)
    • 読者がプログラミング言語を知らない可能性があることを前提として、明確に説明します
    • 理解する価値のあるパターン、イディオム、または複雑さを強調します

例 1: ファイルの説明

ユーザー: /understand-explain src/auth/session.ts

エージェントは、filePathsrc/auth/session.ts と一致するナレッジグラフを検索し、file:src/auth/session.ts を見つけます (サマリー: "リフレッシュトークンローテーションによる JWT セッション管理", 複雑さ: 7, タグ: auth, jwt, security)。createSessioncreateUser および handleLogin によって呼び出され、ファイルが jsonwebtoken および src/config/auth-config.ts をインポートすることを示すエッジを見つけます。レイヤーのルックアップは、それが Authentication レイヤーに属することを示しています。エージェントはソースファイルを読み取り、説明します: ファイルは 4 つの関数 (createSession, validateSession, refreshSession, destroySession) をエクスポートし、RS256 署名で JWT を実装し、トークンの盗難を防ぐためにリフレッシュトークンローテーションを使用し、それに依存する 6 つの上流の呼び出し元を持つ認証レイヤーの中核に位置します。

例 2: 特定の関数の説明

ユーザー: /understand-explain src/api/middleware.ts:requireAuth

エージェントは、ファイル src/api/middleware.ts 内に名前 requireAuth を持つノードを検索し、func:src/api/middleware.ts:requireAuth を見つけます (サマリー: "JWT を検証し、ユーザーをリクエストにアタッチする Express ミドルウェア", 複雑さ: 4)。エッジトラバーサルは、12 個の API ルートハンドラーがこの関数に依存し、認証レイヤーから validateSession を呼び出すことを示しています。エージェントはソースファイルを読み取り、関数を特定し、説明します: Authorization ヘッダーから Bearer トークンを抽出し、validateSession を呼び出して JWT を検証し、デコードされたユーザーオブジェクトを req.user にアタッチし、トークンがないか無効な場合は 401 を返します。これは、すべての認証されたエンドポイントを保護するゲートウェイ関数です。

ガイドライン

  • アーキテクチャにおけるコンポーネントの役割を最初に理解するために、ソースコードを読み取る前にグラフコンテキストから開始します
  • 使用されているプログラミング言語を知らない可能性がある読者を想定して、明確に説明します
  • コードだけでは明らかではない複雑なホットスポットとパターンを強調します
  • ファイルを説明する場合は、内部ヘルパーではなく、エクスポートされた関数とパブリック API に焦点を当てます
  • ターゲットコンポーネントがグラフに見つからない場合は、部分的な名前の一致で検索し、修正を提案します
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

/understand-explain

Overview

Get a deep-dive explanation of any file, function, or module by combining knowledge graph context with source code analysis. The skill locates the target component in the graph, maps its connections and architectural layer, reads the actual source code, and delivers a clear explanation of how it works and why it exists.

Graph Structure Reference

The knowledge graph JSON has this structure:

  • project — {name, description, languages, frameworks, analyzedAt, gitCommitHash}
  • nodes[] — each has {id, type, name, filePath, summary, tags[], complexity, languageNotes?}
    • Node types: file, function, class, module, concept
    • IDs: file:path, func:path:name, class:path:name
  • edges[] — each has {source, target, type, direction, weight}
    • Key types: imports, contains, calls, depends_on
  • layers[] — each has {id, name, description, nodeIds[]}
  • tour[] — each has {order, title, description, nodeIds[]}

How to Read Efficiently

  1. Use Grep to search within the JSON for relevant entries BEFORE reading the full file
  2. Only read sections you need — don't dump the entire graph into context
  3. Node names and summaries are the most useful fields for understanding
  4. Edges tell you how components connect — follow imports and calls for dependency chains

Instructions

  1. Check that .understand-anything/knowledge-graph.json exists. If not, tell the user to run /understand first.

  2. Find the target node — use Grep to search the knowledge graph for the component: "$ARGUMENTS"

    • For file paths (e.g., src/auth/login.ts): search for "filePath" matches
    • For function notation (e.g., src/auth/login.ts:verifyToken): search for the function name in "name" fields filtered by the file path
    • Note the exact node id, type, summary, tags, and complexity
  3. Find all connected edges — Grep for the target node's ID in the edges section:

    • "source" matches → things this node calls/imports/depends on (outgoing)
    • "target" matches → things that call/import/depend on this node (incoming)
    • Note the connected node IDs and edge types
  4. Read connected nodes — for each connected node ID from step 3, Grep for those IDs in the nodes section to get their name, summary, and type. This builds the component's neighborhood.

  5. Identify the layer — Grep for the target node's ID in the "layers" section to find which architectural layer it belongs to and that layer's description.

  6. Read the actual source file — Read the source file at the node's filePath for the deep-dive analysis.

  7. Explain the component in context:

    • Its role in the architecture (which layer, why it exists)
    • Internal structure (functions, classes it contains — from contains edges)
    • External connections (what it imports, what calls it, what it depends on — from edges)
    • Data flow (inputs → processing → outputs — from source code)
    • Explain clearly, assuming the reader may not know the programming language
    • Highlight any patterns, idioms, or complexity worth understanding

Examples

Example 1: Explaining a file

User: /understand-explain src/auth/session.ts

The agent searches the knowledge graph for filePath matching src/auth/session.ts and finds file:src/auth/session.ts (summary: "JWT session management with refresh token rotation", complexity: 7, tags: auth, jwt, security). It finds edges showing that createSession is called by createUser and handleLogin, and that the file imports jsonwebtoken and src/config/auth-config.ts. The layer lookup shows it belongs to the Authentication layer. The agent reads the source file and explains: the file exports 4 functions (createSession, validateSession, refreshSession, destroySession), implements JWT with RS256 signing, uses refresh token rotation to prevent token theft, and sits at the core of the auth layer with 6 upstream callers depending on it.

Example 2: Explaining a specific function

User: /understand-explain src/api/middleware.ts:requireAuth

The agent searches for a node with name requireAuth in file src/api/middleware.ts and finds func:src/api/middleware.ts:requireAuth (summary: "Express middleware that validates JWT and attaches user to request", complexity: 4). Edge traversal shows 12 API route handlers depend on this function, and it calls validateSession from the auth layer. The agent reads the source file, locates the function, and explains: it extracts the Bearer token from the Authorization header, calls validateSession to verify the JWT, attaches the decoded user object to req.user, and returns 401 if the token is missing or invalid. It is the gateway function that protects all authenticated endpoints.

Guidelines

  • Start with the graph context before reading source code to understand the component's role in the architecture first
  • Explain clearly assuming the reader may not know the programming language used
  • Highlight complexity hotspots and patterns that are non-obvious from the code alone
  • When explaining a file, focus on exported functions and the public API rather than internal helpers
  • If the target component is not found in the graph, search by partial name match and suggest corrections