MCPInstall

rust-style-clippy

Apply and diagnose Rust style, rustfmt, Clippy, compiler diagnostics, Edition migrations, lint policy, idiomatic control flow, error handling, allocation behavior, production Rust conventions, and the Rust API Guidelines ↔ Clippy lint mapping. Use when users ask to format or lint Rust, fix warning or error codes, migrate editions, review unwrap or clone usage, improve idioms, map a C- API guideline rule to the enforcing Clippy lint, or establish CI quality gates. Route API shape decisions (naming conventions, type/trait design, module layout, full C- guideline review) to the rust-api-design skill.

Installs
137
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/full-stack-skills/rust-skills --skill rust-style-clippy
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads rust-style-clippy automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Rust Style Formatting and Static Analysis

Based on the rustfmt Book, Clippy Book, Edition Guide, and Error Code Index.

Capability Boundaries

✅ Strengths

  1. Stable rustfmt configuration (edition, max_width, tab_spaces, use_field_init_shorthand, etc.)
  2. Clippy lint system — all 10 lint groups: correctness, suspicious, style, complexity, perf, pedantic, restriction, cargo, nursery, internal
  3. clippy.toml configuration (msrv, arithmetic-side, cognitive-complexity-threshold, avoid-breaking-exported-api, etc.)
  4. #[expect(...)] attribute (Rust 1.81+) for CI-enforced lint expectations
  5. Lint priority ordering for layered policy
  6. Production CI lint policy (deny/warn/allow decisions per group)
  7. Edition migration (2015→2018→2021→2024, key changes per edition and cargo fix commands)
  8. Compiler error code interpretation (rustc --explain, common error codes reference table)

⚠️ Prerequisites

  1. Rust toolchain installed and configured

❌ Out of Scope

  1. Rust syntax basics → Use rust-stable skill
  2. Code review → Use rust-code-review skill
  3. API shape design (naming, type/trait design, module layout) and the full ~100 C-* API Guidelines checklist → Use the rust-api-design skill. This skill only maps the ~25 C-* rules that Clippy can mechanically enforce; the rest are design decisions.

When to Use

  • "Format Rust code"
  • "Run Clippy"
  • "Migrate to a new Edition"
  • "What does compiler error E0xxx mean?"

I. rustfmt Configuration

# .rustfmt.toml
max_width = 100                    # Line width (default: 100)
tab_spaces = 4                     # Indentation spaces
edition = "2024"                   # Rust edition
merge_derives = true               # Merge derives
use_field_init_shorthand = true    # Field initialization shorthand
use_try_shorthand = true            # Use ? shorthand
cargo fmt                           # Format all files
cargo fmt --check                   # Check formatting (CI usage)
cargo fmt -- --config max_width=80  # Apply specific configuration

Options such as imports_granularity, group_imports, and reorder_impl_items may still require nightly rustfmt; do not include them in default configurations that must pass stable CI.

II. Clippy

cargo clippy                              # Default: correctness, suspicious, style, complexity, perf
cargo clippy -- -W clippy::pedantic       # Enable pedantic group
cargo clippy --fix                        # Auto-fix MachineApplicable lints
cargo clippy -- -A clippy::module_inception  # Allow a specific lint

All 10 lint groups

GroupDefault levelDescriptionHigh-leverage lints
correctnessdeny (effectively)Code that is wrong — broken semanticsalmost_swap, drop_non_drop, if_same_then_else, out_of_bounds_looping, ptr_offset_with_cast
suspiciouswarnLikely-buggy code that compiles but smells offmutable_key_type, assign_op_pattern, blqcklisted_name, cast_lossless, clone_on_ref_ptr
stylewarn (default group)Idiomatic Rust stylistic preferencesenum_variant_names, new_without_default, wrong_self_convention, needless_return, module_inception
complexitywarnCode that could be simplertoo_many_arguments, cognitive-complexity, manual_flatten, option_option
perfwarnPerformance hints (allocations, copies)large_enum_variant, single_char_pattern, manual_memcpy, vec_box, derivable_impls
pedanticallow (opt-in)Opinionated style — stricter than stylecast_possible_truncation, fn_params_excessive_bools, must_use_candidate, missing_errors_doc, module_name_repetitions
restrictionallow (opt-in)Forbid patterns that may be intentional but riskyunwrap_used, expect_used, panic, indexing_slicing, dbg_macro, print_stdout, float_arithmetic
cargowarnCargo.toml qualitycargo_common_metadata, negative_feature_names, redundant_feature_names, wildcard_dependencies
nurseryallow (experimental)Lints under developmentuse_self, fallible_impl_from, missing_const_for_fn
internalallowFor Clippy's own development(rarely used by users)

