PluginBench
Skill
Pass
Audit score 90

rust-trait-explorer

actionbook/rust-skills

Explore Rust trait implementations and polymorphic designs using LSP.

What is rust-trait-explorer?

Rust Trait Explorer helps you discover which types implement a given trait, and which traits a type implements. Use it when navigating trait hierarchies, understanding polymorphic code, or analyzing implementation coverage in Rust projects.

  • Find all implementors of a trait using LSP goToImplementation
  • Discover all traits implemented by a struct or type via grep pattern matching
  • Display trait implementation details with source locations and method signatures
  • Generate implementation maps and trait hierarchy visualizations
  • Check trait implementation coverage and blanket implementations
  • Support both English and Chinese trigger phrases

How to install rust-trait-explorer

npx skills add https://github.com/actionbook/rust-skills --skill rust-trait-explorer
Prerequisites
  • LSP server running for the Rust project
  • Rust source code accessible in the workspace
Claude Code
Cursor
Windsurf
Cline

How to use rust-trait-explorer

  1. 1.Invoke the skill with a trait name or struct name: `/rust-trait-explorer Handler`
  2. 2.The skill uses LSP goToImplementation to find the trait definition
  3. 3.For trait queries, it retrieves all implementors and displays them in a table with locations
  4. 4.For struct queries, it greps for `impl * for StructName` patterns to find trait implementations
  5. 5.Review the generated implementation map showing trait names, locations, and method details
  6. 6.Check the trait hierarchy visualization if applicable to understand super-trait relationships

Use cases

Good for
  • Understand polymorphic designs by finding all Handler implementations in a codebase
  • Verify that a custom struct implements required traits like Display, Clone, or Serialize
  • Navigate trait hierarchies to see parent-child trait relationships
  • Check implementation coverage to ensure all trait methods are properly implemented
  • Analyze blanket implementations to understand automatic trait derivations
Who it's for
  • Rust developers refactoring polymorphic code
  • Contributors exploring unfamiliar codebases with complex trait systems
  • Code reviewers verifying trait implementation completeness
  • Developers designing trait-based APIs

rust-trait-explorer FAQ

How do I find all types that implement a specific trait?

Use `/rust-trait-explorer TraitName` where TraitName is the trait you want to explore. The skill will use LSP goToImplementation to find all implementors and display them in a table with file locations and notes.

Can I find all traits implemented by a specific struct?

Yes, use `/rust-trait-explorer StructName`. The skill will search for `impl * for StructName` patterns and list all traits that struct implements, organized by category (standard library, external crates, project-specific).

What output formats does this skill provide?

The skill generates implementation tables with type names and locations, trait hierarchy visualizations, implementation coverage matrices, and blanket implementation analysis.

Does this work with derived traits?

Yes, the skill distinguishes between derived traits (marked with #[derive]) and manually implemented traits, and shows both in the output.

Can I use this skill in non-English projects?

Yes, the skill supports Chinese trigger phrases like `trait 实现`, `谁实现了`, and `实现了哪些trait` in addition to English commands.

Full instructions (SKILL.md)

Source of truth, from actionbook/rust-skills.


name: rust-trait-explorer description: "Explore Rust trait implementations using LSP. Triggers on: /trait-impl, find implementations, who implements, trait 实现, 谁实现了, 实现了哪些trait" argument-hint: "<TraitName|StructName>" allowed-tools: ["LSP", "Read", "Glob", "Grep"]

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(&self) -> &str {
        "auth"
    }
}
​```

#### ApiHandler
​```rust
impl Handler for ApiHandler {
    fn handle(&self, request: Request) -> Response {
        // API routing logic
    }

    fn name(&self) -> &str {
        "api"
    }
}
​```

Traits for a Type

## Traits implemented by `User`

**Struct defined at:** src/models/user.rs:10

### Standard Library Traits
| Trait | Derived/Manual | Notes |
|-------|----------------|-------|
| Debug | #[derive] | Auto-generated |
| Clone | #[derive] | Auto-generated |
| Default | manual | Custom defaults |
| Display | manual | User-friendly output |

### Serde Traits
| Trait | Location |
|-------|----------|
| Serialize | #[derive] |
| Deserialize | #[derive] |

### Project Traits
| Trait | Location | Methods |
|-------|----------|---------|
| Entity | src/db/entity.rs:30 | id(), created_at() |
| Validatable | src/validation.rs:15 | validate() |

### Implementation Hierarchy

​```
User
├── derive
│   ├── Debug
│   ├── Clone
│   ├── Serialize
│   └── Deserialize
└── impl
    ├── Default (src/models/user.rs:50)
    ├── Display (src/models/user.rs:60)
    ├── Entity (src/models/user.rs:70)
    └── Validatable (src/models/user.rs:85)
