skills/coding/coding-systems/SKILL.md
Systems meta-skill: Rust + Nim + Go + C for low-level, memory safety, FFI, performance-critical code
npx skillsauth add alphaonedev/openclaw-graph coding-systemsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill equips the AI to handle systems programming using Rust, Nim, Go, and C, focusing on low-level operations, memory safety, FFI (Foreign Function Interface), and performance-critical code. It combines these languages for tasks like OS development, embedded systems, and high-throughput applications.
Use this skill for scenarios requiring direct hardware access, memory management, or inter-language calls, such as writing kernel modules, optimizing network servers, or integrating C libraries into modern languages. Avoid for high-level web apps; prefer when performance bottlenecks demand low-level control.
extern "C" blocks.importc pragma; compiles to C for performance.unsafe blocks for pointer arithmetic; Go's sync package for thread-safe operations; Nim's templates for code generation; C's mmap for direct memory mapping.To accomplish tasks, structure code with language-specific patterns: Use Rust for safe wrappers around C code; employ Go for scalable concurrent systems; leverage Nim for rapid prototyping of C-like code; fall back to C for hardware-level optimizations. For FFI, always define interfaces first (e.g., in C headers), then bind in target languages. Pattern: Import C headers in Rust via #[link(name = "libc")]; in Go, use // #cgo LDFLAGS: -lmylib for linking.
cargo build --release for optimized binaries; use std::ffi::c_void for FFI pointers. API example: extern "C" fn add(a: i32, b: i32) -> i32 { a + b }nim c --cc:gcc -d:release myfile.nim; FFI via proc add(a: cint, b: cint): cint {.importc: "add", header: "myheader.h".}proc add(a: cint, b: cint): cint {.importc.}
echo add(1, 2) # Calls external C function
go build -o myapp with cgo; API: import "C" for FFI. Example: C.add(C.int(1), C.int(2))import "C"
func main() { println(int(C.add(1, 2))) }
gcc -O3 -o myprog myfile.c for optimizations; use #include <sys/mman.h> for OS APIs.[dependencies] libc = "0.2"); Go's go.mod for modules; Nim's .nimble for packages.Integrate by linking languages via FFI: For Rust-C, set build.rs to generate bindings with bindgen; in Go, use cgo directives like // #include "myheader.h". If API keys are needed (e.g., for external tools), set env vars like $RUST_ANALYZER_API_KEY. For cross-language projects, use CMake for unified builds: Add add_subdirectory(rust_project) in CMakeLists.txt. Always handle ABI compatibility; e.g., ensure C functions use __attribute__((visibility("default"))) for export.
In Rust, use Result<T, E> for fallible operations; check with match or ?. For Nim, use exceptions with try/except; e.g., try: raise newException(ValueError, "Error") except: echo "Handled". Go errors return as second values; check with if err != nil { return err }. C uses errno; wrap with custom error codes. General pattern: Propagate errors up the call stack and log with details, e.g., in Rust: fn safe_add(a: i32) -> Result<i32, String> { if a < 0 { Err("Negative input".to_string()) } else { Ok(a + 1) } }.
extern "C" { fn malloc(size: usize) -> *mut u8; }. Then, in code: let ptr = unsafe { malloc(1024) }; if ptr.is_null() { panic!("Allocation failed"); }. This pattern ensures safe memory handling in performance-critical apps.go func() { for i := 0; i < 100; i++ { fmt.Println(i) } }(); runtime.Gosched(). Integrate with C via cgo for low-level I/O, e.g., to read from a file descriptor, ensuring non-blocking operations for real-time systems.tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui