agentleFS
MicrosoftKnown publishermicrosoft/python-environment-tools/.github/skills/rust-precommit/SKILL.md

rust-precommit

Skill210 starsChanged 10 months agoMITView on GitHub

Run the mandatory PET Rust pre-commit checks (cargo fmt + cargo clippy -D warnings) before every commit. Invoke whenever you are about to commit Rust changes, after applying review feedback, or whenever you need to verify formatting and lint cleanliness.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before staging any Rust changes for commit.

    line 12
  2. Distinctive:

    After fixing review comments on a PR, before pushing.

    line 13
  3. Very specific:

    Run cargo fmt --all (auto-formats.

    line 34
  4. Very specific:

    Run cargo clippy --all -- -D warnings (treats warnings as errors).

    line 35
  5. Very specific:

    clippy failure: read the diagnostic, fix the code.

    line 41
  6. Very specific:

    After any fix, re-run the script until it reports ALL PRE-COMMIT CHECKS PASSED.

    line 42
  7. Very specific:

    Keep the script in sync with .github/copilot-instructions.md "Required Before Committing" section.

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 383,637 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 Pre-Commit Checks

The PET maintainer workflow requires cargo fmt --all and cargo clippy --all -- -D warnings to pass before every commit. This skill wraps both into a single script invocation.

When to use

  • Before staging any Rust changes for commit.
  • After fixing review comments on a PR, before pushing.
  • Whenever the agent is asked "run pre-commit checks" or "validate the Rust code".

How to run

From the workspace root:

Windows (pwsh)

./scripts/rust-precommit.ps1

macOS / Linux

./scripts/rust-precommit.sh

Both scripts:

  1. Run cargo fmt --all (auto-formats; fails only on unrecoverable errors).
  2. Run cargo clippy --all -- -D warnings (treats warnings as errors).
  3. Exit non-zero on the first failure so callers can gate commits.

Handling failures

  • fmt failure: rare; usually a syntax error preventing parsing. Fix the underlying compile error first.
  • clippy failure: read the diagnostic, fix the code. Do not add #[allow(...)] to suppress unless absolutely justified.
  • After any fix, re-run the script until it reports ALL PRE-COMMIT CHECKS PASSED.

Notes

  • The script must be run from the repository root (or pass the workspace path as the first arg to the .sh variant / -WorkspacePath to the .ps1 variant).
  • Keep the script in sync with .github/copilot-instructions.md "Required Before Committing" section.

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.