| name | rust-agents-compile-fix |
| description | Use when iterating on rustc compile errors: how to read a rustc error, which errors to fix first, when to apply rustc's suggestion blindly vs inspect it, when to consult `rustc --explain`, and when to stop and ask instead of cascading edits. Prevents fixing errors bottom-up, blindly accepting lifetime suggestions, and cascading clone()/lifetime edits that mask a design problem. Covers: reading a rustc error (primary span, secondary spans, help, note), fix earliest error first (later errors are often cascades), `cargo fix` for machine-applicable suggestions, when to inspect a suggestion (lifetime / trait-bound suggestions need judgement), `rustc --explain EXXXX`, one-line fixes (missing `mut` / `&` / `use` / derive), common refactors (introduce binding, take by-value, restructure ownership), and when to STOP and ask the user (ownership refactor cascading across modules, lifetime requiring API redesign). Keywords: "rustc error", "compile error", "fix compile error", "cargo fix", "rustc --explain", "how to read rustc error", "error iteration", "which error first", "cascading errors", "compiler suggestion", "missing mut", "missing use", "borrow checker fix", "should I refactor", "stop and ask", "compile loop", "won't compile".
|
| license | MIT |
| compatibility | Designed for Claude Code. Requires Rust 1.85+, edition 2024. |
| metadata | {"author":"OpenAEC-Foundation","version":"1.0"} |
Rust Agents Compile-Fix
This skill is the procedure for iterating on rustc compile errors. It does ONE job: take a failing cargo build / cargo check and converge on a clean compile, deliberately and without cascading edits.
ALWAYS use cargo check (not cargo build) while iterating: it skips codegen and is faster. ALWAYS recompile after each fix. NEVER batch-fix many errors and recompile once.
This skill iterates on errors. It does NOT route tasks (that is rust-agents-orchestrator) and does NOT do deep idiom review (that is rust-agents-code-reviewer). For the meaning of a specific error class, hand off to the relevant rust-errors-* skill.
The Compile-Fix Loop
1. cargo check # get the full error list
2. read the FIRST error top to bottom # earliest in compile order
3. classify the error (see decision tree)
4. apply ONE fix
5. cargo check again # re-evaluate from scratch
6. repeat from step 2 until clean
ALWAYS fix the earliest error first. Later errors are frequently cascades of the first: a single missing use or wrong type can produce ten downstream errors that all vanish when the root is fixed. NEVER trust the error count until the first error is resolved.
ALWAYS treat "more than 2 to 3 failed attempts on the same error" as a signal to STOP and ask the user. Repeated failure means the fix is a design change, not a one-liner.
How to Read a rustc Error
A rustc diagnostic has a fixed shape. Read it top to bottom.
error[E0382]: borrow of moved value: `v` <- 1. error code + headline
--> src/main.rs:4:20 <- 2. primary location
|
2 | let v = vec![1, 2, 3];
| - move occurs because `v` has type ... <- 3. secondary span (context)
3 | let w = v;
| - value moved here <- 3. secondary span (the cause)
4 | println!("{:?}", v);
| ^ value borrowed here after move <- 4. primary span (the ^^^)
|
= note: ... <- 5. note: extra context
help: consider cloning the value ... <- 6. help: a candidate fix
|
3 | let w = v.clone();
| ++++++++
| Part | What it is | How to use it |
|---|
error[EXXXX] | the error code and one-line summary | the headline; look up the code if unfamiliar |