rust-errors-borrow-checker
Installation
SKILL.md
rust-errors-borrow-checker
How to read and fix the six most common borrow-checker errors: E0382, E0502, E0596, E0499, E0500, E0716. Every fix patches the root cause (ownership shape, scope, mutability declaration), not the symptom. .clone() is the last resort, not the first.
Cross-references: [[rust-syntax-ownership]] (move semantics), [[rust-syntax-borrowing]] (&T vs &mut T rules, NLL, split borrows), [[rust-syntax-lifetimes]] (lifetime annotations on borrows), [[rust-errors-lifetimes]] (E0106 / E0623 / E0495 / E0700 / E0759), [[rust-agents-compile-fix]] (orchestration recipe for any rustc error).
When to use this skill
- Compiler reports one of E0382, E0502, E0596, E0499, E0500, E0716 (or the post-NLL un-numbered variants that print the same message).
- User asks "why can't I use this variable after I passed it / assigned it / matched on it".
- User asks "why does Rust forbid
&and&muttogether". - User pastes a borrow-checker message and asks for a fix.
- User reaches for
.clone()as the default escape hatch.
If the message contains "lifetime" or 'a / 'static symbols, use [[rust-errors-lifetimes]] instead.