agentleFS
saizulsaizul/rust-dev-skills/skills/rust-lint-ci/SKILL.md

rust-lint-ci

Skill0 starsChanged 3 days agoMITView on GitHub

Set up rustfmt, clippy and test CI for a Rust project - a ready GitHub Actions workflow (fmt --check, clippy -D warnings on all targets and features, tests on three OSes, rustdoc warnings, MSRV job, rust-cache), shared lint levels in [workspace.lints], stable-only rustfmt.toml and clippy.toml. Includes an auditor that finds CI that never checks formatting, clippy that cannot fail the build, missing --all-targets or --workspace, archived actions-rs actions, no cache, no MSRV job and nightly-only rustfmt options. Use when the user asks to add Rust CI, enforce cargo fmt or clippy, fix "clippy passes locally but CI fails", choose lint levels, or migrate off actions-rs.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Adopt the workflow: If there is no CI or it is weak, propose assets/ci.yml as .github/workflows/ci.yml.

    line 40
  2. Very specific:

    remove --locked if Cargo.lock is not committed (libraries may choose not to)

    line 43
  3. Very specific:

    Formatting config: Use assets/rustfmt.toml (stable options only).

    line 50

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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 lint and CI

Goal: formatting and lints are enforced the same way locally and in CI, warnings fail the build, and lint levels live in one place ([workspace.lints]), not in scattered #![deny] attributes or CI flags.

Paths below are relative to this skill's folder (in Claude Code: ${CLAUDE_SKILL_DIR}).

When to use

  • "Add CI to my Rust repo", "make clippy fail the PR", "enforce rustfmt"
  • Picking clippy lints (pedantic? restriction?) and where to configure them
  • CI is slow (no cache) or uses archived actions-rs/*
  • Clippy results differ between local and CI runs

When not to use

  • Explaining one specific compiler or clippy error: rust-borrow-checker (its diag_summary.py also summarises clippy JSON)
  • Release automation and crates.io publishing: rust-crates-publish
  • Dependency advisories and license policy in CI: rust-dependency-audit

Workflow

  1. Audit what exists (read-only):
    python3 scripts/ci_audit.py .
    python3 scripts/ci_audit.py . --json --fail-on high
  2. Adopt the workflow. If there is no CI or it is weak, propose assets/ci.yml as .github/workflows/ci.yml. Adjust before writing:
    • MSRV job toolchain = rust-version from Cargo.toml (or delete the job if none)
    • remove --locked if Cargo.lock is not committed (libraries may choose not to)
    • drop macOS/Windows from the matrix if the project is Linux-only Show the file and wait for confirmation; it replaces an existing workflow only if the user agrees.
  3. Centralise lint levels in Cargo.toml ([lints] for one crate, [workspace.lints] plus [lints] workspace = true in members). Start from references/lints.md; groups need priority = -1 so single lints can override them.
  4. Formatting config. Use assets/rustfmt.toml (stable options only). Nightly-only options (imports_granularity, group_imports, ...) need cargo +nightly fmt everywhere; otherwise remove them. Thresholds such as msrv go into assets/clippy.toml.
  5. Fix the existing warnings before turning on -D warnings:
    cargo fmt --all
    cargo clippy --workspace --all-targets --all-features --fix --allow-dirty   # review the diff
    cargo clippy --workspace --all-targets --all-features -- -D warnings
    For large backlogs, allow noisy lints at first (level = "allow" with a TODO) and tighten one lint per PR, see references/lints.md.
  6. Verify with python3 scripts/ci_audit.py . --fail-on low and the same cargo commands CI runs. If cargo is not installed here, give the user the commands.

Decision points

  • -D warnings in CI only (cargo clippy -- -D warnings), never #![deny(warnings)] in code: a new compiler version would break downstream builds of your crate.
  • RUSTFLAGS=-Dwarnings for the whole job also denies rustc warnings, but changes the cache key; prefer the clippy argument.
  • clippy::pedantic: worth it for libraries if added at warn with a few allows; clippy::restriction must never be enabled as a group, pick single lints.
  • Pin the toolchain (rust-toolchain.toml) only for applications that need exact reproducibility; libraries test stable plus MSRV.

Output

CI audit: 9 findings -> 0 after changes
Added: .github/workflows/ci.yml (fmt, clippy -D warnings, test x3 OS, docs, MSRV 1.85)
Cargo.toml: [workspace.lints] with rust + clippy levels; members opt in
rustfmt.toml: removed 2 nightly-only options
Run locally: cargo fmt --all --check && cargo clippy --workspace --all-targets --all-features -- -D warnings

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.