Skip to content
Agentmart
Submit a tool

rust-compiler-diagnostics

Use when Rust code fails to compile, Clippy reports lints, borrow checker errors appear, lifetimes are unclear, or cargo diagnostics need systematic triage.

Skill by mkurman

IndexedMIT★ 325
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/mkurman-rust-compiler-diagnostics

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when Rust code fails to compile, Clippy reports lints, borrow checker errors appear, lifetimes are unclear, or cargo diagnostics need systematic triage.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/rust-compiler-diagnostics

What's inside

Skill name
rust-compiler-diagnostics
Description
Use when Rust code fails to compile, Clippy reports lints, borrow checker errors appear, lifetimes are unclear, or cargo diagnostics need systematic triage.
License
MIT
Instructions
84 lines in SKILL.md · view on GitHub

Files (2)

  • SKILL.md
  • error-triage.md · references/

SKILL.md (first lines)

# Rust Compiler Diagnostics

Use this skill to resolve Rust compiler and Clippy diagnostics without guessing.

## Workflow

1. Run the narrowest command that reproduces the diagnostic, usually `cargo check -p <crate>` or a focused test.
2. Read the first real compiler error before secondary errors; later diagnostics are often consequences.
3. Identify the ownership, lifetime, type, trait, macro, feature, or lint category involved.
4. Inspect the definition site and the nearest caller before editing.
5. Prefer changing API shape only when the current contract is the real cause.
6. Re-run the same command after each fix, then broaden verification when the focused command is clean.

## Borrow Checker Triage

- Find who owns the value, who borrows it, and how long each borrow actually needs to live.
- Reduce borrow scope with blocks, local variables, or earlier extraction before adding clones.
- Split immutable data from mutable state when one large struct borrow blocks independent access.
- Move expensive or fallible work outside lock guards and mutable borrows.
- Use owned values for spawned tasks and cross-thread work; references rarely fit those lifetimes.

## Diagnostic Repair Examples

### End A Borrow Before Mutation

```rust
// Avoid: `self.items` is immutably borrowed while mutating `self`.
if let Some(item) = self.items.get(id) {
    self.record_access(item.name());
}

// Prefer: extract the needed owned value, ending the borrow.
let name = self.items.get(id).map(|item| item.name().to_owned());
if let Some(name) = name {
    self.record_access(&name);
}
```

### Move Out Of A Field Safely

```rust
if let Some(task) = self.pending_task.take() {
    task.cancel().await;
}
```

Use `Option::take` when a field must be moved out while leaving the struct in a valid state.

### Fix Escaping Borrow In Spawned Tasks

```rust
// Avoid: `&self` cannot be moved into a 'static task.
tokio::spawn(async move {
    self.refresh().await;
});

// Prefer: clone the owned handle needed by the task.
let client = self.client.clone();
tokio::spawn(async move {
    client.refresh().await;
});
```

## Clippy Triage

- Treat Clippy as design feedback, not only style feedback.
- Accept Clippy suggestions when they preserve readability and behavior.
- Add `#[allow(...)]` only near the smallest scope and include a short reason when the lint is intentionally violated.
- Do not silence `unwrap_used`, `expect_used`, `panic`, or lossy conversion lints in production paths without confirming the project policy.

### Prefer Targeted Allows

```rust
#[allow(clippy::too_many_arguments, reason = "constructor mirrors the wire protocol fields")]
pub fn from_wire(/* fields */) -> Self {
    // ...
}
```

## References

Read `references/error-triage.md` for common diagnostic families and repair patterns.

From mkurman/zorai, MIT.

More from mkurman/zorai

Signals

Stars
325
Forks
24
Open issues
0
Last commit (this folder)
May 4, 2026 (5 months ago)
Last release
Oct 23, 2026 (6 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
Website
zorai.app/
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from mkurman

Cite this page

rust-compiler-diagnostics skill. Agent Mart. https://agentmart.dev/skills/mkurman-rust-compiler-diagnostics (last updated 2026-10-24)