rmc-mut-static-audit

Audit Rust workspace static items matching mutable and lazy cell patterns.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identifies and triages Rust global mutable state by auditing every workspace static item whose HIR type matches common global singleton patterns, so you can assess safety and architectural load.

Core Features & Use Cases

  • Workspace-wide type-aware matching: Finds local static items matching static mut, LazyLock<...>, OnceLock<...>, and OnceCell<...> and reports where they live and what types they actually are.
  • Fan-in impact analysis: For each finding, quantifies how many call-sites or dependencies use the global via who_uses / who_uses_summary, highlighting removal difficulty and architectural coupling.
  • Review-ready source context: Pulls the relevant source file region around each finding span using read_file_content so you can inspect initialization and surrounding documentation.

Quick Start

Build the workspace hypergraph, run the global mutable state audit for your workspace path, and then inspect each finding’s file and span to decide whether it needs DI refactoring or safety review.

Frequently Asked Questions about rmc-mut-static-audit

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

FAQPage Schema
How do I audit Rust global mutable state across a workspace?

To audit Rust global mutable state, this Skill locates local `static` items matching `static mut`, `LazyLock<...>`, `OnceLock<...>`, and `OnceCell<...>` patterns across your workspace. It builds a hypergraph to map these singletons and reports their locations and types for architectural review.

What is the best way to assess singleton dependency impact before refactoring Rust code?

Assessing singleton dependency impact before refactoring Rust code requires tracking how many call-sites use each global. This Skill runs `who_uses` and `who_uses_summary` per finding to quantify architectural coupling and removal difficulty for your workspace globals.

How do I find all `static mut` and lazy initialization patterns in my Rust project?

Finding `static mut` and lazy initialization patterns in a Rust project requires type-aware workspace matching. This Skill executes `mut_static_audit` after building a hypergraph to identify HIR types matching `static mut`, `LazyLock`, `OnceLock`, and `OnceCell` and reports their exact file locations.

Do I need to build a hypergraph before running a global state safety audit?

Yes, you need to build a hypergraph before running a global state safety audit. The Skill requires executing `build_hypergraph` first to map workspace dependencies and call-sites, which enables the subsequent `mut_static_audit` and `who_uses` analysis.

Can I review the source context of global mutable state findings during a Rust architecture triage?

You can review the source context of global mutable state findings during a Rust architecture triage by running `read_file_content(file_path=...)`. This pulls the relevant source file region around each finding span to inspect initialization and documentation.