Parent Epic: #62
What
Add FFI and cross-language integration patterns to rust-development SKILL.md.
Sections to Add
- Safe C API Wrappers -- Opaque handle pattern,
#[repr(C)] structs, extern "C" functions
- Panic Catching at FFI Boundary --
std::panic::catch_unwind at every extern entry point
- String Management Across Languages -- CString/CStr patterns, null-terminated strings, ownership transfer
- uniffi for Automatic Bindings -- Generating Kotlin/Swift/Python bindings from Rust
- WASM Interop Patterns -- wasm-bindgen, js-sys, shared memory, serde-wasm-bindgen
Source Reference
Section 10 (FFI and Cross-Language Integration) from RUST_SYSTEM_PROGRAMMING_BEST_PRACTICES.md
Disciplined Engineering Alignment
| Phase |
Skill |
FFI Relevance |
| Research |
disciplined-research |
Map FFI boundary surface area; identify which language bindings needed; catalogue existing unsafe FFI |
| Design |
disciplined-design |
Define opaque handle API; specify ownership transfer rules; document WASM vs native FFI strategy |
| Implementation |
disciplined-implementation |
Each FFI function = one step with safety invariants documented; panic-catch wrappers first, then logic |
| Verification |
disciplined-verification |
Miri on unsafe FFI paths; property tests for string conversion roundtrips; fuzz parsers at boundary |
| Validation |
disciplined-validation |
Validate bindings from target language (Kotlin/Swift/JS); end-to-end cross-language integration test |
The SKILL.md should note:
- During research: audit all
extern blocks and unsafe FFI for safety gaps
- During design: specify ownership transfer semantics at every FFI boundary
- During verification: Miri + fuzzing mandatory for any new FFI surface
Acceptance Criteria