​```

Trait Hierarchy Visualization

## Trait Hierarchy

                    ┌─────────────┐
                    │    Error    │ (std)
                    └──────┬──────┘
                           │
              ┌────────────┼────────────┐
              │            │            │
      ┌───────▼───────┐ ┌──▼──┐ ┌───────▼───────┐
      │  AppError     │ │ ... │ │  DbError      │
      └───────┬───────┘ └─────┘ └───────┬───────┘
              │                         │
      ┌───────▼───────┐         ┌───────▼───────┐
      │ AuthError     │         │ QueryError    │
      └───────────────┘         └───────────────┘

Analysis Features

Coverage Check

## Trait Implementation Coverage

Trait: Handler (3 required methods)

| Implementor | handle() | name() | priority() | Complete |
|-------------|----------|--------|------------|----------|
| AuthHandler | ✅ | ✅ | ✅ | Yes |
| ApiHandler | ✅ | ✅ | ❌ default | Yes |
| MockHandler | ✅ | ✅ | ✅ | Yes |

Blanket Implementations

## Blanket Implementations

The following blanket impls may apply to your types:

| Trait | Blanket Impl | Applies To |
|-------|--------------|------------|
| From<T> | `impl<T> From<T> for T` | All types |
| Into<U> | `impl<T, U> Into<U> for T where U: From<T>` | Types with From |
| ToString | `impl<T: Display> ToString for T` | Types with Display |

Common Patterns

User SaysAction
"Who implements X?"goToImplementation on trait
"What traits does Y impl?"Grep for impl * for Y
"Show trait hierarchy"Find super-traits recursively
"Is X: Send + Sync?"Check std trait impls

Related Skills

WhenSee
Navigate to implrust-code-navigator
Call relationshipsrust-call-graph
Project structurerust-symbol-analyzer
Safe refactoringrust-refactor-helper

Related skills

More from actionbook/rust-skills and the wider catalog.

UNunsafe-checker logo

unsafe-checker

actionbook/rust-skills

Detects and reviews unsafe Rust code patterns, FFI calls, and memory safety issues.

2.9k installsAudited
COcoding-guidelines logo

coding-guidelines

actionbook/rust-skills

Reference for Rust code style, naming conventions, and best practices from 50 core rules.

3.6k installsAudited
COcore-actionbook logo

core-actionbook

actionbook/rust-skills

Internal support skill for actionbook MCP selectors in Rust documentation research workflows.

1.5k installsAudited
COcore-agent-browser logo

core-agent-browser

actionbook/rust-skills

Internal browser automation CLI for agent workflows requiring interactive page testing and form filling.

1.6k installs
ESesp32-firmware-engineer logo

esp32-firmware-engineer

adamlipecz/esp32-firmware-engineer-skill

ESP32 firmware engineering for ESP-IDF projects. Write, review, and debug embedded C/C++ code involving FreeRTOS tasks/queues/timers, GPIO/I2C/SPI/UART/ADC/PWM peripherals, TWAI/CAN, Wi-Fi/BLE networking, OTA updates, Secure Boot and flash encryption, LVGL display integration, build/flash/monitor workflows, logging, crash analysis, memory/code-size optimization, low-power sleep/wakeup design, on-device USB/serial service terminals, and board bring-up. Use when an agent is asked to implement ESP-IDF firmware features, review embedded changes for correctness or race conditions, investigate boot/runtime failures or Guru Meditation panics, interpret serial logs, fix build/link/flash problems, optimize RAM/flash usage, tune deep sleep/light sleep behavior, harden firmware for production, add a service console/CLI, integrate a display with LVGL, or diagnose hardware-software integration issues on ESP32-class devices.

722 installs
APapi-and-interface-design logo

api-and-interface-design

addyosmani/agent-skills

Design stable, hard-to-misuse APIs and interfaces with proven principles and patterns.

43k installs