rust-java-migration
Installation
SKILL.md
Java to Rust Migration
Migrate contracts and observable behavior, not Java syntax. Preserve the Java project's public concepts and source traceability while selecting Rust-native ownership, error, concurrency, async, serialization, and framework mechanisms.
Mandatory migration layout
- Derive the Rust directory from the Java package after the declared package root; preserve meaningful nested packages and never flatten, cross-place, or double-nest them.
- Convert the Java object name to acronym-aware
snake_case.rs; keep the Rust type inPascalCaseand do not add suffixes such as_trait. - Keep one Java object as one Rust object boundary. Rust defines no universal file-length limit: treat up to 500 physical lines as normal, review 501–800 lines for cohesion, and block authored
.rsfiles above 800 lines. - Split only when a file mixes responsibilities. Retain one primary object file and use subordinate files for coherent implementation families without introducing a second migrated object; record every split or reviewed exception.
- Keep
lib.rsandmod.rsto declarations and re-exports. Update parent modules after moves and qualify ambiguous external re-exports with::. - Keep focused private-behavior unit tests in
#[cfg(test)]modules when useful. Put public-boundary, cross-module, differential, host, and whole-project tests undertests/or a non-published<project>-testpackage; keep source fixtures under<project>-test/tests/fixtures/.
Read Directory path alignment and Layout and governance, then run the layout audit after moves.
Scope and Routing
Use this skill for full-project migrations, one Maven/Gradle module, parity audits, migration planning, or continuation of an existing Rust port.