MI

minimize-rust-ffi-crate-surface

Automates the identification and removal of dead or test-bound C symbols in Rust FFI crates.

Install

mkdir -p .claude/skills/minimize-rust-ffi-crate-surface && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5883" && unzip -o skill.zip -d .claude/skills/minimize-rust-ffi-crate-surface && rm skill.zip

Installs to .claude/skills/minimize-rust-ffi-crate-surface

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Remove Rust-defined C symbols that are either unused or only used in C/C++ unit tests. Use this when you are refactoring a Rust FFI crate and want to remove unused symbols.
172 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Identifies unused C symbols exposed by Rust crates
  • Generates refactoring plans for test-only symbols
  • Validates symbol removal using shell-based test triggers
  • Tags symbols as test-only in Rust source documentation

How it works

Cross-references symbol usage between Rust FFI headers and C unit tests, then applies systematic removal or metadata tagging.

Inputs & outputs

You give it
Crate path or source directory
You get back
Cleaned codebase with removed symbols and updated FFI documentation

When to use minimize-rust-ffi-crate-surface

  • Remove unused C symbols in Rust FFI
  • Clean up implementation details exposed to C tests
  • Refactor Rust crate surface area

About this skill

Minimize Rust FFI Crate Surface

Remove C symbols defined in a Rust FFI crate or file that are either unused or only used in C/C++ unit tests.

Arguments

  • <path>: Path to the Rust crate or file.
  • <path 1> <path 2>: Multiple Rust crates/files.

If the path doesn't start with src/, assume it to be in the src/redisearch_rs/c_entrypoint directory. E.g. numeric_range_tree_ffi becomes src/redisearch_rs/numeric_range_tree_ffi. If the path points to a directory, review the documentation of all Rust files in that directory.

Instructions

  • Use analyze-rust-ffi-crate-surface to enumerate and analyze the usage of all the FFI symbols exposed by the Rust crate or file (e.g. extern "C" fn annotated with #[unsafe(no_mangle)] or type definitions).
  • For each unused symbol:
    • Delete its Rust definition.
    • Run C/C++ unit tests to ensure the symbol was indeed unused (via ./build.sh RUN_UNIT_TESTS)
  • For each symbol that is only used in C/C++ unit tests, elaborate a plan to either:
    • Refactor the C/C++ unit tests not to use it.
    • Remove the C/C++ unit tests (or assertions) that rely on it, since they are prying into the implementation details of the Rust crate.
    • Keep the symbol, but mark it as "test only" in the Rust documentation.

When not to use it

  • When symbols are required by external, non-test C consumers
  • When modifying non-FFI Rust code

Prerequisites

Existing C/C++ unit test suite

Limitations

  • Requires functional C/C++ unit tests for validation
  • Limited to the defined FFI path structure

How it compares

It specifically targets FFI-boundary noise reduction rather than generic dead code elimination.

Compared to similar skills

minimize-rust-ffi-crate-surface side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
minimize-rust-ffi-crate-surface (this skill)15moNo flagsIntermediate
organize-modules12moReviewIntermediate
m06-error-handling16moReviewIntermediate
m04-zero-cost06moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry