
Rust Trait Explorer
Map who implements a Rust trait or which traits a struct implements using LSP go-to-implementation and grep workflows.
Overview
rust-trait-explorer is an agent skill most often used in Build (also Ship review) that discovers Rust trait implementors and per-type trait lists via LSP and grep.
Install
npx skills add https://github.com/actionbook/rust-skills --skill rust-trait-explorerWhat is this skill?
- LSP goToImplementation to list all implementors of a named trait
- Reverse lookup: grep and symbols to list traits implemented for a struct
- Slash command style entry: /rust-trait-explorer with TraitName or StructName
- Four-step workflow ending in an implementation map document
- Allowed tools: LSP, Read, Glob, Grep
- Four-step workflow for trait implementors
- Allowed tools list: LSP, Read, Glob, Grep
Adoption & trust: 866 installs on skills.sh; 1.2k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You cannot quickly see every type that implements a trait or every trait a struct satisfies in a large Rust workspace.
Who is it for?
Rust projects with LSP enabled where you need fast trait/impl discovery during refactors or code review prep.
Skip if: Greenfield Rust with no LSP, or workflows that only need cargo doc without implementation traversal.
When should I use this skill?
Triggers on /trait-impl, find implementations, who implements, trait 实现, 谁实现了, 实现了哪些trait.
What do I get? / Deliverables
You get an implementation map listing implementors or traits with enough method detail to plan changes or reviews.
- Implementation map of trait implementors or traits for a named type
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Trait exploration is shelved under Build backend because it supports understanding and extending Rust service and library code during implementation. Backend fits polymorphic Rust crates (handlers, traits, impl blocks) more than frontend or ops tooling.
Where it fits
Before adding a new async Handler, list existing implementors to match conventions.
Confirm which adapter types implement a plugin trait before wiring a new integration.
Verify a public trait’s implementor set did not shrink unexpectedly in a PR.
How it compares
Editor-agent procedural skill using LSP—not a standalone CLI like cargo-expand or a docs-only MCP.
Common Questions / FAQ
Who is rust-trait-explorer for?
Indie and solo Rust developers using agentic IDEs who need trait implementor lists or struct trait inventories without leaving the repo.
When should I use rust-trait-explorer?
Use it in Build while designing handlers or generics, and in Ship review when verifying who implements a trait before merging API changes.
Is rust-trait-explorer safe to install?
It requests LSP and read/search tools only; confirm scope in your agent settings and review Security Audits on this page for the skill package.
SKILL.md
READMESKILL.md - 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(&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 │ └───────┬───────┘ └─────┘ └───────┬───────┘ │ │ ┌───────▼───────┐ ┌──