minimize-rust-ffi-crate-surface

Remove unused or test-only C symbols from Rust FFI crates.

6.2k|590|Updated May 5, 2016
One-click install
npx skills add https://github.com/RediSearch/RediSearch --skill minimize-rust-ffi-crate-surface
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: minimize-rust-ffi-crate-surface
Source: https://github.com/RediSearch/RediSearch/tree/main/.skills/minimize-rust-ffi-crate-surface
Command: npx skills add https://github.com/RediSearch/RediSearch --skill minimize-rust-ffi-crate-surface

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Remove Rust-defined C symbols that are either unused or only used in C/C++ unit tests.

Core Features & Use Cases

  • Shrinks the public surface of Rust FFI crates by pruning unused or test-only C symbols.
  • Improves compile times and maintenance by reducing the number of exported symbols.
  • Facilitates safer refactors by clearly separating production interfaces from test-only bindings.

Quick Start

Run the tool on a Rust FFI crate or directory containing FFI bindings, for example: minimize-rust-ffi-crate-surface path/to/ffi_crate.

Frequently Asked Questions about minimize-rust-ffi-crate-surface

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

FAQPage Schema
How do I remove unused C symbols from a Rust FFI crate?

Minimize Rust FFI crate surface by identifying and deleting C symbols that are unused or only referenced in C/C++ unit tests. The tool analyzes symbol usage across your crate, removes candidates without breaking production code, and validates changes by running your test suite.

What's the difference between production C symbols and test-only symbols in Rust FFI?

Production symbols are called by live C/C++ code; test-only symbols exist solely for unit testing. Distinguishing them lets you safely prune test symbols to shrink your FFI surface, improve compile times, and clarify which bindings are actually required for production.

Can I refactor a Rust FFI crate without breaking C/C++ code that depends on it?

Yes. The tool identifies which C symbols are safe to remove by analyzing actual usage, then validates your refactor by running unit tests. This separates production interfaces from test-only bindings, making refactors safer and more maintainable.

How do I know which C symbols in my Rust crate are actually used?

Run the tool on your FFI crate to enumerate all C symbol usage across src/ paths. It reports which symbols are unused, which are only called in tests, and which are production-facing, giving you a clear picture of your actual API surface.

What happens if I remove a C symbol that's still needed?

The tool validates all changes by running your test suite (./build.sh RUN_UNIT_TESTS). If a removed symbol breaks production or test code, the validation catches it, so you can restore the symbol before deployment.

Does minimizing FFI symbols improve performance or just code cleanliness?

It improves both. Removing unused C symbol definitions reduces compile time, linker overhead, and maintenance burden. Shrinking your public surface also clarifies which bindings are production-critical versus test scaffolding.