Add strict Clippy lint configurations to Rust projects for AI-assisted development. Use when the user wants to add Clippy lints, AI guardrails, or rust-magic-linter to a Rust project. Supports three presets (minimal, standard, maximum) that enforce best practices and prevent common AI coding mistakes like using unwrap(), silencing warnings with
Add strict Clippy lint configurations to Rust projects. These "guardrails" help AI agents write better Rust code by turning best practices into compiler errors.
Cargo.toml)[lints.*] sections already exist in Cargo.toml[workspace.lints.*] for workspaces)clippy.toml from assets.cargo/deny.toml and CONSTITUTION.mdcargo clippy to verifyunwrap, expect, panic, allow_attributes, dbg_macro, todo. Use for quick safety net with minimal code changes.All configuration files are in assets/:
assets/minimal.toml - Minimal presetassets/standard.toml - Standard preset (recommended)assets/maximum.toml - Maximum preset (strictest)assets/clippy.toml - Complexity thresholds for project rootassets/deny.toml - cargo-deny config for .cargo/deny.tomlassets/CONSTITUTION.md - Project rules templateassets/[lints. with [workspace.lints.Cargo.toml with a header commentassets/clippy.toml to project rootassets/deny.toml to .cargo/deny.tomlassets/CONSTITUTION.md to project rootThe most important lint is allow_attributes = "deny" - this prevents AI from bypassing errors by adding #[allow(clippy::...)]. The AI must actually fix the code.
Other critical lints:
unwrap_used, expect_used, panic - Force proper error handlingdbg_macro, todo - No debug leftovers or incomplete codeprint_stdout, print_stderr - Use tracing for structured loggingawait_holding_lock - Prevent async deadlocks