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.
In this repository3 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- rust-coding-skillSkill
- rust-locator-patternsSkill
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
- Distinctive: line 12
Before staging any Rust changes for commit.
- Distinctive: line 13
After fixing review comments on a PR, before pushing.
- Very specific: line 34
Run cargo fmt --all (auto-formats.
- Very specific: line 35
Run cargo clippy --all -- -D warnings (treats warnings as errors).
- Very specific: line 41
clippy failure: read the diagnostic, fix the code.
- Very specific: line 42
After any fix, re-run the script until it reports ALL PRE-COMMIT CHECKS PASSED.
- Very specific: line 47
Keep the script in sync with .github/copilot-instructions.md "Required Before Committing" section.
≈ “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.
Files
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.ps1macOS / Linux
./scripts/rust-precommit.shBoth scripts:
- Run
cargo fmt --all(auto-formats; fails only on unrecoverable errors). - Run
cargo clippy --all -- -D warnings(treats warnings as errors). - 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
.shvariant /-WorkspacePathto the.ps1variant). - Keep the script in sync with
.github/copilot-instructions.md"Required Before Committing" section.
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
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.