#[expect] attribute (Rust 1.81+) — better than #[allow]

// ✅ #[expect] — CI fails if the lint stops firing, surfacing dead expectations
#[expect(clippy::too_many_arguments, reason = "configurable builder has many options")]
fn build(name: &str, retries: u32, timeout: u32, /* 5 more */) { /* */ }

// ❌ #[allow] — silently becomes dead code if the lint stops firing
#[allow(clippy::too_many_arguments)]
fn build(/* */) { /* */ }

Prefer #[expect] for intentional suppressions; reserve #[allow] for transient reasons.

Lint priority — layering

// Higher priority wins. Use for layered policy.
#![warn(clippy::pedantic)]                       // enable pedantic (priority 0)
#![warn(priority = 1, clippy::module_name_repetitions)]  // re-enable a specific lint

clippy.toml configuration

# clippy.toml at workspace root
msrv = "1.85"                                  # Don't suggest APIs newer than MSRV
avoid-breaking-exported-api = false            # Suggest fixes that change public API
cognitive-complexity-threshold = 25            # Function complexity limit
arithmetic-side = "checked"                    # Prefer checked_* arithmetic
enum-variant-name-threshold = 1                # Trigger variant_name lint
single-char-binding-names-threshold = 3        # Allow `_a`, `_b`, but not 4+
too-many-arguments-threshold = 7
type-complexity-threshold = 250
disallowed-methods = [
    { path = "std::env::var", reason = "use our config::get instead" },
]
disallowed-types = [
    { path = "std::collections::LinkedList", reason = "almost never the right choice" },
]
disallowed-macros = [
    { path = "std::println", reason = "use tracing in libraries" },
]

See references/clippy-lint-policy.md for the full clippy.toml reference and production policies.

Production CI lint policy

Different projects need different strictness. See references/clippy-lint-policy.md for ready-to-paste configurations.

Project typePedanticRestrictionRecommended
Library (published)warnallowclippy::all + clippy::pedantic warn + cargo::cargo_common_metadata deny
Application / binarywarnwarn (unwrap_used)Add restriction::unwrap_used, panic, indexing_slicing
Embedded / safety-criticalwarndenyAll restriction lints deny; add float_arithmetic deny
Internal toolallowallowJust clippy::all (default groups)

III. Edition Migration

# Check current edition
cargo metadata --format-version 1 | jq '.packages[0].edition'

# Migration steps (example: 2021 → 2024)
cargo fix --edition               # Auto-migrate code
cargo build                       # Verify compilation
cargo test                        # Validate functionality

# Update Cargo.toml
# edition = "2024"

Key changes per edition:

EditionKey Changes
2015→2018Path and module import changes, dyn Trait, NLL, anonymous lifetimes and keywords changed
2018→2021Precise closure capture, array IntoIterator, panic macro consistency, prelude and reserved syntax changes
2021→2024RPIT lifetime capture, match ergonomics adjustment, temporary value scope, unsafe extern/unsafe attributes, gen keyword, etc.

IV. Compiler Error Code Quick Reference

# View error details
rustc --explain E0277
Error CodeMeaningTypical Scenario
E0277Trait not implementedT: Trait bound is unsatisfied
E0308Type mismatchExpected type A, but B provided
E0502Borrow conflictCannot have mutable borrow and immutable borrow simultaneously
E0597Insufficient lifetimesReference goes out of scope beyond its lifetime value
E0432Import not founduse path is incorrect
E0061Parameter count mismatchFunction call has wrong number of parameters
E0106Missing lifetimesFunction signature requires explicit lifetimes
E0382Use moved valueOwnership already transferred
E0499Simultaneous mutable borrowOnly one &mut allowed per expression
E0716Insufficient lifetime for temporary valuesReference on temporary exceeds its scope

V. API Guidelines ↔ Clippy Lints

