agentleFS
Baba01hacker666Baba01hacker666/dummyskills/skills/rust/rust-clippy-check/SKILL.md

rust-clippy-check

Skill0 starsChanged 2 months agoMITView on GitHub

Guides agents through running and resolving cargo clippy warnings, borrow-checker diagnostics, and rustfmt.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 14
  2. Very specific:

    Do not use for running tests.

    line 20
  3. Distinctive:

    If not specified: default to current directory.

    line 26
  4. Very specific:

    Strict Ban: Never add #![allow(clippy::...)] without explicit user permission.

    line 27
  5. Distinctive:

    Follow these numbered actions:

    line 30
  6. Very specific:

    Use references (&T) instead of cloning (.clone()) where possible.

    line 36
  7. Very specific:

    If clippy recommends .into_iter() vs .iter(): follow borrow vs move semantics.

    line 44
  8. Distinctive:

    Stop and ask the user when:

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rust Clippy and Linter (cargo clippy)

Executes Rust's static analyzer cargo clippy and formatter rustfmt. Resolves borrow-checker conflicts, unnecessary allocations, and clippy lints without #![allow(...)].

1. Purpose

Eliminate performance antipatterns and borrow-checker hazards in Rust.

2. When to Use

Use this skill when:

  • Checking Rust code before committing.
  • Resolving cargo clippy -- -D warnings errors.
  • Resolving borrow checker errors (E0382: borrow of moved value, E0502: cannot borrow as mutable).

3. When Not to Use

  • Do not use for running tests; use rust-testing.

4. Required Inputs

  • crate_path: Path to Cargo crate (default: .).

5. Missing-Input Behavior

  1. If not specified: default to current directory.
  2. Strict Ban: Never add #![allow(clippy::...)] without explicit user permission.

6. Procedure

Follow these numbered actions:

  1. Action 1: Run Cargo Check
    • Execute: cargo check
  2. Action 2: Run Cargo Clippy
    • Execute: cargo clippy --all-targets -- -D warnings
  3. Action 3: Resolve Borrow Checker & Allocation Lints
    • Use references (&T) instead of cloning (.clone()) where possible.
    • Replace manual loops with iterator combinators where recommended.
  4. Action 4: Format Code
    • Execute: cargo fmt
  5. Action 5: Re-verify
    • Confirm exit code 0 on cargo clippy.

7. Decision Rules

  • If clippy recommends .into_iter() vs .iter(): follow borrow vs move semantics.

8. Output Format

Emit the report using this template:

### Rust Clippy Report: [Crate]

- **Clippy Command**: `cargo clippy -- -D warnings` -> PASS
- **Format Command**: `cargo fmt -- --check` -> PASS
- **Lints Resolved**: [Count]

#### Resolved Lints
- `[file:line]`: [Clippy lint name and fix description]

9. Verification Checklist

  • cargo clippy exits with code 0.
  • No #![allow(...)] overrides added.
  • Code formatted with cargo fmt.

10. Common Failures and Recovery

Failure SymptomCauseRecovery Action
E0382: use of moved valueValue moved in earlier statementPass by reference &val or borrow clone.

11. Stop or Escalation Conditions

Stop and ask the user when:

  • Resolving borrow requires redesigning core data structures (e.g. using Arc<Mutex<T>>).

12. Examples

Example 1: Successful Execution

Input:

Crate: .
Error: clippy::needless_borrow on &String

Output:

### Rust Clippy Report: .

- **Clippy Command**: `cargo clippy -- -D warnings` -> PASS
- **Format Command**: `cargo fmt -- --check` -> PASS
- **Lints Resolved**: 1

#### Resolved Lints
- `src/main.rs:18`: Removed redundant borrow `&s` where `&str` was already expected.

Example 2: Ambiguous or Missing Input

Input:

Clippy check.

Output:

### Rust Clippy Report: .

- **Clippy Command**: `cargo clippy -- -D warnings` -> PASS
- **Lints Resolved**: 0

Example 3: Expected Final Output

Output:

### Rust Clippy Report: parser-crate

- **Clippy Command**: `cargo clippy -- -D warnings` -> PASS
- **Lints Resolved**: 3

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.