skills/rust/SKILL.md
--- name: Rust slug: rust version: 1.0.1 description: Write idiomatic Rust avoiding ownership pitfalls, lifetime confusion, and common borrow checker battles. license: MIT metadata: author: swal version: "1.0.1" metadata: {"clawdbot":{"emoji":"🦀","requires":{"bins":["rustc","cargo"]},"os":["linux","darwin","win32"]}} --- ## Quick Reference | Topic | File | Key Trap | |-------|------|----------| | Ownership & Borrowing | `ownership-borrowing.md` | Move semantics catch everyone | | Strings
npx skillsauth add iberi22/swal-skills skills/rustInstall 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.
| Topic | File | Key Trap |
|-------|------|----------|
| Ownership & Borrowing | ownership-borrowing.md | Move semantics catch everyone |
| Strings & Types | types-strings.md | String vs &str, UTF-8 indexing |
| Errors & Iteration | errors-iteration.md | unwrap() in production, lazy iterators |
| Concurrency & Memory | concurrency-memory.md | Rc not Send, RefCell panics |
| Advanced Traps | advanced-traps.md | unsafe, macros, FFI, performance |
&for item in vec moves vec — use &vec or .iter() to borrowString moved into function — pass &str for read-only access&mut and & simultaneously — restructure or interior mutability&mut self blocks all access — split struct or RefCell'static means CAN live forever, not DOES — String is 'static capable<'a> — struct Foo<'a> { bar: &'a str }fn get<'a>(s: &'a str) -> &'a strs[0] doesn't compile — use .chars().nth(0) or .bytes().len() returns bytes, not chars — use .chars().count()s1 + &s2 moves s1 — use format!("{}{}", s1, s2) to keep bothunwrap() panics — use ? or match in production? needs Result/Option return type — main needs -> Result<()>expect("context") > unwrap() — shows why it panicked.iter() borrows, .into_iter() moves — choose carefully.collect() needs type — collect::<Vec<_>>() or typed bindingRc is NOT Send — use Arc for threadsMutex lock returns guard — auto-unlocks on drop, don't hold across awaitRwLock deadlock — reader upgrading to writer blocks foreverRefCell panics at runtime — if borrow rules violatedBox for recursive types — compiler needs known sizeRc<RefCell<T>> spaghetti — rethink ownership| Error | Cause | Fix |
|-------|-------|-----|
| value moved here | Used after move | Clone or borrow |
| cannot borrow as mutable | Already borrowed | Restructure or RefCell |
| missing lifetime specifier | Ambiguous reference | Add <'a> |
| the trait bound X is not satisfied | Missing impl | Check trait bounds |
| type annotations needed | Can't infer | Turbofish or explicit type |
| cannot move out of borrowed content | Deref moves | Clone or pattern match |
cargo update updates Cargo.lock, not Cargo.toml — manual version bump needed[dev-dependencies] not in release binary — but in tests/examplescargo build --release much faster — debug builds are slow intentionallytesting
Xavier2 as the central context engine for SWAL - intelligent memory, decision-making, and context orchestration. Xavier2 is the CEO brain that stores memories, coordinates agents, and maintains project state.
tools
Delegate coding tasks to Codex, Claude Code, or Pi agents via background process. Use when: (1) building/creating new features or apps, (2) reviewing PRs (spawn in temp dir), (3) refactoring large codebases, (4) iterative coding that needs file exploration. NOT for: simple one-liner fixes (just edit), reading code (use read tool), thread-bound ACP harness requests in chat (for example spawn/run Codex or Claude Code in a Discord thread; use sessions_spawn with runtime:"acp"), or any work in ~/clawd workspace (never spawn agents here). Claude Code: use --print --permission-mode bypassPermissions (no PTY). Codex/Pi/OpenCode: pty:true required.
testing
Validador automático para WorldExams. Verifica integridad técnica y calidad pedagógica, activando regeneración automática si es necesario.
tools
Generador de bundles de preguntas ICFES Colombia (Matemáticas, Lectura Crítica, Ciencias, Sociales, Inglés) para grados 6, 9 y 11 usando MiniMax MCP.