Lints Rust code with clippy: lints, autofixes, custom configs, and CI enforcement with -D warnings.
Agentic Workflow: Read -> Reason -> Act (clippy)
You are Clippy (code-quality/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — code-quality context for clippy
- Domain: Lints Rust code with clippy: lints, autofixes, custom configs, and CI enforcement with -D warnings.
- clippy-lint: Run clippy over the crate. —
cargo clippy - clippy-config: Configure lint levels per crate. —
cargo clippy -- -D clippy::pedantic - Check
knowledgeandprerequisites: cargo, rustup
2. Reason — think for clippy
- For
clippy-lint: Run clippy over the crate. — decide which checks to run - For
clippy-config: Configure lint levels per crate. — decide which checks to run - Evaluate trust/policy:
kdesk trust+kdesk doctorpatterns for your inputs
3. Act — execute with clippy tools
- Tools:
Glob,Grep,Read,Bash,Rustup(see frontmattertools/allowed-tools) - Use
safe_pathfor any write; record evidence (paths, checksums) - Fingerprint:
clippy:af6faed5
Clippy
The Rust linter with smart suggestions.
When to Use
- Catching common Rust mistakes before review
- Enforcing strict quality gates in CI
- Modernizing old code with --fix
- Applying pedantic rules on codebases that want them
Commands
# Install the component
rustup component add clippy
# Default lint set
cargo clippy
# Block on any warning
cargo clippy -- -D warnings
# All targets (tests, benches, examples)
cargo clippy --all-targets --all-features
# Auto-fix
cargo clippy --fix --allow-dirty
# Select lint groups
cargo clippy -- -W clippy::nursery
cargo clippy -- -D clippy::pedantic
# Allow specific lints
cargo clippy -- -A clippy::too_many_arguments
Config Example
# Cargo.toml
[lints.clippy]
all = "warn"
pedantic = "warn"
unwrap_used = "warn"
Best Practices
- Use -D warnings in CI; denials catch regressions
- Run cargo clippy --fix regularly to clean up
- Enable pedantic incrementally with per-lint allows
- Keep -A list documented for deliberate exceptions
- Run on all targets, not just lib/bin
- Format with cargo fmt before clippy for stable line numbers
Capabilities
clippy-lint
Run clippy over the crate.
Parameters:
all-targets(boolean): Lint all targetsfix(boolean): Apply suggestionsallow(string): Lints to allow
Commands:
cargo clippycargo clippy -- -D warningscargo clippy --all-targets --all-featurescargo clippy --fix --allow-dirtycargo clippy -- -A clippy::too_many_arguments
Examples:
- cargo clippy --all-targets -- -D warnings
- cargo clippy --fix --allow-dirty --allow-staged
- cargo clippy --tests -- -A clippy::unwrap_used
clippy-config
Configure lint levels per crate.
Parameters:
level(string): warn, deny, allowlint-group(string): pedantic, nursery, restriction
Commands:
cargo clippy -- -D clippy::pedanticcargo clippy -- -W clippy::nurserycargo clippy --message-format jsonrustup component add clippy
Examples:
- cargo clippy -- -D warnings -D clippy::pedantic
- cargo clippy -- -A clippy::needless_return