The Rust API Guidelines checklist uses C-* rules (about 100 total). Clippy mechanically enforces roughly 25 of them; the remaining ~75 are design judgments (naming, type/trait shape, module layout) that belong to the rust-api-design skill, or require cargo-semver-checks for breaking-change detection. The table below lists the 12 highest-leverage mappings reviewers ask about most. The full crosswalk, including "lints not yet covered" guidance, lives in references/api-guidelines-to-clippy.md.

C-* RuleClippy LintGroupEffect
C-UNWRAPclippy::unwrap_usedrestrictionFlags unwrap() calls
C-UNWRAPclippy::expect_usedrestrictionFlags expect() calls
C-PANICclippy::panicrestrictionFlags panic!()
C-INDEXINGclippy::indexing_slicingrestrictionFlags [i] indexing (panics)
C-BOOL-ARGclippy::fn_params_excessive_boolspedanticFunctions with ≥3 bool params
C-NEWTYPEclippy::new_without_defaultstylenew() exists but no Default
C-NEWTYPEclippy::new_ret_no_selfstylenew() returns non-Self
C-CONV / C-WRONG-SELFclippy::wrong_self_conventionstyleas_X(self) taking &self, or to_X(&self) consuming self
C-STRING-PATTERNSclippy::single_char_patternperf.contains("a") → .contains('a')
C-COMMON-TRAITSclippy::derivable_implsperfManual impl that could be derived
C-LARGE-NUMERICclippy::unreadable_literalstyle1000000 should be 1_000_000
C-MUTABLE-KEYclippy::mutable_key_typesuspiciousHashMap key type is mutable
C-CLONE-ON-REFclippy::clone_on_ref_ptrrestriction.clone() on Rc/Arc

Many restriction and pedantic lints are off by default — enable them explicitly via #![warn(clippy::unwrap_used)] or in clippy.toml when enforcing a guideline in CI.

Workflow

  1. Format code — cargo fmt ensures consistent style
  2. Run Clippy — cargo clippy runs the 5 default groups (correctness, suspicious, style, complexity, perf); add -W clippy::pedantic for stricter
  3. Decide policy — pick pedantic/restriction level by project type (see table above); paste the matching config from references/clippy-lint-policy.md
  4. Configure clippy.toml — set msrv, disallowed-methods, and any project-specific thresholds
  5. Use #[expect] for intentional suppressions — keeps CI honest about dead expectations
  6. Check Edition — Confirm edition in Cargo.toml is up-to-date
  7. CI integration — cargo fmt --check + cargo clippy -- -D warnings + cargo audit in CI

Gotchas

  1. cargo clippy --fix only fixes lints at MachineApplicable level
  2. rustfmt config file is named .rustfmt.toml, not rustfmt.toml
  3. After edition migration, new warnings may appear — especially around unsafe_op_in_unsafe_fn in 2024
  4. cargo fix --edition does not fix all issues; manual review required after migration
  5. Prefer let ... else for early exits and is_some_and/then_some for simple boolean mapping; avoid compressing complex control flows just to use modern syntax
  6. saturating_*, checked_*, and regular arithmetic expressions have different business semantics regarding overflow strategy — decide first, then select API

On-Demand Resources

  • Format and Clippy Examples
  • Lint Group Quick Reference
  • Clippy Lint Policy: Full clippy.toml reference, all 10 lint groups in depth, #[expect] patterns, priority layering, and ready-to-paste production CI configurations by project type.
  • Production Rust Idioms: Review let-else, Option combinators, newtype patterns, non-exhaustive APIs, lock scopes, and overflow strategies when reviewing production code.
  • API Guidelines ↔ Clippy Lints Crosswalk: Full mapping from Rust API Guidelines C-* rules to the Clippy lints that enforce them, plus the ~75 rules Clippy does not cover and where to review them.
  • examples/golden-style/: Golden examples for CI passing rustfmt and Clippy

Official References

FAQ

What does the rust-style-clippy skill do?

Apply and diagnose Rust style, rustfmt, Clippy, compiler diagnostics, Edition migrations, lint policy, idiomatic control flow, error handling, allocation behavior, production Rust conventions, and the Rust API Guidelines ↔ Clippy lint mapping. Use when users ask to format or lint Rust, fix warning or error codes, migrate editions, review unwrap or clone usage, improve idioms, map a C- API guideline rule to the enforcing Clippy lint, or establish CI quality gates. Route API shape decisions (naming conventions, type/trait design, module layout, full C- guideline review) to the rust-api-design skill.

