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

rust-symbol-analyzer

Rustのプロジェクト構造をLSPのシンボル情報から解析し、構造体やトレイト、関数の一覧表示などを日本語や中国語で指示することで、プロジェクトの全体像を把握しやすくするSkill。

📜 元の英語説明(参考)

Analyze Rust project structure using LSP symbols. Triggers on: /symbols, project structure, list structs, list traits, list functions, 符号分析, 项目结构, 列出所有, 有哪些struct

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

一言でいうと

Rustのプロジェクト構造をLSPのシンボル情報から解析し、構造体やトレイト、関数の一覧表示などを日本語や中国語で指示することで、プロジェクトの全体像を把握しやすくするSkill。

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

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

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

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

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

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

Rust Symbol Analyzer

Rust コードベース全体のシンボルを調べることで、プロジェクトの構造を分析します。

使い方

/rust-symbol-analyzer [file.rs] [--type struct|trait|fn|mod]

例:

  • /rust-symbol-analyzer - プロジェクト全体を分析
  • /rust-symbol-analyzer src/lib.rs - 単一のファイルを分析
  • /rust-symbol-analyzer --type trait - プロジェクト内のすべてのトレイトをリスト表示

LSP 操作

1. ドキュメントシンボル (単一ファイル)

ファイル内のすべてのシンボルを、その階層構造とともに取得します。

LSP(
  operation: "documentSymbol",
  filePath: "src/lib.rs",
  line: 1,
  character: 1
)

戻り値: モジュール、構造体、関数などのネストされた構造。

2. ワークスペースシンボル (プロジェクト全体)

ワークスペース全体でシンボルを検索します。

LSP(
  operation: "workspaceSymbol",
  filePath: "src/lib.rs",
  line: 1,
  character: 1
)

注: クエリは操作コンテキストに暗黙的に含まれます。

ワークフロー

User: "このプロジェクトの構造はどうなっていますか?"
    │
    ▼
[1] すべての Rust ファイルを検索
    Glob("**/*.rs")
    │
    ▼
[2] 各キーファイルからシンボルを取得
    lib.rs, main.rs に対して LSP(documentSymbol) を実行
    │
    ▼
[3] 型ごとに分類
    │
    ▼
[4] 構造の可視化を生成

出力形式

プロジェクト概要

## プロジェクト構造: my-project

### モジュール
├── src/
│   ├── lib.rs (root)
│   ├── config/
│   │   ├── mod.rs
│   │   └── parser.rs
│   ├── handlers/
│   │   ├── mod.rs
│   │   ├── auth.rs
│   │   └── api.rs
│   └── models/
│       ├── mod.rs
│       ├── user.rs
│       └── order.rs
└── tests/
    └── integration.rs

シンボルタイプ別

## シンボルタイプ別

### 構造体 (12)
| 名前 | 場所 | フィールド | Derives |
|------|----------|--------|---------|
| Config | src/config.rs:10 | 5 | Debug, Clone |
| User | src/models/user.rs:8 | 4 | Debug, Serialize |
| Order | src/models/order.rs:15 | 6 | Debug, Serialize |
| ... | | | |

### トレイト (4)
| 名前 | 場所 | メソッド | Implementors |
|------|----------|---------|--------------|
| Handler | src/handlers/mod.rs:5 | 3 | AuthHandler, ApiHandler |
| Repository | src/db/mod.rs:12 | 5 | UserRepo, OrderRepo |
| ... | | | |

### 関数 (25)
| 名前 | 場所 | 可視性 | Async |
|------|----------|------------|-------|
| main | src/main.rs:10 | pub | yes |
| parse_config | src/config.rs:45 | pub | no |
| ... | | | |

### 列挙型 (6)
| 名前 | 場所 | バリアント |
|------|----------|----------|
| Error | src/error.rs:5 | 8 |
| Status | src/models/order.rs:5 | 4 |
| ... | | |

単一ファイル分析

## src/handlers/auth.rs

### シンボル階層

mod auth
├── struct AuthHandler
│   ├── field: config: Config
│   ├── field: db: Pool
│   └── impl AuthHandler
│       ├── fn new(config, db) -> Self
│       ├── fn authenticate(&self, token) -> Result<User>
│       └── fn refresh_token(&self, user) -> Result<Token>
├── struct Token
│   ├── field: value: String
│   └── field: expires: DateTime
├── enum AuthError
│   ├── InvalidToken
│   ├── Expired
│   └── Unauthorized
└── impl Handler for AuthHandler
    ├── fn handle(&self, req) -> Response
    └── fn name(&self) -> &str

分析機能

複雑性メトリクス

## 複雑性分析

| ファイル | 構造体 | 関数 | 行数 | 複雑性 |
|------|---------|-----------|-------|------------|
| src/handlers/auth.rs | 2 | 8 | 150 | 中 |
| src/models/user.rs | 3 | 12 | 200 | 高 |
| src/config.rs | 1 | 3 | 50 | 低 |

**ホットスポット:** リファクタリングが必要な可能性のある、複雑性の高いファイル
- src/handlers/api.rs (15 functions, 300 lines)

依存関係分析

## 内部依存関係

auth.rs
├── imports from: config.rs, models/user.rs, db/mod.rs
└── imported by: main.rs, handlers/mod.rs

user.rs
├── imports from: (none - leaf module)
└── imported by: auth.rs, api.rs, tests/

シンボルタイプ

タイプ アイコン LSP Kind
モジュール 📦 Module
構造体 🏗️ Struct
列挙型 🔢 Enum
トレイト 📜 Interface
関数 Function
メソッド 🔧 Method
定数 🔒 Constant
フィールド 📎 Field

