Explore Rust trait implementations using LSP. Triggers on: /trait-impl, find implementations, who implements, trait 实现, 谁实现了, 实现了哪些trait
View on GitHubactionbook/rust-skills
rust-skills
January 23, 2026
Select agents to install to:
npx add-skill https://github.com/actionbook/rust-skills/blob/main/skills/rust-trait-explorer/SKILL.md -a claude-code --skill rust-trait-explorerInstallation paths:
.claude/skills/rust-trait-explorer/# Rust Trait Explorer
Discover trait implementations and understand polymorphic designs.
## Usage
```
/rust-trait-explorer <TraitName|StructName>
```
**Examples:**
- `/rust-trait-explorer Handler` - Find all implementors of Handler trait
- `/rust-trait-explorer MyStruct` - Find all traits implemented by MyStruct
## LSP Operations
### Go to Implementation
Find all implementations of a trait.
```
LSP(
operation: "goToImplementation",
filePath: "src/traits.rs",
line: 10,
character: 11
)
```
**Use when:**
- Trait name is known
- Want to find all implementors
- Understanding polymorphic code
## Workflow
### Find Trait Implementors
```
User: "Who implements the Handler trait?"
│
▼
[1] Find trait definition
LSP(goToDefinition) or workspaceSymbol
│
▼
[2] Get implementations
LSP(goToImplementation)
│
▼
[3] For each impl, get details
LSP(documentSymbol) for methods
│
▼
[4] Generate implementation map
```
### Find Traits for a Type
```
User: "What traits does MyStruct implement?"
│
▼
[1] Find struct definition
│
▼
[2] Search for "impl * for MyStruct"
Grep pattern matching
│
▼
[3] Get trait details for each
│
▼
[4] Generate trait list
```
## Output Format
### Trait Implementors
```
## Implementations of `Handler`
**Trait defined at:** src/traits.rs:15
```rust
pub trait Handler {
fn handle(&self, request: Request) -> Response;
fn name(&self) -> &str;
}
```
### Implementors (4)
| Type | Location | Notes |
|------|----------|-------|
| AuthHandler | src/handlers/auth.rs:20 | Handles authentication |
| ApiHandler | src/handlers/api.rs:15 | REST API endpoints |
| WebSocketHandler | src/handlers/ws.rs:10 | WebSocket connections |
| MockHandler | tests/mocks.rs:5 | Test mock |
### Implementation Details
#### AuthHandler
```rust
impl Handler for AuthHandler {
fn handle(&self, request: Request) -> Response {
// Authentication logic
}
fn name(&sel