Most "AI coding assistant" prompts about Rust read like the first chapter of a textbook: ownership, borrowing, lifetimes, here's how Vec works. That's not what you need from an assistant when you're three hours into debugging why a MutexGuard is poisoning your async runtime. You need the thing a senior engineer would tell you across the desk — the rule, the reason, and the escape hatch.
I packaged that into a single Claude Code skill: senior-rust. It's distilled from huiali/rust-skills — a 38-sub-skill collection — collapsed into one opinionated playbook with no routers, no sub-skills, no decision trees telling Claude which file to load next. One file, ~250 lines, always loaded.
Why one file instead of 38
The original is excellent reference material. It's also a discovery problem: the model has to figure out which sub-skill applies before it can use the advice. For Rust, where the same task often touches ownership, async, error handling, and unsafe all at once, the routing overhead eats the budget you wanted to spend on the actual problem.
Collapsing it works because the skill isn't trying to teach Rust — it's trying to set defaults and flag landmines. Defaults compress well. Landmines compress well. The 38-skill version had detailed chapters on DPDK, eBPF, GPU compute, XACML, and embedded — those got cut. If you're writing eBPF probes, you don't want a generalist skill; you want the specialist.
What "senior" means in a skill file
The skill makes opinionated calls instead of presenting options. A few examples:
- "Never hold a
MutexGuardacross.await." Not "be careful about." Not "consider whether." Never. The skill assumes the reader can handle a rule and ask for exceptions if needed. - "If you fail 3 times on the same error, stop fixing symptoms — escalate to design." This one is for the model itself. LLMs love to grind on borrow-checker errors with increasingly baroque workarounds. The skill gives Claude permission to stop and say "this data flow is wrong."
- A compiler-error decoder table that maps
E0382/E0597/ etc. to the question to ask, not the syntax to type.E0507 → "Why are you taking ownership from a reference?"is more useful than ten lines of code showing how to add.clone(). - A performance order-of-operations with rough multipliers (algorithm 10×–1000×, allocations 2×–5×, SIMD 2×–8×). The numbers are approximate on purpose — they're there to stop the model from reaching for SIMD before checking the algorithm.
Format choices that pulled their weight
Three things mattered more than I expected:
Tables for decisions. Smart-pointer choice, error-handling escalation, compiler-error decoder. Tables force you to write the rule, not a discursive paragraph. The model parses them as lookups; humans parse them at a glance.
An anti-patterns checklist. Listing what not to do turns out to be denser than listing what to do. "String everywhere → use &str / Cow<'_, str> / Box<str>" is one line that covers a class of mistakes. A positive version would take a paragraph.
Naming things. "Rc in a multi-threaded context is the #1 false-friend. Mutex held across .await is the #2." Numbering creates priority. The model now has a ranked list of mistakes to actively look for, not a generic "be careful with concurrency" platitude.
What I'd change next
A few things are still wrong-shape:
- The validation-commands block is a list of tool invocations. It belongs in a hook or a CI config, not in instructions the model reads every turn.
- The unsafe/FFI section is shorter than it should be. Either expand it to be useful or split it into a sub-skill that loads only when
unsafeorextern "C"is in the diff. - No examples of recovering from a bad design — the skill says "redesign after the third failure" but doesn't show what a redesign looks like.
Using it
Drop it in .claude/skills/senior-rust/SKILL.md in any project where you write Rust. Claude Code auto-loads it. There's no slash command; the description in the frontmatter is what makes the model pull it in when the task smells Rust-shaped.
Full skill, MIT-licensed, on the gist. Credit to huiali/rust-skills for the source material.
