rmc-trait-audit

Audit Rust traits by analyzing definitions, usage fan-in, and dispatch call sites.

29|5|Updated Nov 24, 2025
One-click install
npx skills add https://github.com/molaco/rust-code-mcp --skill rmc-trait-audit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rmc-trait-audit
Source: https://github.com/molaco/rust-code-mcp/tree/main/skills/rmc-trait-audit
Command: npx skills add https://github.com/molaco/rust-code-mcp --skill rmc-trait-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you determine whether a Rust trait (and its methods) is a real abstraction boundary or just vestigial code by measuring usage, imports, and workspace-wide dispatch call sites.

Core Features & Use Cases

  • Trait-scoped audit: Analyzes a single trait T, including its methods, associated items, and fan-in across the workspace.
  • Fan-in and dispatch tracing: Computes who uses T and who calls specific trait methods, including dispatch through generic bounds and dyn T receivers.
  • Deletion/sealing and inlining decisions: Produces verdicts such as delete, seal, inline, keep, or thin-out based on observed importer/implementer patterns and call traffic.

Quick Start

Build the hypergraph for the target project, then run a trait audit for your trait-qualified name to get a per-method dispatch and usage verdict.

Frequently Asked Questions about rmc-trait-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit Rust trait usage to find dead code?

To audit Rust trait usage for dead code, analyze trait definitions, method inventory, and workspace-wide dispatch call sites. This produces verdicts like delete, seal, inline, or keep based on observed importer and call traffic patterns.

What is the best way to determine if a Rust trait is a real abstraction boundary?

Determining if a Rust trait is a real abstraction boundary involves measuring usage imports, implementer patterns, and workspace-wide dispatch call sites. The audit generates structured verdicts indicating whether to keep, seal, or delete the trait.

How do I trace dynamic dispatch and generic bound calls for a Rust trait?

Tracing dynamic dispatch and generic bound calls requires computing who uses the trait and who calls specific methods across the workspace. The audit identifies dispatch through `dyn T` receivers and generic bounds to map call traffic.

Can I get a per-method usage and dispatch verdict for a Rust trait?

Yes, you can get a per-method usage and dispatch verdict by running a trait audit on the qualified name. It enumerates methods, associated items, and fan-in to produce structured refactoring decisions for each method.

Do I need to build a hypergraph before auditing a Rust trait?

Yes, you need to run build_hypergraph before auditing a Rust trait. After that, use find_definition and module_tree to enumerate methods, then who_uses_summary, who_imports, and who_calls to generate the verdict report.