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.zipInstalls 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.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
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" fnannotated 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
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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| minimize-rust-ffi-crate-surface (this skill) | 1 | 5mo | No flags | Intermediate |
| organize-modules | 1 | 2mo | Review | Intermediate |
| m06-error-handling | 1 | 6mo | Review | Intermediate |
| m04-zero-cost | 0 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by RediSearch
View all by RediSearch →You might also like
organize-modules
r3bl-org
Apply private modules with public re-exports pattern for clean API design. Includes conditional visibility for docs and tests. Use when creating modules, organizing mod.rs files, or before creating commits.
m06-error-handling
actionbook
CRITICAL: Use for error handling. Triggers: Result, Option, Error, ?, unwrap, expect, panic, anyhow, thiserror, when to panic vs return Result, custom error, error propagation, 错误处理, Result 用法, 什么时候用 panic
m04-zero-cost
actionbook
CRITICAL: Use for generics, traits, zero-cost abstraction. Triggers: E0277, E0308, E0599, generic, trait, impl, dyn, where, monomorphization, static dispatch, dynamic dispatch, impl Trait, trait bound not satisfied, 泛型, 特征, 零成本抽象, 单态化
m05-type-driven
actionbook
CRITICAL: Use for type-driven design. Triggers: type state, PhantomData, newtype, marker trait, builder pattern, make invalid states unrepresentable, compile-time validation, sealed trait, ZST, 类型状态, 新类型模式, 类型驱动设计
upgrade-oxc
rolldown
Upgrade oxc, run codegen, and fix any breaking changes.
clean-code
gregoire78
Apply clean code practices in this repository with small, safe refactors, explicit naming, reduced complexity, and behavior-preserving changes. Use for readability improvements, technical debt cleanup, and maintainability reviews in Rust code.