How do I install rust-style-clippy?

Run npx skills add https://github.com/full-stack-skills/rust-skills --skill rust-style-clippy in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/rust-style-clippy/ (personal) or .claude/skills/rust-style-clippy/ (project).

Which AI agents can use rust-style-clippy?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is rust-style-clippy safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains rust-style-clippy?

It is published by full-stack-skills in full-stack-skills/rust-skills. It has 137 recorded installs.

More from full-stack-skills/rust-skills

View all →

rust-testing

full-stack-skills/rust-skills

Design, implement, and validate Rust tests, including unit, integration, doctest, compile-fail, property, fuzz, benchmark, coverage, async, concurrency, process, daemon, IPC, terminal, platform, and hardware-facing test strategies. Use when users ask for Rust test architecture, flaky-test diagnosis, coverage gates, benchmarks, trybuild, cargo-nextest, real-process tests, or failure-path verification.

Testing & QA148 installs

rust-concurrency

full-stack-skills/rust-skills

Design, implement, diagnose, and test Rust concurrency and parallelism with threads, Send and Sync, locks, atomics, channels, Tokio, Rayon, Crossbeam, bounded backpressure, actor ownership, task supervision, graceful shutdown, runtime diagnostics, and Loom model tests. Use when users ask about shared state, deadlocks, async tasks, CPU parallelism, high concurrency, daemon resource budgets, slow consumers, worker pools, lock-free structures, or concurrent correctness.

Backend & APIs137 installs

rust-performance

full-stack-skills/rust-skills

Measure, profile, optimize, and regression-test Rust performance across latency, throughput, CPU, allocations, memory, binary size, and compile time using representative workloads, Criterion, iai-callgrind, cargo-flamegraph, samply, DHAT, heap or pprof tools, cargo-bloat, cargo-llvm-lines, and build timings. Use when users report slow Rust code, high memory or CPU, large binaries, noisy benchmarks, tail-latency regressions, or need performance budgets and evidence-backed optimization.

Backend & APIs135 installs

rust-code-review

full-stack-skills/rust-skills

Review Rust changes for correctness, memory and thread safety, error semantics, unnecessary allocation or cloning, lock scope, API compatibility, test gaps, documentation, and dependency risk, applying the Rust API Guidelines checklist (C-PANIC, C-UNWRAP, C-TRANSMUTE, C-BOOL, C-NEWTYPE, C-COMMON-TRAITS, C-CONVERT, C-SEALED, C-NON-EXHAUSTIVE). Use when reviewing Rust diffs, pull requests, libraries, unsafe boundaries, or production incidents; report actionable findings by severity before summaries, route automated formatting or lint policy to rust-style-clippy, and route API shape decisions (trait sealing, error taxonomy, newtype design, builder patterns) to rust-api-design.

rust-cargo-build

full-stack-skills/rust-skills

Open the skill to read its SKILL.md instructions.

Backend & APIs123 installs

rust-workspace

full-stack-skills/rust-skills

Design Rust project topology — single-crate packages, project-sized multi-crate workspaces (small root-flat, hybrid/domain-grouped, contained crates/, nested, or root-package layouts), workspace-level configuration, dependency DAGs, and crate-boundary decisions. Use when users ask how to split a project into crates, choose paths from the resulting project scale instead of copying a source-language module tree, configure a workspace, avoid dependency cycles, refactor a mixed root-package workspace, or decide between modules and crates. For in-crate src/ layout, see rust-module-layout.

Backend & APIs121 installs

Popular backend & apis skills

View category →

find-skills

vercel-labs/skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

OfficialBackend & APIs4.1M installs

entra-app-registration

microsoft/azure-skills

Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.

OfficialBackend & APIs566.7K installs

This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).

Backend & APIs514.8K installs

embedded-captions

heygen-com/hyperframes

Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.

Backend & APIs453.3K installs

entra-agent-id

microsoft/azure-skills

Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).

OfficialBackend & APIs336.6K installs

neon

neondatabase/agent-skills

Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.

Backend & APIs237.1K installs