一般的なクエリ

ユーザーの発言 分析
"このプロジェクトにはどのような構造体がありますか?" workspaceSymbol + filter
"src/lib.rs の構造を表示してください" documentSymbol
"すべての async 関数を検索" workspaceSymbol + async filter
"公開 API をリスト表示" documentSymbol + pub filter

関連スキル

いつ 参照
シンボルに移動 rust-code-navigator
呼び出し関係 rust-call-graph
トレイトの実装 rust-trait-explorer
安全なリファクタリング rust-refactor-helper
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Rust Symbol Analyzer

Analyze project structure by examining symbols across your Rust codebase.

Usage

/rust-symbol-analyzer [file.rs] [--type struct|trait|fn|mod]

Examples:

  • /rust-symbol-analyzer - Analyze entire project
  • /rust-symbol-analyzer src/lib.rs - Analyze single file
  • /rust-symbol-analyzer --type trait - List all traits in project

LSP Operations

1. Document Symbols (Single File)

Get all symbols in a file with their hierarchy.

LSP(
  operation: "documentSymbol",
  filePath: "src/lib.rs",
  line: 1,
  character: 1
)

Returns: Nested structure of modules, structs, functions, etc.

2. Workspace Symbols (Entire Project)

Search for symbols across the workspace.

LSP(
  operation: "workspaceSymbol",
  filePath: "src/lib.rs",
  line: 1,
  character: 1
)

Note: Query is implicit in the operation context.

Workflow

User: "What's the structure of this project?"
    │
    ▼
[1] Find all Rust files
    Glob("**/*.rs")
    │
    ▼
[2] Get symbols from each key file
    LSP(documentSymbol) for lib.rs, main.rs
    │
    ▼
[3] Categorize by type
    │
    ▼
[4] Generate structure visualization

Output Format

Project Overview

## Project Structure: my-project

### Modules
├── src/
│   ├── lib.rs (root)
│   ├── config/
│   │   ├── mod.rs
│   │   └── parser.rs
│   ├── handlers/
│   │   ├── mod.rs
│   │   ├── auth.rs
│   │   └── api.rs
│   └── models/
│       ├── mod.rs
│       ├── user.rs
│       └── order.rs
└── tests/
    └── integration.rs

By Symbol Type

## Symbols by Type

### Structs (12)
| Name | Location | Fields | Derives |
|------|----------|--------|---------|
| Config | src/config.rs:10 | 5 | Debug, Clone |
| User | src/models/user.rs:8 | 4 | Debug, Serialize |
| Order | src/models/order.rs:15 | 6 | Debug, Serialize |
| ... | | | |

### Traits (4)
| Name | Location | Methods | Implementors |
|------|----------|---------|--------------|
| Handler | src/handlers/mod.rs:5 | 3 | AuthHandler, ApiHandler |
| Repository | src/db/mod.rs:12 | 5 | UserRepo, OrderRepo |
| ... | | | |

### Functions (25)
| Name | Location | Visibility | Async |
|------|----------|------------|-------|
| main | src/main.rs:10 | pub | yes |
| parse_config | src/config.rs:45 | pub | no |
| ... | | | |

### Enums (6)
| Name | Location | Variants |
|------|----------|----------|
| Error | src/error.rs:5 | 8 |
| Status | src/models/order.rs:5 | 4 |
| ... | | |

Single File Analysis

## src/handlers/auth.rs

### Symbols Hierarchy

mod auth
├── struct AuthHandler
│   ├── field: config: Config
│   ├── field: db: Pool
│   └── impl AuthHandler
│       ├── fn new(config, db) -> Self
│       ├── fn authenticate(&self, token) -> Result<User>
│       └── fn refresh_token(&self, user) -> Result<Token>
├── struct Token
│   ├── field: value: String
│   └── field: expires: DateTime
├── enum AuthError
│   ├── InvalidToken
│   ├── Expired
│   └── Unauthorized
└── impl Handler for AuthHandler
    ├── fn handle(&self, req) -> Response
    └── fn name(&self) -> &str

Analysis Features

Complexity Metrics

## Complexity Analysis

| File | Structs | Functions | Lines | Complexity |
|------|---------|-----------|-------|------------|
| src/handlers/auth.rs | 2 | 8 | 150 | Medium |
| src/models/user.rs | 3 | 12 | 200 | High |
| src/config.rs | 1 | 3 | 50 | Low |

**Hotspots:** Files with high complexity that may need refactoring
- src/handlers/api.rs (15 functions, 300 lines)

Dependency Analysis

## Internal Dependencies

auth.rs
├── imports from: config.rs, models/user.rs, db/mod.rs
└── imported by: main.rs, handlers/mod.rs

user.rs
├── imports from: (none - leaf module)
└── imported by: auth.rs, api.rs, tests/

Symbol Types

Type Icon LSP Kind
Module 📦 Module
Struct 🏗️ Struct
Enum 🔢 Enum
Trait 📜 Interface
Function Function
Method 🔧 Method
Constant 🔒 Constant
Field 📎 Field

Common Queries

User Says Analysis
"What structs are in this project?" workspaceSymbol + filter
"Show me src/lib.rs structure" documentSymbol
"Find all async functions" workspaceSymbol + async filter
"List public API" documentSymbol + pub filter

Related Skills

When See
Navigate to symbol rust-code-navigator
Call relationships rust-call-graph
Trait implementations rust-trait-explorer
Safe refactoring rust-refactor-helper